use of org.onap.so.serviceinstancebeans.OwningEntity in project so by onap.
the class ProjectOwningEntityValidation method validate.
@Override
public ValidationInformation validate(ValidationInformation info) throws ValidationException {
int reqVersion = info.getReqVersion();
Project project;
OwningEntity owningEntity;
String requestScope = info.getRequestScope();
Actions action = info.getAction();
project = info.getSir().getRequestDetails().getProject();
owningEntity = info.getSir().getRequestDetails().getOwningEntity();
if (reqVersion >= 5 && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.createInstance || action == Action.assignInstance) {
if (reqVersion > 5 && owningEntity == null) {
throw new ValidationException("owningEntity");
}
if (owningEntity != null && empty(owningEntity.getOwningEntityId())) {
throw new ValidationException("owningEntityId");
}
if (project != null && empty(project.getProjectName())) {
throw new ValidationException("projectName");
}
}
info.setProject(project);
info.setOE(owningEntity);
return info;
}
Aggregations