Modified error text, added comments for regex (#4103)

This commit is contained in:
Nidhi 2021-04-22 16:44:03 +05:30 committed by GitHub
parent 9dff696760
commit 2eec2fba28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 17 additions and 10 deletions

View File

@ -37,7 +37,7 @@ public class AppendMethod implements Method {
@Override
public boolean validateMethodRequest(MethodConfig methodConfig) {
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Id");
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url");
}
if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");

View File

@ -38,7 +38,7 @@ public class BulkAppendMethod implements Method {
@Override
public boolean validateMethodRequest(MethodConfig methodConfig) {
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Id");
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url");
}
if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");

View File

@ -38,7 +38,7 @@ public class BulkUpdateMethod implements Method {
@Override
public boolean validateMethodRequest(MethodConfig methodConfig) {
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Id");
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url");
}
if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");

View File

@ -22,7 +22,7 @@ public class ClearMethod implements Method {
@Override
public boolean validateMethodRequest(MethodConfig methodConfig) {
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Id");
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url");
}
if (methodConfig.getSpreadsheetRange() == null || methodConfig.getSpreadsheetRange().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Data Range");

View File

@ -22,7 +22,7 @@ public class CopyMethod implements Method {
@Override
public boolean validateMethodRequest(MethodConfig methodConfig) {
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Id");
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url");
}
if (methodConfig.getSheetId() == null || methodConfig.getSheetId().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet Id");

View File

@ -30,7 +30,7 @@ public class DeleteRowMethod implements Method {
@Override
public boolean validateMethodRequest(MethodConfig methodConfig) {
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Id");
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url");
}
if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");

View File

@ -32,7 +32,7 @@ public class DeleteSheetMethod implements Method {
@Override
public boolean validateMethodRequest(MethodConfig methodConfig) {
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Id");
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url");
}
if (GoogleSheets.SHEET.equalsIgnoreCase(methodConfig.getDeleteFormat())) {
if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) {

View File

@ -33,14 +33,21 @@ public class GetValuesMethod implements Method {
this.objectMapper = objectMapper;
}
// Used to capture the range of columns in this request. The handling for this regex makes sure that
// all possible combinations of A1 notation for a range map to a common format
Pattern findAllRowsPattern = Pattern.compile("([a-zA-Z]*)\\d*:([a-zA-Z]*)\\d*");
// The starting row for a range is captured using this pattern to find its relative index from table heading
Pattern findOffsetRowPattern = Pattern.compile("(\\d+):");
// Since the value for this pattern is coming from an API response, it also contains the sheet name
// We use this pattern to retrieve only range information
Pattern sheetRangePattern = Pattern.compile(".*!([a-zA-Z]*)\\d*:([a-zA-Z]*)\\d*");
@Override
public boolean validateMethodRequest(MethodConfig methodConfig) {
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Id");
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url");
}
if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");

View File

@ -23,7 +23,7 @@ public class InfoMethod implements Method {
@Override
public boolean validateMethodRequest(MethodConfig methodConfig) {
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Id");
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url");
}
return true;

View File

@ -35,7 +35,7 @@ public class UpdateMethod implements Method {
@Override
public boolean validateMethodRequest(MethodConfig methodConfig) {
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Id");
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url");
}
if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) {
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");