Revision 60307
Added by Alessia Bardi about 3 years ago
RestCollectorPlugin.java | ||
---|---|---|
32 | 32 |
final String authMethod = ifDescriptor.getParams().get("authMethod"); |
33 | 33 |
final String authToken = ifDescriptor.getParams().get("authToken"); |
34 | 34 |
|
35 |
|
|
36 | 35 |
if (StringUtils.isBlank(baseUrl)) {throw new CollectorServiceException("Param 'baseUrl' is null or empty");} |
37 | 36 |
if (StringUtils.isBlank(resumptionType)) {throw new CollectorServiceException("Param 'resumptionType' is null or empty");} |
38 | 37 |
if (StringUtils.isBlank(resumptionParam)) {throw new CollectorServiceException("Param 'resumptionParam' is null or empty");} |
39 | 38 |
// if (StringUtils.isBlank(resumptionXpath)) {throw new CollectorServiceException("Param 'resumptionXpath' is null or empty");} |
40 | 39 |
// if (StringUtils.isBlank(resultTotalXpath)) {throw new CollectorServiceException("Param 'resultTotalXpath' is null or empty");} |
41 | 40 |
// resultFormatParam can be emtpy because some Rest-APIs doesn't like this argument in the query |
42 |
//if (StringUtils.isBlank(resultFormatParam)) {throw new CollectorServiceException("Param 'resultFormatParam' is null, empty or whitespace");}
|
|
41 |
//if (StringUtils.isBlank(resultFormatParam)) {throw new CollectorServiceException("Param 'resultFormatParam' is null, empty or whitespace");}
|
|
43 | 42 |
if (StringUtils.isBlank(resultFormatValue)) {throw new CollectorServiceException("Param 'resultFormatValue' is null or empty");} |
44 |
// if (StringUtils.isBlank(resultSizeParam)) {throw new CollectorServiceException("Param 'resultSizeParam' is null or empty");}
|
|
45 |
// prevent resumptionType: discover -- if (Integer.valueOf(resultSizeValue) <= 1) {throw new CollectorServiceException("Param 'resultSizeValue' is less than 2");}
|
|
46 |
if (StringUtils.isBlank(queryParams)) {throw new CollectorServiceException("Param 'queryParams' is null or empty");}
|
|
43 |
// if (StringUtils.isBlank(resultSizeParam)) {throw new CollectorServiceException("Param 'resultSizeParam' is null or empty");}
|
|
44 |
// prevent resumptionType: discover -- if (Integer.valueOf(resultSizeValue) <= 1) {throw new CollectorServiceException("Param 'resultSizeValue' is less than 2");}
|
|
45 |
if (StringUtils.isBlank(queryParams)) {throw new CollectorServiceException("Param 'queryParams' is null or empty");}
|
|
47 | 46 |
if (StringUtils.isBlank(entityXpath)) {throw new CollectorServiceException("Param 'entityXpath' is null or empty");} |
47 |
|
|
48 |
String resFormat = ifDescriptor.getParams().get("resultOutputFormat"); |
|
49 |
final String resultOutputFormat = StringUtils.isNotBlank(resFormat) ? resFormat.toLowerCase() : resultFormatValue.toLowerCase(); |
|
48 | 50 |
|
49 | 51 |
return () -> new RestIterator( |
50 | 52 |
baseUrl, |
... | ... | |
59 | 61 |
queryParams, |
60 | 62 |
entityXpath, |
61 | 63 |
authMethod, |
62 |
authToken); |
|
64 |
authToken, |
|
65 |
resultOutputFormat); |
|
63 | 66 |
} |
64 | 67 |
|
65 | 68 |
} |
Also available in: Unified diff
Added new optional parameter in case the resultFormatValue is not 'json' but the output is in json format