Skip to content

Commit

Permalink
feat: removed subject links and image urls
Browse files Browse the repository at this point in the history
  • Loading branch information
JordenReuter committed Mar 20, 2024
1 parent 5afef42 commit c3928bf
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 128 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public interface WorkspaceDataImportMapperV1 {
@Mapping(target = "modificationCount", ignore = true)
@Mapping(target = "persisted", ignore = true)
@Mapping(target = "tenantId", ignore = true)
@Mapping(target = "subjectLink", source = "subjectLinks")
@Mapping(target = "imageUrl", source = "imageUrls")
Workspace createWorkspace(WorkspaceImportDTOV1 workspaceDTO);

@AfterMapping
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import static jakarta.persistence.FetchType.LAZY;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import jakarta.persistence.*;

Expand All @@ -21,8 +19,7 @@
@UniqueConstraint(name = "WORKSPACE_NAME_TENANT_ID", columnNames = { "NAME", "TENANT_ID" }),
@UniqueConstraint(name = "WORKSPACE_BASE_URL_TENANT_ID", columnNames = { "BASE_URL", "TENANT_ID" })
})
@NamedEntityGraph(name = Workspace.WORKSPACE_FULL, attributeNodes = { @NamedAttributeNode("subjectLink"),
@NamedAttributeNode("imageUrl"), @NamedAttributeNode(value = "products") })
@NamedEntityGraph(name = Workspace.WORKSPACE_FULL, attributeNodes = { @NamedAttributeNode(value = "products") })
@SuppressWarnings("squid:S2160")
public class Workspace extends TraceableEntity {

Expand Down Expand Up @@ -62,21 +59,10 @@ public class Workspace extends TraceableEntity {
@Column(name = "FOOTER_LABEL")
private String footerLabel;

@ElementCollection(fetch = LAZY)
@CollectionTable(name = "SUBJECT_LINK")
@AttributeOverride(name = "label", column = @Column(name = "link_label"))
@AttributeOverride(name = "url", column = @Column(name = "link_url"))
private Set<SubjectLink> subjectLink = new HashSet<>();

@Column(name = "ROLES")
@OneToMany(mappedBy = "workspace", fetch = LAZY, cascade = { CascadeType.REMOVE, CascadeType.PERSIST })
private List<Role> roles;

@ElementCollection(fetch = LAZY)
@CollectionTable(name = "IMAGE_URL")
@Column(name = "IMAGE_URL")
private Set<String> imageUrl = new HashSet<>();

@Column(name = "LOGO_URL")
private String logoUrl;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ default WorkspaceSnapshotDTOV1 create(Map<String, Workspace> workspaces) {
@Mapping(target = "products", ignore = true)
@Mapping(target = "modificationCount", ignore = true)
@Mapping(target = "id", ignore = true)
@Mapping(target = "subjectLink", source = "subjectLinks")
@Mapping(target = "imageUrl", source = "imageUrls")
Workspace create(EximWorkspaceDTOV1 workspaceDTO);

@Mapping(target = "modificationCount", ignore = true)
Expand Down Expand Up @@ -70,10 +68,6 @@ default void afterWorkspace(EximWorkspaceDTOV1 dto, @MappingTarget Workspace wor
ImportWorkspaceResponseDTOV1 create(WorkspaceSnapshotDTOV1 request,
Map<String, ImportResponseStatusDTOV1> workspaces);

@Mapping(target = "removeSubjectLinksItem", ignore = true)
@Mapping(target = "removeImageUrlsItem", ignore = true)
@Mapping(target = "subjectLinks", source = "subjectLink")
@Mapping(target = "imageUrls", source = "imageUrl")
@Mapping(target = "removeRolesItem", ignore = true)
EximWorkspaceDTOV1 map(Workspace workspace);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ default WorkspaceAbstractDTOV1 mapAbstract(Workspace workspace) {
@Mapping(target = "names", ignore = true)
WorkspaceSearchCriteria map(WorkspaceSearchCriteriaDTOV1 criteria);

@Mapping(target = "subjectLinks", ignore = true)
@Mapping(target = "workspaceRoles", source = "roles")
@Mapping(target = "removeSubjectLinksItem", ignore = true)
@Mapping(target = "imageUrls", ignore = true)
@Mapping(target = "removeImageUrlsItem", ignore = true)
@Mapping(target = "removeWorkspaceRolesItem", ignore = true)
WorkspaceDTOV1 map(Workspace workspace);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ public interface WorkspaceMapper {
@Mapping(target = "removeStreamItem", ignore = true)
WorkspacePageResultDTO mapPageResult(PageResult<Workspace> page);

@Mapping(target = "removeSubjectLinksItem", ignore = true)
@Mapping(target = "removeImageUrlsItem", ignore = true)
@Mapping(target = "subjectLinks", source = "subjectLink")
@Mapping(target = "imageUrls", source = "imageUrl")
WorkspaceDTO map(Workspace data);

}
11 changes: 0 additions & 11 deletions src/main/openapi/di-workspace-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,11 @@ components:
type: string
footerLabel:
type: string
subjectLinks:
maxItems: 3
uniqueItems: true
type: array
items:
$ref: '#/components/schemas/SubjectLink'
products:
type: array
uniqueItems: true
items:
$ref: "#/components/schemas/Product"
imageUrls:
uniqueItems: true
type: array
items:
type: string
workspaceRoles:
type: array
uniqueItems: true
Expand Down
11 changes: 0 additions & 11 deletions src/main/openapi/onecx-workspace-exim-v1-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,6 @@ components:
type: array
items:
$ref: '#/components/schemas/EximWorkspaceRole'
subjectLinks:
uniqueItems: true
maxItems: 3
type: array
items:
$ref: '#/components/schemas/EximSubjectLink'
imageUrls:
uniqueItems: true
type: array
items:
type: string
EximWorkspaceRole:
type: object
properties:
Expand Down
33 changes: 0 additions & 33 deletions src/main/openapi/onecx-workspace-internal-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -963,17 +963,6 @@ components:
type: string
address:
$ref: '#/components/schemas/WorkspaceAddress'
subjectLink:
uniqueItems: true
maxItems: 3
type: array
items:
$ref: '#/components/schemas/SubjectLink'
imageUrl:
uniqueItems: true
type: array
items:
type: string
UpdateWorkspaceRequest:
required:
- name
Expand Down Expand Up @@ -1005,17 +994,6 @@ components:
type: string
address:
$ref: '#/components/schemas/WorkspaceAddress'
subjectLink:
uniqueItems: true
maxItems: 3
type: array
items:
$ref: '#/components/schemas/SubjectLink'
imageUrl:
uniqueItems: true
type: array
items:
type: string
Workspace:
required:
- name
Expand Down Expand Up @@ -1056,17 +1034,6 @@ components:
type: string
address:
$ref: '#/components/schemas/WorkspaceAddress'
subjectLinks:
uniqueItems: true
maxItems: 3
type: array
items:
$ref: '#/components/schemas/SubjectLink'
imageUrls:
uniqueItems: true
type: array
items:
type: string
WorkspaceAbstract:
required:
- name
Expand Down
11 changes: 0 additions & 11 deletions src/main/openapi/onecx-workspace-v1-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,6 @@ components:
type: string
address:
$ref: '#/components/schemas/WorkspaceAddress'
subjectLinks:
uniqueItems: true
maxItems: 3
type: array
items:
$ref: '#/components/schemas/SubjectLink'
imageUrls:
uniqueItems: true
type: array
items:
type: string
WorkspaceAddress:
type: object
properties:
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/db/changeLog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
<include relativeToChangelogFile="true" file="v1/2023-11-09-data-import-log.xml"/>
<include relativeToChangelogFile="true" file="v1/2024-02-22-create-table-image.xml"/>
<include relativeToChangelogFile="true" file="v1/2024-03-19-update-assignment-constraints.xml"/>
<include relativeToChangelogFile="true" file="v1/2024-03-20-drop-image-urls-subject-links.xml"/>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>

<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"
objectQuotingStrategy="QUOTE_ONLY_RESERVED_WORDS">
<changeSet author="dev (generated)" id="1710944924844-1">
<dropForeignKeyConstraint baseTableName="image_url" constraintName="image_url_workspace_guid"/>
<dropForeignKeyConstraint baseTableName="subject_link" constraintName="subject_link_workspace_guid"/>
<dropTable tableName="image_url"/>
<dropTable tableName="subject_link"/>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,6 @@ void getWorkspace() {
assertThat(dto.getBaseUrl()).isNotNull().isEqualTo("/company1");
assertThat(dto.getAddress()).isNotNull();
assertThat(dto.getAddress().getStreetNo()).isEqualTo("6");
assertThat(dto.getImageUrls()).isNotEmpty();
assertThat(dto.getSubjectLinks()).isNotEmpty();
}

@ParameterizedTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ void getWorkspace() {
assertThat(dto.getBaseUrl()).isNotNull().isEqualTo("/company1");
assertThat(dto.getAddress()).isNotNull();
assertThat(dto.getAddress().getStreetNo()).isEqualTo("6");
assertThat(dto.getImageUrls()).isNotEmpty();
assertThat(dto.getSubjectLinks()).isNotEmpty();
}

@Test
Expand All @@ -147,8 +145,6 @@ void getWorkspaceByName() {
assertThat(dto.getBaseUrl()).isNotNull().isEqualTo("/company1");
assertThat(dto.getAddress()).isNotNull();
assertThat(dto.getAddress().getStreetNo()).isEqualTo("6");
assertThat(dto.getImageUrls()).isNotEmpty();
assertThat(dto.getSubjectLinks()).isNotEmpty();
}

@Test
Expand Down
8 changes: 0 additions & 8 deletions src/test/resources/data/testdata-internal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@
<MENU_ITEM guid="55-5" optlock="0" badge="" description="" disabled="FALSE" key="PORTAL_USER_MENU2" name="Sub User Menu" external="FALSE" pos="0" scope="WORKSPACE" url="" parent="55-4" workspace="22-111" application_id="" tenant_id="tenant-200"/>
<MENU_ITEM guid="55-6" optlock="0" badge="" description="" disabled="FALSE" key="PORTAL_USER_MENU3" name="Sub Sub User Menu" external="FALSE" pos="0" scope="WORKSPACE" url="" parent="55-5" workspace="22-111" application_id="" tenant_id="tenant-200"/>

<!-- IMAGE_URL -->
<IMAGE_URL workspace_guid="11-111" image_url="url1.com"/>
<IMAGE_URL workspace_guid="11-111" image_url="url2.com"/>

<!-- SUBJECT_LINK -->
<SUBJECT_LINK workspace_guid="11-111" link_label="label_1" link_url="url_1"/>
<SUBJECT_LINK workspace_guid="11-111" link_label="lebel_2" link_url="url-2"/>

<!-- PRODUCT -->
<PRODUCT guid="1234" optlock="10" workspace_guid="11-111" product_name="onecx-core" base_url="/core" tenant_id="tenant-100"/>
<PRODUCT guid="5678" optlock="10" workspace_guid="11-111" product_name="onecx-apm" base_url="/apm" tenant_id="tenant-100"/>
Expand Down

0 comments on commit c3928bf

Please sign in to comment.