private static void copyAttributes(TechnicalProduct domObj, VOTechnicalService vo) throws ValidationException { BLValidator.isId(FIELD_NAME_TECHNICAL_SERVICE_ID, vo.getTechnicalServiceId(), true); BLValidator.isId(FIELD_NAME_TECHNICAL_SERVICE_BUILD_ID, vo.getTechnicalServiceBuildId(), false); BLValidator.isDescription(FIELD_NAME_LOGIN_PATH, vo.getLoginPath(), false); BLValidator.isDescription(FIELD_NAME_PROVISIONING_VERSION, vo.getProvisioningVersion(), false); String baseUrl = vo.getBaseUrl(); while (baseUrl != null && (baseUrl.endsWith("\\"))) { baseUrl = baseUrl.substring(0, baseUrl.length() - 1); } BLValidator.isUrl( FIELD_NAME_BASE_URL, baseUrl, vo.getAccessType() != ServiceAccessType.DIRECT && vo.getAccessType() != ServiceAccessType.USER); String provisioningUrl = vo.getProvisioningUrl(); if (vo.getAccessType() != ServiceAccessType.EXTERNAL) { // if the provisioning URL is relative and the base URL is set // create an absolute URL with the help of the base URL if (provisioningUrl != null) { String lower = provisioningUrl.toLowerCase(); if (baseUrl != null && !lower.startsWith(PROTOCOLL_HTTP) && !lower.startsWith(PROTOCOLL_HTTPS)) { provisioningUrl = removeEndingSlash(baseUrl) + provisioningUrl; } } BLValidator.isUrl(FIELD_NAME_PROVISIONING_URL, provisioningUrl, true); } else if (provisioningUrl == null) { provisioningUrl = ""; } String loginPath = vo.getLoginPath(); if (loginPath == null) { loginPath = ""; } BLValidator.isRelativeUrl(FIELD_NAME_LOGIN_PATH, loginPath, baseUrl, false); domObj.setTechnicalProductId(vo.getTechnicalServiceId()); domObj.setTechnicalProductBuildId(vo.getTechnicalServiceBuildId()); domObj.setAccessType(vo.getAccessType()); domObj.setBaseURL(baseUrl); domObj.setLoginPath(loginPath); domObj.setProvisioningURL(provisioningUrl); domObj.setProvisioningVersion(vo.getProvisioningVersion()); domObj.setBillingIdentifier(vo.getBillingIdentifier()); }
/** * Validates the given Landingpage object that reflects the settings in the given value object. * * @param voObj The value object containing the values to be validated. * @throws ValidationException Thrown if the attributes at the value object do not meet all * constraints. */ public static void validate(VOPublicLandingpage voObj) throws ValidationException { BLValidator.isNotNull("marketplaceId", voObj.getMarketplaceId()); BLValidator.isNonNegativeNumber("numberServices", voObj.getNumberServices()); BLValidator.isNotNull("fillinCriterion", voObj.getFillinCriterion()); BLValidator.isNotNull("landingpageServices", voObj.getLandingpageServices()); }