@Override public ServerProfileSchemaDto saveServerProfileSchema(ServerProfileSchemaDto serverProfileSchema) throws ControlServiceException { if (isNotBlank(serverProfileSchema.getCtlSchemaId())) { return serverProfileService.saveServerProfileSchema(serverProfileSchema); } else { LOG.error("Server profile schema has no CTL schema ID"); throw new ControlServiceException("Server profile schema has no CTL schema ID"); } }
private ServerProfileSchemaDto createDefaultServerProfileSchema(String appId, String createdUsername) { ServerProfileSchemaDto serverProfileSchemaDto = new ServerProfileSchemaDto(); serverProfileSchemaDto.setApplicationId(appId); CTLSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername); serverProfileSchemaDto.setCtlSchemaId(ctlSchema.getId()); serverProfileSchemaDto.setName(DEFAULT_SCHEMA_NAME); serverProfileSchemaDto.setCreatedUsername(createdUsername); return serverProfileService.saveServerProfileSchema(serverProfileSchemaDto); }
protected ServerProfileSchemaDto generateServerProfileSchema(String appId, String tenantId, int version) { ServerProfileSchemaDto schemaDto = new ServerProfileSchemaDto(); if (isBlank(tenantId)) { ApplicationDto applicationDto = generateApplicationDto(); appId = applicationDto.getId(); tenantId = applicationDto.getTenantId(); } schemaDto.setApplicationId(appId); schemaDto.setCreatedTime(System.currentTimeMillis()); CTLSchemaDto ctlSchema = ctlService.saveCtlSchema(generateCTLSchemaDto(ctlRandomFqn(), tenantId, appId, version)); schemaDto.setCtlSchemaId(ctlSchema.getId()); return serverProfileService.saveServerProfileSchema(schemaDto); }