Skip to content

Commit

Permalink
KAA-1279: Change CtlSchemaDto class name
Browse files Browse the repository at this point in the history
  • Loading branch information
sashadidukh committed Sep 30, 2016
1 parent 8f455fa commit f688c74
Show file tree
Hide file tree
Showing 45 changed files with 400 additions and 390 deletions.
Expand Up @@ -56,7 +56,7 @@
import org.kaaproject.kaa.common.dto.admin.UserProfileUpdateDto;
import org.kaaproject.kaa.common.dto.credentials.CredentialsDto;
import org.kaaproject.kaa.common.dto.credentials.CredentialsStatus;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto;
import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaExportMethod;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto;
import org.kaaproject.kaa.common.dto.event.AefMapInfoDto;
Expand Down Expand Up @@ -97,7 +97,6 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -942,7 +941,7 @@ public FileData downloadSdk(SdkProfileDto key) throws Exception {
return data;
}

public FileData downloadCtlSchemaByAppToken(CTLSchemaDto ctlSchemaDto,
public FileData downloadCtlSchemaByAppToken(CtlSchemaDto ctlSchemaDto,
CTLSchemaExportMethod method, String appToken) {
FileDataResponseExtractor extractor = new FileDataResponseExtractor();
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
Expand All @@ -962,7 +961,7 @@ public void flushSdkCache() throws Exception {
}


public CTLSchemaDto saveCTLSchemaWithAppToken(String body, String tenantId,
public CtlSchemaDto saveCTLSchemaWithAppToken(String body, String tenantId,
String applicationToken) {
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("body", body);
Expand All @@ -973,7 +972,7 @@ public CTLSchemaDto saveCTLSchemaWithAppToken(String body, String tenantId,
params.add("applicationToken", applicationToken);
}
return restTemplate.postForObject(restTemplate.getUrl() + "CTL/saveSchema",
params, CTLSchemaDto.class);
params, CtlSchemaDto.class);
}

public void deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(String fqn,
Expand All @@ -992,27 +991,27 @@ public void deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(String fqn,
restTemplate.postForLocation(restTemplate.getUrl() + "CTL/deleteSchema", params);
}

public CTLSchemaDto getCTLSchemaByFqnVersionTenantIdAndApplicationToken(
public CtlSchemaDto getCTLSchemaByFqnVersionTenantIdAndApplicationToken(
String fqn, Integer version, String tenantId, String applicationToken) {
if (tenantId != null && applicationToken != null) {
return restTemplate.getForObject(
restTemplate.getUrl() + "CTL/getSchema?fqn={fqn}&version={version}&tenantId={tenantId}"
+ "&applicationToken={applicationToken}",
CTLSchemaDto.class, fqn, version, tenantId, applicationToken);
CtlSchemaDto.class, fqn, version, tenantId, applicationToken);
} else if (tenantId != null) {
return restTemplate.getForObject(
restTemplate.getUrl() + "CTL/getSchema?fqn={fqn}&version={version}&tenantId={tenantId}",
CTLSchemaDto.class, fqn, version, tenantId);
CtlSchemaDto.class, fqn, version, tenantId);
} else {
return restTemplate.getForObject(
restTemplate.getUrl() + "CTL/getSchema?fqn={fqn}&version={version}",
CTLSchemaDto.class, fqn, version);
CtlSchemaDto.class, fqn, version);
}
}

public CTLSchemaDto getCTLSchemaById(String id) {
public CtlSchemaDto getCTLSchemaById(String id) {
return restTemplate.getForObject(restTemplate.getUrl() + "CTL/getSchemaById?id={id}",
CTLSchemaDto.class, id);
CtlSchemaDto.class, id);
}

public boolean checkFqnExistsWithAppToken(String fqn, String tenantId,
Expand Down
Expand Up @@ -17,7 +17,7 @@
package org.kaaproject.kaa.server.common.dao;

import org.apache.avro.Schema;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto;
import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto;
import org.kaaproject.kaa.common.dto.file.FileData;

Expand All @@ -35,17 +35,17 @@ public interface CTLService {
* Get or create empty CTL schema with system scope.
*
* @param createdUsername the name of user.
* @return CTLSchemaDto the empty schema with system scope.
* @return CtlSchemaDto the empty schema with system scope.
*/
CTLSchemaDto getOrCreateEmptySystemSchema(String createdUsername);
CtlSchemaDto getOrCreateEmptySystemSchema(String createdUsername);

/**
* Update existing CTL schema by the given CTL schema object.
*
* @param ctlSchema the CTL schema object.
* @return CTLSchemaDto the updated object.
* @return CtlSchemaDto the updated object.
*/
CTLSchemaDto updateCTLSchema(CTLSchemaDto ctlSchema);
CtlSchemaDto updateCTLSchema(CtlSchemaDto ctlSchema);

/**
* Update existing CTL schema meta info scope by the given CTL schema meta info object.
Expand Down Expand Up @@ -81,17 +81,17 @@ public interface CTLService {
* Find a CTL schema with the given identifier.
*
* @param schemaId the CTL schema identifier.
* @return CTLSchemaDto the CTL schema with the given identifier.
* @return CtlSchemaDto the CTL schema with the given identifier.
*/
CTLSchemaDto findCTLSchemaById(String schemaId);
CtlSchemaDto findCTLSchemaById(String schemaId);

/**
* Saves the given CTL schema to the database.
*
* @param ctlSchemaDto the CTL schema to save.
* @return CTLSchemaDto the saved CTL schema.
* @return CtlSchemaDto the saved CTL schema.
*/
CTLSchemaDto saveCTLSchema(CTLSchemaDto ctlSchemaDto);
CtlSchemaDto saveCTLSchema(CtlSchemaDto ctlSchemaDto);

/**
* Find CTL schema with the given meta info id and version.
Expand All @@ -100,7 +100,7 @@ public interface CTLService {
* @param version the schema version.
* @return the CTL schema with the given meta info id and version.
*/
CTLSchemaDto findByMetaInfoIdAndVer(String metaInfoId, Integer version);
CtlSchemaDto findByMetaInfoIdAndVer(String metaInfoId, Integer version);

/**
* Find a CTL schema of the given tenant or application with the given fully qualified name
Expand All @@ -112,7 +112,7 @@ public interface CTLService {
* @param applicationId the application identifier.
* @return the CTL schema with the given fully qualified name and version number.
*/
CTLSchemaDto findCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(String fqn, Integer version, String tenantId, String applicationId);
CtlSchemaDto findCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(String fqn, Integer version, String tenantId, String applicationId);

/**
* Find any CTL schema of the given tenant or application with the given fully qualified name
Expand All @@ -124,14 +124,14 @@ public interface CTLService {
* @param applicationId the application identifier.
* @return the any CTL schema with the given fully qualified name and version number.
*/
CTLSchemaDto findAnyCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(String fqn, Integer version, String tenantId, String applicationId);
CtlSchemaDto findAnyCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(String fqn, Integer version, String tenantId, String applicationId);

/**
* Find system CTL schemas available in the database.
*
* @return the list of available system CTL schemas in the database.
*/
List<CTLSchemaDto> findSystemCTLSchemas();
List<CtlSchemaDto> findSystemCTLSchemas();

/**
* Find system CTL schemas meta info available in the database.
Expand Down Expand Up @@ -169,15 +169,15 @@ public interface CTLService {
* @return the latest version of CTL schema with the given fully qualified name, tenant and
* application identifier.
*/
CTLSchemaDto findLatestCTLSchemaByFqnAndTenantIdAndApplicationId(String fqn, String tenantId, String applicationId);
CtlSchemaDto findLatestCTLSchemaByFqnAndTenantIdAndApplicationId(String fqn, String tenantId, String applicationId);

/**
* Find the last version of CTL schema with the given meta info id.
*
* @param metaInfoId the id of meta info object.
* @return the latest version of CTL schema with the given meta info id.
*/
CTLSchemaDto findLatestByMetaInfoId(String metaInfoId);
CtlSchemaDto findLatestByMetaInfoId(String metaInfoId);

/**
* Find all available versions of CTL schema with the given fully qualified name, tenant and
Expand All @@ -189,14 +189,14 @@ public interface CTLService {
* @return the list of available versions of CTL schema with the given fully qualified name,
* tenant and application identifier.
*/
List<CTLSchemaDto> findAllCTLSchemasByFqnAndTenantIdAndApplicationId(String fqn, String tenantId, String applicationId);
List<CtlSchemaDto> findAllCTLSchemasByFqnAndTenantIdAndApplicationId(String fqn, String tenantId, String applicationId);

/**
* Find CTL schemas available in the database.
*
* @return the list of available CTL schemas in the database.
*/
List<CTLSchemaDto> findCTLSchemas();
List<CtlSchemaDto> findCTLSchemas();

/**
* Find the dependents CTL schemas from CTL schema with the given schema
Expand All @@ -205,7 +205,7 @@ public interface CTLService {
* @param schemaId the schema identifier.
* @return the list of dependents CTL schemas from CTL schema with the given identifier.
*/
List<CTLSchemaDto> findCTLSchemaDependents(String schemaId);
List<CtlSchemaDto> findCTLSchemaDependents(String schemaId);

/**
* Find the dependents CTL schemas from CTL schema with the given tenant, application,
Expand All @@ -218,15 +218,15 @@ public interface CTLService {
* @return the list of dependents CTL schemas from CTL schema with the given tenant, application,
* fully qualified name and version.
*/
List<CTLSchemaDto> findCTLSchemaDependents(String fqn, Integer version, String tenantId, String applicationId);
List<CtlSchemaDto> findCTLSchemaDependents(String fqn, Integer version, String tenantId, String applicationId);

/**
* Exports the body of a CTL schema.
*
* @param schema A CTL schema to export
* @return A file containing the body of a CTL schema
*/
FileData shallowExport(CTLSchemaDto schema);
FileData shallowExport(CtlSchemaDto schema);

/**
* Exports the body of a CTL schema with all dependencies inline,
Expand All @@ -235,7 +235,7 @@ public interface CTLService {
* @param schema A CTL schema to export
* @return A string containing the body of a CTL schema with all dependencies inline, recursively
*/
String flatExportAsString(CTLSchemaDto schema);
String flatExportAsString(CtlSchemaDto schema);

/**
* Exports the body of a CTL schema with all dependencies inline,
Expand All @@ -245,7 +245,7 @@ public interface CTLService {
* @return A Schema object containing the body of a CTL schema with all dependencies inline,
* recursively
*/
Schema flatExportAsSchema(CTLSchemaDto schema);
Schema flatExportAsSchema(CtlSchemaDto schema);

/**
* Exports the body of a CTL schema with all dependencies inline,
Expand All @@ -254,7 +254,7 @@ public interface CTLService {
* @param schema A CTL schema to export
* @return A file containing the body of a CTL schema with all dependencies inline, recursively
*/
FileData flatExport(CTLSchemaDto schema);
FileData flatExport(CtlSchemaDto schema);

/**
* Exports the body of a CTL schema with all dependencies as different
Expand All @@ -264,5 +264,5 @@ public interface CTLService {
* @return An archive containing the body of a CTL schema as a file and all dependencies as
* different files, recursively.
*/
FileData deepExport(CTLSchemaDto schema);
FileData deepExport(CtlSchemaDto schema);
}
Expand Up @@ -32,7 +32,7 @@
import static org.kaaproject.kaa.server.common.dao.DaoConstants.CTL_SCHEMA_VERSION;
import static org.kaaproject.kaa.server.common.dao.model.sql.ModelUtils.getLongId;

import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto;
import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto;
import org.kaaproject.kaa.server.common.dao.impl.DaoUtil;

import java.io.Serializable;
Expand All @@ -54,7 +54,7 @@
@Entity
@Table(name = CTL_SCHEMA_TABLE_NAME, uniqueConstraints =
@UniqueConstraint(columnNames = {CTL_SCHEMA_META_INFO_ID, CTL_SCHEMA_VERSION}, name = CTL_SCHEMA_UNIQUE_CONSTRAINT))
public class CTLSchema extends GenericModel<CTLSchemaDto> implements Serializable {
public class CTLSchema extends GenericModel<CtlSchemaDto> implements Serializable {

private static final long serialVersionUID = -1179381742235545494L;

Expand Down Expand Up @@ -87,7 +87,7 @@ public CTLSchema(Long id) {
this.id = id;
}

public CTLSchema(CTLSchemaDto dto) {
public CTLSchema(CtlSchemaDto dto) {
this.id = getLongId(dto.getId());
this.metaInfo = new CTLSchemaMetaInfo(dto.getMetaInfo());
this.version = dto.getVersion();
Expand All @@ -96,12 +96,12 @@ public CTLSchema(CTLSchemaDto dto) {
update(dto);
}

public void update(CTLSchemaDto dto) {
public void update(CtlSchemaDto dto) {
this.body = dto.getBody();
this.defaultRecord = dto.getDefaultRecord();
Set<CTLSchemaDto> dependencies = dto.getDependencySet();
Set<CtlSchemaDto> dependencies = dto.getDependencySet();
if (dependencies != null && !dependencies.isEmpty()) {
for (CTLSchemaDto dependency : dependencies) {
for (CtlSchemaDto dependency : dependencies) {
dependencySet.add(new CTLSchema(dependency));
}
}
Expand Down Expand Up @@ -164,18 +164,18 @@ public void setCreatedTime(long createdTime) {
}

@Override
protected CTLSchemaDto createDto() {
return new CTLSchemaDto();
protected CtlSchemaDto createDto() {
return new CtlSchemaDto();
}

@Override
protected GenericModel<CTLSchemaDto> newInstance(Long id) {
protected GenericModel<CtlSchemaDto> newInstance(Long id) {
return new CTLSchema(id);
}

@Override
public CTLSchemaDto toDto() {
CTLSchemaDto ctlSchemaDto = createDto();
public CtlSchemaDto toDto() {
CtlSchemaDto ctlSchemaDto = createDto();
ctlSchemaDto.setId(getStringId());
ctlSchemaDto.setMetaInfo(metaInfo.toDto());
ctlSchemaDto.setVersion(version);
Expand Down
Expand Up @@ -34,7 +34,7 @@
import org.kaaproject.kaa.common.dto.NotificationSchemaDto;
import org.kaaproject.kaa.common.dto.NotificationTypeDto;
import org.kaaproject.kaa.common.dto.ServerProfileSchemaDto;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto;
import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto;
import org.kaaproject.kaa.common.dto.logs.LogSchemaDto;
import org.kaaproject.kaa.server.common.dao.ApplicationService;
import org.kaaproject.kaa.server.common.dao.CTLService;
Expand Down Expand Up @@ -225,7 +225,7 @@ private EndpointGroupDto createDefaultGroup(String appId, String createdUsername
private EndpointProfileSchemaDto createDefaultProfileSchema(String appId, String createdUsername) {
EndpointProfileSchemaDto profileSchemaDto = new EndpointProfileSchemaDto();
profileSchemaDto.setApplicationId(appId);
CTLSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername);
CtlSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername);
profileSchemaDto.setCtlSchemaId(ctlSchema.getId());
profileSchemaDto.setName(DEFAULT_SCHEMA_NAME);
profileSchemaDto.setCreatedUsername(createdUsername);
Expand All @@ -239,7 +239,7 @@ private EndpointProfileSchemaDto createDefaultProfileSchema(String appId, String
private ConfigurationDto createDefaultConfigurationWithSchema(String appId, String groupId, String createdUsername) {
ConfigurationSchemaDto schema = new ConfigurationSchemaDto();
schema.setApplicationId(appId);
CTLSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername);
CtlSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername);
schema.setCtlSchemaId(ctlSchema.getId());
schema.setName(DEFAULT_SCHEMA_NAME);
schema.setCreatedUsername(createdUsername);
Expand All @@ -255,7 +255,7 @@ private ConfigurationDto createDefaultConfigurationWithSchema(String appId, Stri
private ServerProfileSchemaDto createDefaultServerProfileSchema(String appId, String createdUsername) {
ServerProfileSchemaDto serverProfileSchemaDto = new ServerProfileSchemaDto();
serverProfileSchemaDto.setApplicationId(appId);
CTLSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername);
CtlSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername);
serverProfileSchemaDto.setCtlSchemaId(ctlSchema.getId());
serverProfileSchemaDto.setName(DEFAULT_SCHEMA_NAME);
serverProfileSchemaDto.setCreatedUsername(createdUsername);
Expand All @@ -265,7 +265,7 @@ private ServerProfileSchemaDto createDefaultServerProfileSchema(String appId, St
private NotificationSchemaDto createDefaultNotificationSchema(String appId, String createdUsername) {
NotificationSchemaDto notificationSchemaDto = new NotificationSchemaDto();
notificationSchemaDto.setApplicationId(appId);
CTLSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername);
CtlSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername);
notificationSchemaDto.setCtlSchemaId(ctlSchema.getId());
notificationSchemaDto.setName(DEFAULT_SCHEMA_NAME);
notificationSchemaDto.setCreatedUsername(createdUsername);
Expand All @@ -280,7 +280,7 @@ private NotificationSchemaDto createDefaultNotificationSchema(String appId, Stri
private LogSchemaDto createDefaultLogSchema(String appId, String createdUsername) {
LogSchemaDto schema = new LogSchemaDto();
schema.setApplicationId(appId);
CTLSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername);
CtlSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername);
schema.setCtlSchemaId(ctlSchema.getId());
schema.setName(DEFAULT_SCHEMA_NAME);
schema.setCreatedUsername(createdUsername);
Expand Down

0 comments on commit f688c74

Please sign in to comment.