Modified error text, added comments for regex (#4103)
This commit is contained in:
parent
9dff696760
commit
2eec2fba28
|
|
@ -37,7 +37,7 @@ public class AppendMethod implements Method {
|
||||||
@Override
|
@Override
|
||||||
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
||||||
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
|
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()) {
|
if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) {
|
||||||
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");
|
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public class BulkAppendMethod implements Method {
|
||||||
@Override
|
@Override
|
||||||
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
||||||
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
|
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()) {
|
if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) {
|
||||||
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");
|
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public class BulkUpdateMethod implements Method {
|
||||||
@Override
|
@Override
|
||||||
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
||||||
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
|
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()) {
|
if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) {
|
||||||
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");
|
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public class ClearMethod implements Method {
|
||||||
@Override
|
@Override
|
||||||
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
||||||
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
|
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()) {
|
if (methodConfig.getSpreadsheetRange() == null || methodConfig.getSpreadsheetRange().isBlank()) {
|
||||||
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Data Range");
|
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Data Range");
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public class CopyMethod implements Method {
|
||||||
@Override
|
@Override
|
||||||
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
||||||
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
|
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()) {
|
if (methodConfig.getSheetId() == null || methodConfig.getSheetId().isBlank()) {
|
||||||
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet Id");
|
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet Id");
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public class DeleteRowMethod implements Method {
|
||||||
@Override
|
@Override
|
||||||
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
||||||
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
|
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()) {
|
if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) {
|
||||||
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");
|
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ public class DeleteSheetMethod implements Method {
|
||||||
@Override
|
@Override
|
||||||
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
||||||
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
|
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 (GoogleSheets.SHEET.equalsIgnoreCase(methodConfig.getDeleteFormat())) {
|
||||||
if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) {
|
if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) {
|
||||||
|
|
|
||||||
|
|
@ -33,14 +33,21 @@ public class GetValuesMethod implements Method {
|
||||||
this.objectMapper = objectMapper;
|
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*");
|
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+):");
|
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*");
|
Pattern sheetRangePattern = Pattern.compile(".*!([a-zA-Z]*)\\d*:([a-zA-Z]*)\\d*");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
||||||
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
|
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()) {
|
if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) {
|
||||||
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");
|
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ public class InfoMethod implements Method {
|
||||||
@Override
|
@Override
|
||||||
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
||||||
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
|
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;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public class UpdateMethod implements Method {
|
||||||
@Override
|
@Override
|
||||||
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
public boolean validateMethodRequest(MethodConfig methodConfig) {
|
||||||
if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) {
|
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()) {
|
if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) {
|
||||||
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");
|
throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user