Refactored code which check basic provided information
This commit is contained in:
parent
1733b66c05
commit
b384c08972
|
@ -274,18 +274,17 @@ public class CKANPackage extends CKAN {
|
||||||
if(objectNode.has(LICENSE_KEY)) {
|
if(objectNode.has(LICENSE_KEY)) {
|
||||||
licenseId = objectNode.get(LICENSE_KEY).asText();
|
licenseId = objectNode.get(LICENSE_KEY).asText();
|
||||||
}
|
}
|
||||||
if(licenseId == null || licenseId.isEmpty() && !allowPartialInfo) {
|
|
||||||
|
if(licenseId!=null && !licenseId.isEmpty()) {
|
||||||
|
try {
|
||||||
|
CKANLicense.checkLicenseId(licenseId);
|
||||||
|
} catch(Exception e) {
|
||||||
|
throw new BadRequestException(
|
||||||
|
"You must specify an existing license identifier for the item. License list can be retrieved using licence collection");
|
||||||
|
}
|
||||||
|
}else if(!allowPartialInfo) {
|
||||||
throw new BadRequestException(
|
throw new BadRequestException(
|
||||||
"You must specify a license identifier for the item. License list can be retrieved using licence collection");
|
"You must specify a license identifier for the item. License list can be retrieved using licence collection");
|
||||||
} else {
|
|
||||||
if(licenseId!=null) {
|
|
||||||
try {
|
|
||||||
CKANLicense.checkLicenseId(licenseId);
|
|
||||||
} catch(Exception e) {
|
|
||||||
throw new BadRequestException(
|
|
||||||
"You must specify an existing license identifier for the item. License list can be retrieved using licence collection");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(objectNode.has(CAPACITY_KEY)) {
|
if(objectNode.has(CAPACITY_KEY)) {
|
||||||
|
|
Loading…
Reference in New Issue