in custos-services/custos-integration-services/sharing-management-service/src/main/java/org/apache/custos/sharing/management/interceptors/SharingManagementInputValidator.java [47:95]
private void validate(String methodName, Object body, Metadata headers) {
if (methodName.equals("createEntity") || methodName.equals("updateEntity")) {
validationAuthorizationHeader(headers);
if (body instanceof EntityRequest) {
EntityRequest request = (EntityRequest) body;
if (request.getEntity() == null ||
request.getEntity().getOwnerId() == null || request.getEntity().getOwnerId().equals("")) {
throw new MissingParameterException("OwnerId not found", null);
}
} else {
throw new MissingParameterException("Unexpected input type for method " + methodName, null);
}
} else if (methodName.equals("shareEntityWithUsers") || methodName.equals("revokeEntitySharingFromUsers")) {
validationAuthorizationHeader(headers);
if (body instanceof SharingRequest) {
SharingRequest request = (SharingRequest) body;
if (request.getOwnerIdList() == null ||
request.getOwnerIdList() == null || request.getOwnerIdList().size() == 0) {
throw new MissingParameterException("OwnerId not found", null);
}
} else {
throw new MissingParameterException("Unexpected input type for method " + methodName, null);
}
} else if (methodName.equals("shareEntityWithGroups") || methodName.equals("revokeEntitySharingFromGroups")) {
validationAuthorizationHeader(headers);
if (body instanceof SharingRequest) {
SharingRequest request = (SharingRequest) body;
if (request.getOwnerIdList() == null ||
request.getOwnerIdList() == null || request.getOwnerIdList().size() == 0) {
throw new MissingParameterException("Group Id not found", null);
}
} else {
throw new MissingParameterException("Unexpected input type for method " + methodName, null);
}
}
}