diff --git a/activiti-cloud-modeling-service/activiti-cloud-acceptance-tests-modeling/src/main/java/org/activiti/cloud/acc/modeling/modeling/ModelingNamingIdentifier.java b/activiti-cloud-modeling-service/activiti-cloud-acceptance-tests-modeling/src/main/java/org/activiti/cloud/acc/modeling/modeling/ModelingNamingIdentifier.java index c180676804e..29fa0c99d23 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-acceptance-tests-modeling/src/main/java/org/activiti/cloud/acc/modeling/modeling/ModelingNamingIdentifier.java +++ b/activiti-cloud-modeling-service/activiti-cloud-acceptance-tests-modeling/src/main/java/org/activiti/cloud/acc/modeling/modeling/ModelingNamingIdentifier.java @@ -50,7 +50,7 @@ public static ModelingNamingIdentifier projectNamed(String name) { return new ModelingNamingIdentifier(name) { @Override protected String getName(Project project) { - return project.getName(); + return project.getTechnicalName(); } }; } @@ -59,7 +59,7 @@ public static ModelingNamingIdentifier projectsNamed(List names) { return new ModelingNamingIdentifier(names) { @Override protected String getName(Project project) { - return project.getName(); + return project.getTechnicalName(); } }; } diff --git a/activiti-cloud-modeling-service/activiti-cloud-acceptance-tests-modeling/src/main/java/org/activiti/cloud/acc/modeling/steps/ModelingProjectsSteps.java b/activiti-cloud-modeling-service/activiti-cloud-acceptance-tests-modeling/src/main/java/org/activiti/cloud/acc/modeling/steps/ModelingProjectsSteps.java index 2a4522b5cd8..56c6adc055f 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-acceptance-tests-modeling/src/main/java/org/activiti/cloud/acc/modeling/steps/ModelingProjectsSteps.java +++ b/activiti-cloud-modeling-service/activiti-cloud-acceptance-tests-modeling/src/main/java/org/activiti/cloud/acc/modeling/steps/ModelingProjectsSteps.java @@ -74,7 +74,7 @@ public void checkCurrentProjects(List expectedNames) { assertThat( modelingContextHandler .getCurrentProjects() - .map(resources -> resources.stream().map(EntityModel::getContent).map(Project::getName)) + .map(resources -> resources.stream().map(EntityModel::getContent).map(Project::getTechnicalName)) .orElseGet(Stream::empty) .collect(Collectors.toList()) ) @@ -84,7 +84,7 @@ public void checkCurrentProjects(List expectedNames) { @Step public EntityModel create(String projectName) { Project project = mock(Project.class); - doReturn(projectName).when(project).getName(); + doReturn(projectName).when(project).getTechnicalName(); return create(project); } @@ -92,7 +92,7 @@ public EntityModel create(String projectName) { public void updateProjectName(String newProjectName) { EntityModel currentContext = checkAndGetCurrentContext(Project.class); Project project = currentContext.getContent(); - project.setName(newProjectName); + project.setTechnicalName(newProjectName); modelingProjectService.updateByUri(modelingUri(currentContext.getLink(SELF).get().getHref()), project); } @@ -101,7 +101,7 @@ public void updateProjectName(String newProjectName) { public void checkCurrentProjectName(String projectName) { updateCurrentModelingObject(); EntityModel currentContext = checkAndGetCurrentContext(Project.class); - assertThat(currentContext.getContent().getName()).isEqualTo(projectName); + assertThat(currentContext.getContent().getTechnicalName()).isEqualTo(projectName); } @Step @@ -172,11 +172,11 @@ public void checkExportedProjectContainsModel( assertThat(modelingContextHandler.getCurrentModelingFile()) .hasValueSatisfying(fileContent -> assertThatFileContent(fileContent) - .hasName(currentProject.getName() + ".zip") + .hasName(currentProject.getTechnicalName() + ".zip") .hasContentType(ContentTypeUtils.CONTENT_TYPE_ZIP) .isZip() .hasEntries( - changeToJsonFilename(currentProject.getName()), + changeToJsonFilename(currentProject.getTechnicalName()), modelType.getFolderName() + "/", modelType.getFolderName() + "/" + @@ -186,8 +186,8 @@ public void checkExportedProjectContainsModel( changeExtension(modelName, modelType.getContentFileExtension()) ) .hasJsonContentSatisfying( - changeToJsonFilename(currentProject.getName()), - jsonContent -> jsonContent.node("name").isEqualTo(currentProject.getName()) + changeToJsonFilename(currentProject.getTechnicalName()), + jsonContent -> jsonContent.node("name").isEqualTo(currentProject.getTechnicalName()) ) .hasJsonContentSatisfying( modelType.getFolderName() + diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-api-impl/src/main/java/org/activiti/cloud/modeling/api/impl/ProjectImpl.java b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-api-impl/src/main/java/org/activiti/cloud/modeling/api/impl/ProjectImpl.java index 81f61fb744e..c3f48ecb388 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-api-impl/src/main/java/org/activiti/cloud/modeling/api/impl/ProjectImpl.java +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-api-impl/src/main/java/org/activiti/cloud/modeling/api/impl/ProjectImpl.java @@ -34,8 +34,11 @@ public class ProjectImpl extends AbstractAuditable implements Project extends Auditable { void setName(String name); + String getTechnicalName(); + + void setTechnicalName(String name); + + String getDisplayName(); + + void setDisplayName(String name); + String getVersion(); void setVersion(String version); diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-jpa/src/main/java/org/activiti/cloud/services/modeling/entity/ProjectEntity.java b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-jpa/src/main/java/org/activiti/cloud/services/modeling/entity/ProjectEntity.java index 0850be533a8..186b9efc9e8 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-jpa/src/main/java/org/activiti/cloud/services/modeling/entity/ProjectEntity.java +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-jpa/src/main/java/org/activiti/cloud/services/modeling/entity/ProjectEntity.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; +import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; @@ -36,7 +37,7 @@ /** * Project model entity */ -@Table(name = "Project", uniqueConstraints = @UniqueConstraint(columnNames = { "name", "createdBy" })) +@Table(name = "Project", uniqueConstraints = @UniqueConstraint(columnNames = { "tech_name", "createdBy" })) @Entity(name = "Project") @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(NON_NULL) @@ -51,7 +52,11 @@ public class ProjectEntity extends AuditableEntity implements Project implements Project models) { @Override public String getName() { - return name; + return getTechnicalName(); } @Override public void setName(String name) { - this.name = name; + setTechnicalName(name); + + //TODO: Modify temporary code that sets display name same as technical name + setDisplayName(name); + } + + @Override + public String getTechnicalName() { + return technicalName; + } + + @Override + public void setTechnicalName(String technicalName) { + this.technicalName = technicalName; + } + + @Override + public String getDisplayName() { + return displayName; + } + + @Override + public void setDisplayName(String displayName) { + this.displayName = displayName; } @Override diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-jpa/src/main/java/org/activiti/cloud/services/modeling/jpa/ProjectJpaRepository.java b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-jpa/src/main/java/org/activiti/cloud/services/modeling/jpa/ProjectJpaRepository.java index 3548b60f4e2..f3eabfc5758 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-jpa/src/main/java/org/activiti/cloud/services/modeling/jpa/ProjectJpaRepository.java +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-jpa/src/main/java/org/activiti/cloud/services/modeling/jpa/ProjectJpaRepository.java @@ -35,11 +35,11 @@ exported = false ) public interface ProjectJpaRepository extends JpaRepository, ProjectRepository { - Page findAllByNameContaining(String name, Pageable pageable); + Page findAllByTechnicalNameContaining(String name, Pageable pageable); Page findAllByIdIn(Collection filteredProjectIds, Pageable pageable); - Page findAllByNameContainingAndIdIn( + Page findAllByTechnicalNameContainingAndIdIn( String name, Collection filteredProjectIds, Pageable pageable @@ -48,9 +48,9 @@ Page findAllByNameContainingAndIdIn( @Override default Page getProjects(Pageable pageable, String nameToFilter, List filteredProjectIds) { if (nameToFilter != null && filteredProjectIds != null) { - return findAllByNameContainingAndIdIn(nameToFilter, filteredProjectIds, pageable); + return findAllByTechnicalNameContainingAndIdIn(nameToFilter, filteredProjectIds, pageable); } else if (nameToFilter != null) { - return findAllByNameContaining(nameToFilter, pageable); + return findAllByTechnicalNameContaining(nameToFilter, pageable); } else if (filteredProjectIds != null) { return findAllByIdIn(filteredProjectIds, pageable); } else { diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-jpa/src/test/java/org/activiti/cloud/services/modeling/jpa/ModelRepositoryImplTest.java b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-jpa/src/test/java/org/activiti/cloud/services/modeling/jpa/ModelRepositoryImplTest.java index 85bb7c9b791..2886e12248c 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-jpa/src/test/java/org/activiti/cloud/services/modeling/jpa/ModelRepositoryImplTest.java +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-jpa/src/test/java/org/activiti/cloud/services/modeling/jpa/ModelRepositoryImplTest.java @@ -57,7 +57,7 @@ public void setUp() { repository = new ModelRepositoryImpl(modelJpaRepository); project = new ProjectEntity(); project.setId("testProjectId"); - project.setName("testProjectName"); + project.setTechnicalName("testProjectName"); model = new ModelEntity(); model.setId("testModelId"); model.setName("testNameId"); diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-liquibase/src/main/resources/config/modeling/liquibase/changelog/05.pg.update.sql b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-liquibase/src/main/resources/config/modeling/liquibase/changelog/05.pg.update.sql new file mode 100644 index 00000000000..51e02753350 --- /dev/null +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-liquibase/src/main/resources/config/modeling/liquibase/changelog/05.pg.update.sql @@ -0,0 +1,30 @@ +/* + * Copyright 2017-2020 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + ALTER TABLE project + ADD COLUMN disp_name varchar(255); + + UPDATE project p + SET disp_name = p.name; + + ALTER TABLE project + ALTER COLUMN disp_name SET NOT NULL; + + ALTER TABLE project + RENAME COLUMN name TO tech_name; + + ALTER TABLE project + ALTER COLUMN tech_name SET NOT NULL; diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-liquibase/src/main/resources/config/modeling/liquibase/changelog/h2.schema.sql b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-liquibase/src/main/resources/config/modeling/liquibase/changelog/h2.schema.sql index 1c56532795c..2f1526071b7 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-liquibase/src/main/resources/config/modeling/liquibase/changelog/h2.schema.sql +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-liquibase/src/main/resources/config/modeling/liquibase/changelog/h2.schema.sql @@ -41,7 +41,8 @@ create table project last_modified_by varchar(255), last_modified_date timestamp, description varchar(255), - name varchar(255), + tech_name varchar(255) not null, + disp_name varchar(255) not null, version varchar(255), primary key (id) ); @@ -54,7 +55,7 @@ create table project_models alter table model_versions add constraint UK_ei9juhk09r20q4bmvgpjrcrs3 unique (versions_version, versions_versioned_entity_id); alter table project - add constraint unique_project_name_createdby unique (name, created_by); + add constraint unique_project_name_createdby unique (tech_name, created_by); alter table model add constraint FKqjpgrrtoo1bryor3iymmb03pu foreign key (latest_version_version, latest_version_versioned_entity_id) references model_version; alter table model_versions diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-liquibase/src/main/resources/config/modeling/liquibase/master.xml b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-liquibase/src/main/resources/config/modeling/liquibase/master.xml index ffb726a6185..d9b92881cb1 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-liquibase/src/main/resources/config/modeling/liquibase/master.xml +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-liquibase/src/main/resources/config/modeling/liquibase/master.xml @@ -67,4 +67,13 @@ splitStatements="true" stripComments="true"/> + + + + diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-rest/src/main/java/org/activiti/cloud/services/modeling/rest/validation/ProjectPayloadValidator.java b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-rest/src/main/java/org/activiti/cloud/services/modeling/rest/validation/ProjectPayloadValidator.java index 3765222f044..38bea4edf73 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-rest/src/main/java/org/activiti/cloud/services/modeling/rest/validation/ProjectPayloadValidator.java +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-rest/src/main/java/org/activiti/cloud/services/modeling/rest/validation/ProjectPayloadValidator.java @@ -30,8 +30,8 @@ public ProjectPayloadValidator(boolean validateRequiredFields) { @Override public void validatePayload(Project project, Errors errors) { - if (validateRequiredFields || project.getName() != null) { - validateDNSName(project.getName(), "project") + if (validateRequiredFields || project.getTechnicalName() != null) { + validateDNSName(project.getTechnicalName(), "project") .forEach(error -> errors.rejectValue("name", error.getErrorCode(), error.getDescription())); } } diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-rest/src/test/java/org/activiti/cloud/services/modeling/rest/controller/ProjectControllerExistingNameIT.java b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-rest/src/test/java/org/activiti/cloud/services/modeling/rest/controller/ProjectControllerExistingNameIT.java index 63d0d8347ed..97d4919b239 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-rest/src/test/java/org/activiti/cloud/services/modeling/rest/controller/ProjectControllerExistingNameIT.java +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-rest/src/test/java/org/activiti/cloud/services/modeling/rest/controller/ProjectControllerExistingNameIT.java @@ -111,7 +111,7 @@ public void should_returnStatusCreated_when_importingProjectWithExistingNameCrea .andExpect(status().isCreated()); assertThat((Page) projectRepository.getProjects(Pageable.ofSize(50), null, null)) - .extracting(ProjectEntity::getCreatedBy, ProjectEntity::getName) + .extracting(ProjectEntity::getCreatedBy, ProjectEntity::getTechnicalName) .contains(tuple("otherUser", "application-xy"), tuple("testuser", "application-xy")); } @@ -129,7 +129,7 @@ public void should_returnStatusCreated_when_creatingProjectWithExistingNameCreat .andExpect(status().isCreated()); assertThat((Page) projectRepository.getProjects(Pageable.ofSize(50), null, null)) - .extracting(ProjectEntity::getCreatedBy, ProjectEntity::getName) + .extracting(ProjectEntity::getCreatedBy, ProjectEntity::getTechnicalName) .contains(tuple("otherUser", "creating-project"), tuple("testuser", "creating-project")); } @@ -149,7 +149,7 @@ public void should_returnStatusOk_when_updatingProjectWithExistingNameCreatedByO .andExpect(status().isOk()); assertThat((Page) projectRepository.getProjects(Pageable.ofSize(50), null, null)) - .extracting(ProjectEntity::getCreatedBy, ProjectEntity::getName) + .extracting(ProjectEntity::getCreatedBy, ProjectEntity::getTechnicalName) .contains(tuple("otherUser", "updating-project"), tuple("testuser", "updating-project")); } @@ -165,7 +165,7 @@ public void should_returnStatusOk_when_copyingProjectWithExistingNameCreatedByOt .andExpect(status().isOk()); assertThat((Page) projectRepository.getProjects(Pageable.ofSize(50), null, null)) - .extracting(ProjectEntity::getCreatedBy, ProjectEntity::getName) + .extracting(ProjectEntity::getCreatedBy, ProjectEntity::getTechnicalName) .contains(tuple("otherUser", "copying-project"), tuple("testuser", "copying-project")); } } diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-rest/src/test/java/org/activiti/cloud/services/modeling/rest/controller/ProjectControllerIT.java b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-rest/src/test/java/org/activiti/cloud/services/modeling/rest/controller/ProjectControllerIT.java index 234a556146a..f36738470bc 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-rest/src/test/java/org/activiti/cloud/services/modeling/rest/controller/ProjectControllerIT.java +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-rest/src/test/java/org/activiti/cloud/services/modeling/rest/controller/ProjectControllerIT.java @@ -234,7 +234,7 @@ public void should_returnStatusOk_when_updatingExistingProject() throws Exceptio assertThat((Optional) projectRepository.findProjectById(project.getId())) .hasValueSatisfying(updatedProject -> { - assertThat(updatedProject.getName()).isEqualTo("updated-project-name"); + assertThat(updatedProject.getTechnicalName()).isEqualTo("updated-project-name"); }); } diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/service/ProjectDescriptor.java b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/service/ProjectDescriptor.java index a96e40e0277..3e9459ea41c 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/service/ProjectDescriptor.java +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/service/ProjectDescriptor.java @@ -50,7 +50,7 @@ public String getId() { } public String getName() { - return project.getName(); + return project.getTechnicalName(); } public String getVersion() { diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/service/ProjectHolder.java b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/service/ProjectHolder.java index 605d21b368e..46f919d40b1 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/service/ProjectHolder.java +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/service/ProjectHolder.java @@ -45,7 +45,7 @@ public ProjectHolder setProject(Project project, @Nullable String name) { if (this.project == null) { this.project = project; if (!StringUtils.isBlank(name)) { - this.project.setName(name); + this.project.setTechnicalName(name); } } return this; diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/service/ProjectServiceImpl.java b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/service/ProjectServiceImpl.java index 1389208cb72..0eb75e088f5 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/service/ProjectServiceImpl.java +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/service/ProjectServiceImpl.java @@ -159,7 +159,7 @@ public Project createProject(Project project) { @Override public Project updateProject(Project projectToUpdate, Project newProject) { Optional.ofNullable(newProject.getDescription()).ifPresent(projectToUpdate::setDescription); - Optional.ofNullable(newProject.getName()).ifPresent(projectToUpdate::setName); + Optional.ofNullable(newProject.getTechnicalName()).ifPresent(projectToUpdate::setTechnicalName); return projectRepository.updateProject(projectToUpdate); } @@ -205,10 +205,10 @@ public Optional findProjectById(String projectId, List include) public FileContent exportProject(Project project) throws IOException { ProjectDescriptor projectDescriptor = buildDescriptor(project); - ZipBuilder zipBuilder = new ZipBuilder(project.getName()) + ZipBuilder zipBuilder = new ZipBuilder(project.getTechnicalName()) .appendFile( descriptorJsonConverter.convertToJsonBytes(projectDescriptor), - changeToJsonFilename(project.getName()) + changeToJsonFilename(project.getTechnicalName()) ); modelService @@ -548,7 +548,10 @@ private ProjectHolder getProjectHolderFromZipStream(ZipStream stream, String nam @Override public Project replaceProjectContentWithProvidedModelsInFile(Project project, InputStream inputStream) throws IOException { - ProjectHolder projectHolder = getProjectHolderFromZipStream(ZipStream.of(inputStream), project.getName()); + ProjectHolder projectHolder = getProjectHolderFromZipStream( + ZipStream.of(inputStream), + project.getTechnicalName() + ); if (projectHolder.getProjectMetadata().isEmpty()) { throw new ImportProjectException("No valid project entry found to import"); diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/validation/project/ProjectNameValidator.java b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/validation/project/ProjectNameValidator.java index 2954ace8766..b0760b36759 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/validation/project/ProjectNameValidator.java +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/main/java/org/activiti/cloud/services/modeling/validation/project/ProjectNameValidator.java @@ -28,6 +28,7 @@ public class ProjectNameValidator implements ProjectValidator, DNSNameValidator @Override public Stream validate(Project project, ValidationContext validationContext) { - return validateDNSName(project.getName(), "project"); + Stream validationErrors = validateDNSName(project.getTechnicalName(), "project"); + return validationErrors; } } diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/test/java/org/activiti/cloud/services/modeling/service/ModelServiceImplTest.java b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/test/java/org/activiti/cloud/services/modeling/service/ModelServiceImplTest.java index 77788e26c31..4455fca6f27 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/test/java/org/activiti/cloud/services/modeling/service/ModelServiceImplTest.java +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/test/java/org/activiti/cloud/services/modeling/service/ModelServiceImplTest.java @@ -138,7 +138,7 @@ public class ModelServiceImplTest { public void setUp() { projectOne = new ProjectImpl(); projectOne.setId("projectOneId"); - projectOne.setName("projectOne"); + projectOne.setTechnicalName("projectOne"); modelType = new ProcessModelType(); modelTwo = new ModelImpl(); diff --git a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/test/java/org/activiti/cloud/services/modeling/service/ProjectServiceImplTest.java b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/test/java/org/activiti/cloud/services/modeling/service/ProjectServiceImplTest.java index eca0f6f07dc..c42ffc8eccd 100644 --- a/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/test/java/org/activiti/cloud/services/modeling/service/ProjectServiceImplTest.java +++ b/activiti-cloud-modeling-service/activiti-cloud-services-modeling/activiti-cloud-services-modeling-service/src/test/java/org/activiti/cloud/services/modeling/service/ProjectServiceImplTest.java @@ -211,7 +211,7 @@ public void should_returnProject_copyingProject() { Project copiedProject = projectService.copyProject(projectToCopy, copiedProjectName); - assertThat(copiedProject.getName()).isEqualTo(copiedProjectName); + assertThat(copiedProject.getTechnicalName()).isEqualTo(copiedProjectName); verify(projectRepository, times(1)).copyProject(projectToCopy, copiedProjectName); verify(modelService, times(1)).copyModel(modelOne, projectToCopy); verify(modelService, times(1)).cleanModelIdList();