Search in sources :

Example 1 with LineOfBusiness

use of org.onap.so.serviceinstancebeans.LineOfBusiness in project so by onap.

the class PlatformLOBValidation method validate.

@Override
public ValidationInformation validate(ValidationInformation info) throws ValidationException {
    int reqVersion = info.getReqVersion();
    Platform platform;
    LineOfBusiness lineOfBusiness;
    String requestScope = info.getRequestScope();
    Actions action = info.getAction();
    platform = info.getSir().getRequestDetails().getPlatform();
    lineOfBusiness = info.getSir().getRequestDetails().getLineOfBusiness();
    if (reqVersion >= 5 && requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.createInstance) {
        if (reqVersion > 5 && platform == null) {
            throw new ValidationException("platform");
        }
        if (platform != null && empty(platform.getPlatformName())) {
            throw new ValidationException("platformName");
        }
        if (lineOfBusiness != null && empty(lineOfBusiness.getLineOfBusinessName())) {
            throw new ValidationException("lineOfBusinessName");
        }
    }
    info.setPlatform(platform);
    info.setLOB(lineOfBusiness);
    return info;
}
Also used : ValidationException(org.onap.so.exceptions.ValidationException) Platform(org.onap.so.serviceinstancebeans.Platform) Actions(org.onap.so.apihandlerinfra.Actions) LineOfBusiness(org.onap.so.serviceinstancebeans.LineOfBusiness)

Aggregations

Actions (org.onap.so.apihandlerinfra.Actions)1 ValidationException (org.onap.so.exceptions.ValidationException)1 LineOfBusiness (org.onap.so.serviceinstancebeans.LineOfBusiness)1 Platform (org.onap.so.serviceinstancebeans.Platform)1