Cleanup and fixed some potential problems.

deploy_packages_to_gitea
Jens Pelzetter 2023-01-23 20:57:31 +01:00
parent 55b2f6c6ba
commit ca87bcb6af
32 changed files with 247 additions and 487 deletions

View File

@ -1,12 +1,12 @@
{ {
"name": "@librecms/ccm-cms", "name": "@librecms/ccm-cms",
"version": "7.0.0-SNAPSHOT.2023-01-18T182914", "version": "7.0.0-SNAPSHOT.2023-01-19T185030",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@librecms/ccm-cms", "name": "@librecms/ccm-cms",
"version": "7.0.0-SNAPSHOT.2023-01-18T182914", "version": "7.0.0-SNAPSHOT.2023-01-19T185030",
"license": "LGPL-3.0-or-later", "license": "LGPL-3.0-or-later",
"dependencies": { "dependencies": {
"@tiptap/core": "^2.0.0-beta.127", "@tiptap/core": "^2.0.0-beta.127",

View File

@ -1,6 +1,6 @@
{ {
"name": "@librecms/ccm-cms", "name": "@librecms/ccm-cms",
"version": "7.0.0-SNAPSHOT.2023-01-18T182914", "version": "7.0.0-SNAPSHOT.2023-01-19T185030",
"description": "JavaScript stuff for ccm-cms", "description": "JavaScript stuff for ccm-cms",
"main": "target/generated-resources/assets/@content-sections/cms-admin.js", "main": "target/generated-resources/assets/@content-sections/cms-admin.js",
"types": "target/generated-resources/assets/@content-sections/cms-admin.d.ts", "types": "target/generated-resources/assets/@content-sections/cms-admin.d.ts",

View File

@ -69,6 +69,13 @@ public abstract class AbstractAssetImExporter<T extends Asset>
protected final void updateExistingEntity( protected final void updateExistingEntity(
final T existingEntity, final T importedEntity final T existingEntity, final T importedEntity
) { ) {
if (!Objects.equals(
existingEntity.getDisplayName(),
importedEntity.getDisplayName()
)) {
existingEntity.setDisplayName(importedEntity.getDisplayName());
}
if (!Objects.equals( if (!Objects.equals(
existingEntity.getTitle(), existingEntity.getTitle(),
importedEntity.getTitle() importedEntity.getTitle()

View File

@ -18,7 +18,6 @@
*/ */
package org.librecms.assets; package org.librecms.assets;
import org.librecms.contentsection.Asset; import org.librecms.contentsection.Asset;
import java.io.Serializable; import java.io.Serializable;
@ -67,11 +66,12 @@ public class Bookmark extends Asset implements Serializable {
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "values", name = "values",
joinTable = @JoinTable(name = "BOOKMARK_DESCRIPTIONS", joinTable = @JoinTable(
schema = DB_SCHEMA, name = "BOOKMARK_DESCRIPTIONS",
joinColumns = { schema = DB_SCHEMA,
@JoinColumn(name = "ASSET_ID") joinColumns = {
} @JoinColumn(name = "ASSET_ID")
}
) )
) )
private LocalizedString description; private LocalizedString description;

View File

@ -43,9 +43,9 @@ import javax.persistence.Table;
import static org.librecms.CmsConstants.*; import static org.librecms.CmsConstants.*;
/** /**
* Base class for contactable entities. Not for public use, but needs to be * Base class for contactable entities. Not for public use, but needs to be
* public to give UI classes in the {@code com.arsdigita} packages access. * public to give UI classes in the {@code com.arsdigita} packages access.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@Entity @Entity
@ -96,12 +96,10 @@ public class ContactableEntity extends Asset {
} }
protected void addContactEntry(final ContactEntry contactEntry) { protected void addContactEntry(final ContactEntry contactEntry) {
contactEntries.add(contactEntry); contactEntries.add(contactEntry);
} }
protected void removeContactEntry(final ContactEntry contactEntry) { protected void removeContactEntry(final ContactEntry contactEntry) {
contactEntries.remove(contactEntry); contactEntries.remove(contactEntry);
} }
@ -127,7 +125,6 @@ public class ContactableEntity extends Asset {
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
if (this == obj) { if (this == obj) {
return true; return true;
} }
@ -158,13 +155,15 @@ public class ContactableEntity extends Asset {
@Override @Override
public String toString(final String data) { public String toString(final String data) {
return super.toString(
return super.toString(String.format( String.format(
"contactEntries = { %s }, " "contactEntries = { %s }, "
+ "postalAddress = %s%s", + "postalAddress = %s%s",
Objects.toString(contactEntries), Objects.toString(contactEntries),
Objects.toString(postalAddress), Objects.toString(postalAddress),
data)); data
)
);
} }
} }

View File

@ -87,31 +87,6 @@ public class Person extends ContactableEntity {
) )
private List<PersonName> personNames; private List<PersonName> personNames;
// /**
// * The surname/familyname of the person
// */
// @Column(name = "SURNAME")
// private String surname;
//
// /**
// * The given name of the person.
// */
// @Column(name = "GIVEN_NAME")
// private String givenName;
//
// /**
// * Any prefixes to the name of the person. Examples are Prof. or Dr.
// */
// @Column(name = "NAME_PREFIX")
// private String prefix;
//
// /**
// * Any suffixes to the name of the person. Examples for suffixes are
// * PhD, or especially for Great Britain the membership in various orders,
// * for example KBE or CBE.
// */
// @Column(name = "SUFFIX")
// private String suffix;
/** /**
* The birthdate of the person. * The birthdate of the person.
*/ */
@ -125,37 +100,6 @@ public class Person extends ContactableEntity {
personNames = new ArrayList<>(); personNames = new ArrayList<>();
} }
// public String getSurname() {
// return surname;
// }
//
// public void setSurname(final String surname) {
// this.surname = surname;
// }
//
// public String getGivenName() {
// return givenName;
// }
//
// public void setGivenName(final String givenName) {
// this.givenName = givenName;
// }
//
// public String getPrefix() {
// return prefix;
// }
//
// public void setPrefix(final String prefix) {
// this.prefix = prefix;
// }
//
// public String getSuffix() {
// return suffix;
// }
//
// public void setSuffix(final String suffix) {
// this.suffix = suffix;
// }
public List<PersonName> getPersonNames() { public List<PersonName> getPersonNames() {
return Collections.unmodifiableList(personNames); return Collections.unmodifiableList(personNames);

View File

@ -18,7 +18,6 @@
*/ */
package org.librecms.assets; package org.librecms.assets;
import org.librecms.contentsection.Asset; import org.librecms.contentsection.Asset;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.libreccm.l10n.LocalizedString; import org.libreccm.l10n.LocalizedString;
@ -64,11 +63,12 @@ public class SideNote extends Asset implements Serializable {
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "values", name = "values",
joinTable = @JoinTable(name = "SIDE_NOTE_TEXTS", joinTable = @JoinTable(
schema = DB_SCHEMA, name = "SIDE_NOTE_TEXTS",
joinColumns = { schema = DB_SCHEMA,
@JoinColumn(name = "SIDE_NOTE_ID") joinColumns = {
} @JoinColumn(name = "SIDE_NOTE_ID")
}
) )
) )
private LocalizedString text; private LocalizedString text;

View File

@ -51,6 +51,14 @@ public class VideoAssetImExporter
final VideoAsset existingAsset, final VideoAsset existingAsset,
final VideoAsset importedAsset final VideoAsset importedAsset
) { ) {
if (existingAsset.getWidth() != importedAsset.getWidth()) {
existingAsset.setWidth(importedAsset.getWidth());
}
if (existingAsset.getHeight() != importedAsset.getHeight()) {
existingAsset.setHeight(importedAsset.getHeight());
}
if (!Objects.equals( if (!Objects.equals(
existingAsset.getLegalMetadata(), existingAsset.getLegalMetadata(),
importedAsset.getLegalMetadata() importedAsset.getLegalMetadata()

View File

@ -46,7 +46,7 @@ public abstract class AbstractContentItemImExporter<T extends ContentItem>
@Inject @Inject
private AttachmentListImExporter attachmentListImExporter; private AttachmentListImExporter attachmentListImExporter;
@Inject @Inject
private ContentItemRepository itemRepository; private ContentItemRepository itemRepository;
@ -84,7 +84,7 @@ public abstract class AbstractContentItemImExporter<T extends ContentItem>
//AttachmentList import requiresw all content items to be imported //AttachmentList import requiresw all content items to be imported
attachmentListImExporter.addRequiredEntities(Set.of(getEntityClass())); attachmentListImExporter.addRequiredEntities(Set.of(getEntityClass()));
initContentItemImExporter(); initContentItemImExporter();
} }
@ -122,13 +122,6 @@ public abstract class AbstractContentItemImExporter<T extends ContentItem>
); );
} }
if (!Objects.equals(
existingEntity.getContentType(),
importedEntity.getContentType()
)) {
existingEntity.setContentType(importedEntity.getContentType());
}
if (!Objects.equals( if (!Objects.equals(
existingEntity.getTitle(), existingEntity.getTitle(),
importedEntity.getTitle() importedEntity.getTitle()
@ -203,7 +196,7 @@ public abstract class AbstractContentItemImExporter<T extends ContentItem>
importedEntity.getCreationUserName() importedEntity.getCreationUserName()
); );
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getLastModifyingUserName(), existingEntity.getLastModifyingUserName(),
importedEntity.getLastModifyingUserName() importedEntity.getLastModifyingUserName()
@ -214,7 +207,7 @@ public abstract class AbstractContentItemImExporter<T extends ContentItem>
} }
updateExistingContentItem(existingEntity, importedEntity); updateExistingContentItem(existingEntity, importedEntity);
itemRepository.save(existingEntity); itemRepository.save(existingEntity);
} }

View File

@ -650,7 +650,8 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
name = "CONTENT_ITEM_DESCRIPTIONS", name = "CONTENT_ITEM_DESCRIPTIONS",
schema = DB_SCHEMA, schema = DB_SCHEMA,
joinColumns = { joinColumns = {
@JoinColumn(name = "OBJECT_ID")} @JoinColumn(name = "OBJECT_ID")
}
)) ))
@IndexedEmbedded @IndexedEmbedded
@XmlElement(name = "description", namespace = CMS_XML_NS) @XmlElement(name = "description", namespace = CMS_XML_NS)

View File

@ -78,13 +78,6 @@ public class ContentTypeImExporter
existingEntity.setDisplayName(importedEntity.getDisplayName()); existingEntity.setDisplayName(importedEntity.getDisplayName());
} }
if (!Objects.equals(
existingEntity.getContentSection(),
importedEntity.getContentSection()
)) {
existingEntity.setContentSection(importedEntity.getContentSection());
}
if (!Objects.equals( if (!Objects.equals(
existingEntity.getLabel(), existingEntity.getLabel(),
importedEntity.getLabel() importedEntity.getLabel()
@ -118,11 +111,11 @@ public class ContentTypeImExporter
)) { )) {
existingEntity.setDescendants(importedEntity.getDescendants()); existingEntity.setDescendants(importedEntity.getDescendants());
} }
if (existingEntity.getMode() != importedEntity.getMode()) { if (existingEntity.getMode() != importedEntity.getMode()) {
existingEntity.setMode(importedEntity.getMode()); existingEntity.setMode(importedEntity.getMode());
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getDefaultLifecycle(), existingEntity.getDefaultLifecycle(),
importedEntity.getDefaultLifecycle() importedEntity.getDefaultLifecycle()
@ -131,7 +124,7 @@ public class ContentTypeImExporter
importedEntity.getDefaultLifecycle() importedEntity.getDefaultLifecycle()
); );
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getDefaultWorkflow(), existingEntity.getDefaultWorkflow(),
importedEntity.getDefaultWorkflow() importedEntity.getDefaultWorkflow()
@ -140,7 +133,7 @@ public class ContentTypeImExporter
importedEntity.getDefaultWorkflow() importedEntity.getDefaultWorkflow()
); );
} }
contentTypeRepo.save(existingEntity); contentTypeRepo.save(existingEntity);
} }

View File

@ -1,6 +1,5 @@
package org.librecms.contentsection; package org.librecms.contentsection;
import net.bytebuddy.build.Plugin;
import org.libreccm.categorization.Category; import org.libreccm.categorization.Category;
import org.libreccm.categorization.CategoryManager; import org.libreccm.categorization.CategoryManager;
import org.libreccm.categorization.Domain; import org.libreccm.categorization.Domain;
@ -14,7 +13,6 @@ import java.util.Set;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.inject.Inject; import javax.inject.Inject;
import javax.transaction.Transactional;
/* /*
* Copyright (C) 2022 LibreCCM Foundation. * Copyright (C) 2022 LibreCCM Foundation.
@ -122,28 +120,6 @@ public class FolderImExporter extends AbstractEntityImExporter<Folder> {
existingEntity.setName(withImportedEntity.getName()); existingEntity.setName(withImportedEntity.getName());
} }
if (!Objects.equals(
existingEntity.getParentCategory(),
withImportedEntity.getParentCategory()
)) {
categoryManager.removeSubCategoryFromCategory(
existingEntity,
existingEntity.getParentCategory()
);
categoryManager.addSubCategoryToCategory(
withImportedEntity.getParentCategory(),
existingEntity
);
}
if (!Objects.equals(
existingEntity.getSection(),
withImportedEntity.getSection()
)) {
existingEntity.setSection(withImportedEntity.getSection());
}
if (!Objects.equals( if (!Objects.equals(
existingEntity.getTitle(), existingEntity.getTitle(),
withImportedEntity.getTitle() withImportedEntity.getTitle()

View File

@ -67,11 +67,14 @@ public class Article extends ContentItem implements Serializable {
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "values", name = "values",
joinTable = @JoinTable(name = "ARTICLE_TEXTS", joinTable = @JoinTable(
schema = DB_SCHEMA, name = "ARTICLE_TEXTS",
joinColumns = { schema = DB_SCHEMA,
@JoinColumn(name = "OBJECT_ID")} joinColumns = {
)) @JoinColumn(name = "OBJECT_ID")
}
)
)
private LocalizedString text; private LocalizedString text;
public Article() { public Article() {

View File

@ -18,7 +18,6 @@
*/ */
package org.librecms.contenttypes; package org.librecms.contenttypes;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.Objects; import java.util.Objects;
@ -71,11 +70,14 @@ public class Event extends ContentItem implements Serializable {
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "values", name = "values",
joinTable = @JoinTable(name = "EVENT_TEXTS", joinTable = @JoinTable(
schema = DB_SCHEMA, name = "EVENT_TEXTS",
joinColumns = { schema = DB_SCHEMA,
@JoinColumn(name = "OBJECT_ID")} joinColumns = {
)) @JoinColumn(name = "OBJECT_ID")
}
)
)
private LocalizedString text; private LocalizedString text;
@Column(name = "START_DATE") @Column(name = "START_DATE")
@ -92,11 +94,14 @@ public class Event extends ContentItem implements Serializable {
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "values", name = "values",
joinTable = @JoinTable(name = "EVENT_DATES", joinTable = @JoinTable(
schema = DB_SCHEMA, name = "EVENT_DATES",
joinColumns = { schema = DB_SCHEMA,
@JoinColumn(name = "OBJECT_ID")} joinColumns = {
)) @JoinColumn(name = "OBJECT_ID")
}
)
)
private LocalizedString eventDate; private LocalizedString eventDate;
/** /**
@ -105,11 +110,14 @@ public class Event extends ContentItem implements Serializable {
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "values", name = "values",
joinTable = @JoinTable(name = "EVENT_LOCATIONS", joinTable = @JoinTable(
schema = DB_SCHEMA, name = "EVENT_LOCATIONS",
joinColumns = { schema = DB_SCHEMA,
@JoinColumn(name = "OBJECT_ID")} joinColumns = {
)) @JoinColumn(name = "OBJECT_ID")
}
)
)
private LocalizedString location; private LocalizedString location;
/** /**
@ -118,21 +126,27 @@ public class Event extends ContentItem implements Serializable {
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "values", name = "values",
joinTable = @JoinTable(name = "EVENT_MAIN_CONTRIBUTORS", joinTable = @JoinTable(
schema = DB_SCHEMA, name = "EVENT_MAIN_CONTRIBUTORS",
joinColumns = { schema = DB_SCHEMA,
@JoinColumn(name = "OBJECT_ID")} joinColumns = {
)) @JoinColumn(name = "OBJECT_ID")
}
)
)
private LocalizedString mainContributor; private LocalizedString mainContributor;
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "values", name = "values",
joinTable = @JoinTable(name = "EVENT_TYPES", joinTable = @JoinTable(
schema = DB_SCHEMA, name = "EVENT_TYPES",
joinColumns = { schema = DB_SCHEMA,
@JoinColumn(name = "OBJECT_ID")} joinColumns = {
)) @JoinColumn(name = "OBJECT_ID")
}
)
)
private LocalizedString eventType; private LocalizedString eventType;
//ToDo: check if this is necessary or can be better handled using related links. //ToDo: check if this is necessary or can be better handled using related links.
@ -145,11 +159,14 @@ public class Event extends ContentItem implements Serializable {
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "values", name = "values",
joinTable = @JoinTable(name = "EVENT_COSTS", joinTable = @JoinTable(
schema = DB_SCHEMA, name = "EVENT_COSTS",
joinColumns = { schema = DB_SCHEMA,
@JoinColumn(name = "OBJECT_ID")} joinColumns = {
)) @JoinColumn(name = "OBJECT_ID")
}
)
)
private LocalizedString cost; private LocalizedString cost;
public Event() { public Event() {

View File

@ -49,7 +49,7 @@ public class MultiPartArticleImExporter
@Inject @Inject
private MultiPartArticleSectionManager sectionManager; private MultiPartArticleSectionManager sectionManager;
@Inject @Inject
private MultiPartArticleSectionRepository sectionRepo; private MultiPartArticleSectionRepository sectionRepo;
@ -81,17 +81,20 @@ public class MultiPartArticleImExporter
existingContentItem.getSummary() existingContentItem.getSummary()
); );
} }
final List<MultiPartArticleSection> missingSections = importedContentItem final List<MultiPartArticleSection> missingSections
.getSections() = importedContentItem
.stream() .getSections()
.filter( .stream()
section -> existingContentItem.getSections().contains(section) .filter(
) section -> existingContentItem.getSections().contains(
.collect(Collectors.toList()); section)
)
for(final MultiPartArticleSection missingSection : missingSections) { .collect(Collectors.toList());
final MultiPartArticleSection newSection = new MultiPartArticleSection();
for (final MultiPartArticleSection missingSection : missingSections) {
final MultiPartArticleSection newSection
= new MultiPartArticleSection();
newSection.setPageBreak(missingSection.isPageBreak()); newSection.setPageBreak(missingSection.isPageBreak());
newSection.setRank(missingSection.getRank()); newSection.setRank(missingSection.getRank());
syncLocalizedStrings( syncLocalizedStrings(
@ -99,13 +102,13 @@ public class MultiPartArticleImExporter
newSection.getText() newSection.getText()
); );
syncLocalizedStrings( syncLocalizedStrings(
missingSection.getTitle(), missingSection.getTitle(),
newSection.getTitle() newSection.getTitle()
); );
sectionManager.addSectionToMultiPartArticle( sectionManager.addSectionToMultiPartArticle(
newSection, newSection,
existingContentItem existingContentItem
); );
} }
} }

View File

@ -102,13 +102,6 @@ public class LifecycleDefinitionImExporter
); );
} }
for (final PhaseDefinition phaseDef : importedEntity
.getPhaseDefinitions()) {
if (!existingEntity.getPhaseDefinitions().contains(phaseDef)) {
existingEntity.addPhaseDefinition(phaseDef);
}
}
lifecycleDefRepo.save(existingEntity); lifecycleDefRepo.save(existingEntity);
} }

View File

@ -121,6 +121,7 @@ public class PhaseDefinition implements Exportable, Serializable {
this.definitionId = definitionId; this.definitionId = definitionId;
} }
@Override
public String getUuid() { public String getUuid() {
return uuid; return uuid;
} }

View File

@ -96,6 +96,15 @@ public class PhaseDefinitionImExporter
); );
} }
if (!Objects.equals(
existingEntity.getDefaultListener(),
importedEntity.getDefaultListener()
)) {
existingEntity.setDefaultListener(
importedEntity.getDefaultListener()
);
}
phaseDefinitionRepo.save(existingEntity); phaseDefinitionRepo.save(existingEntity);
} }

View File

@ -86,29 +86,15 @@ public class PhaseImExporter
)) { )) {
existingEntity.setListener(importedEntity.getListener()); existingEntity.setListener(importedEntity.getListener());
} }
if (existingEntity.isStarted() != importedEntity.isStarted()) { if (existingEntity.isStarted() != importedEntity.isStarted()) {
existingEntity.setStarted(importedEntity.isStarted()); existingEntity.setStarted(importedEntity.isStarted());
} }
if (existingEntity.isFinished() != importedEntity.isFinished()) { if (existingEntity.isFinished() != importedEntity.isFinished()) {
existingEntity.setFinished(importedEntity.isFinished()); existingEntity.setFinished(importedEntity.isFinished());
} }
if (!Objects.equals(
existingEntity.getLifecycle(),
importedEntity.getLifecycle()
)) {
existingEntity.setLifecycle(importedEntity.getLifecycle());
}
if (!Objects.equals(
existingEntity.getDefinition(),
importedEntity.getDefinition()
)) {
existingEntity.setDefinition(importedEntity.getDefinition());
}
phaseRepo.save(existingEntity); phaseRepo.save(existingEntity);
} }

View File

@ -76,21 +76,6 @@ public class CategorizationImExporter
protected void updateExistingEntity( protected void updateExistingEntity(
final Categorization existingEntity, final Categorization importedEntity final Categorization existingEntity, final Categorization importedEntity
) { ) {
if (!Objects.equals(
existingEntity.getCategory(), importedEntity.getCategory()
)) {
existingEntity.setCategory(importedEntity.getCategory());
}
if (!Objects.equals(
existingEntity.getCategorizedObject(),
importedEntity.getCategorizedObject()
)) {
existingEntity.setCategorizedObject(
importedEntity.getCategorizedObject()
);
}
if (existingEntity.isIndexObject() != importedEntity.isIndexObject()) { if (existingEntity.isIndexObject() != importedEntity.isIndexObject()) {
existingEntity.setIndexObject(importedEntity.isIndexObject()); existingEntity.setIndexObject(importedEntity.isIndexObject());
} }

View File

@ -92,7 +92,7 @@ public class CategoryImExporter extends AbstractEntityImExporter<Category> {
importedEntity.getDescription() importedEntity.getDescription()
)) { )) {
syncLocalizedStrings( syncLocalizedStrings(
importedEntity.getDescription(), importedEntity.getDescription(),
existingEntity.getDescription() existingEntity.getDescription()
); );
} }
@ -115,51 +115,12 @@ public class CategoryImExporter extends AbstractEntityImExporter<Category> {
existingEntity.setName(importedEntity.getName()); existingEntity.setName(importedEntity.getName());
} }
if (!Objects.equals(
existingEntity.getParentCategory(),
importedEntity.getParentCategory()
)) {
final Category oldParentCategory = existingEntity
.getParentCategory();
final Category newParentCategory = importedEntity
.getParentCategory();
categoryManager.removeSubCategoryFromCategory(
existingEntity,
oldParentCategory
);
categoryManager.addSubCategoryToCategory(
existingEntity,
newParentCategory
);
}
if (!Objects.equals(
existingEntity.getSubCategories(),
importedEntity.getSubCategories()
)) {
final Set<Category> subCategoriesToAdd = importedEntity
.getSubCategories()
.stream()
.filter(
category -> !existingEntity.getSubCategories().contains(
category
)
)
.collect(Collectors.toSet());
for(final Category category : subCategoriesToAdd) {
existingEntity.addSubCategory(category);
}
}
if (!Objects.equals( if (!Objects.equals(
existingEntity.getTitle(), existingEntity.getTitle(),
importedEntity.getTitle() importedEntity.getTitle()
)) { )) {
syncLocalizedStrings( syncLocalizedStrings(
importedEntity.getTitle(), importedEntity.getTitle(),
existingEntity.getTitle() existingEntity.getTitle()
); );
} }

View File

@ -71,6 +71,13 @@ public class DomainImExporter extends AbstractEntityImExporter<Domain> {
final Domain existingEntity, final Domain existingEntity,
final Domain importedEntity final Domain importedEntity
) { ) {
if (!Objects.equals(
existingEntity.getDisplayName(),
importedEntity.getDisplayName()
)) {
importedEntity.setDisplayName(importedEntity.getDisplayName());
}
if (!Objects.equals( if (!Objects.equals(
existingEntity.getDomainKey(), existingEntity.getDomainKey(),
importedEntity.getDomainKey() importedEntity.getDomainKey()
@ -116,24 +123,6 @@ public class DomainImExporter extends AbstractEntityImExporter<Domain> {
existingEntity.setReleased(importedEntity.getReleased()); existingEntity.setReleased(importedEntity.getReleased());
} }
if (!Objects.equals(
existingEntity.getOwners(),
importedEntity.getOwners()
)) {
final Set<DomainOwnership> ownersToAdd = importedEntity
.getOwners()
.stream()
.filter(owner -> !existingEntity.getOwners().contains(owner))
.collect(Collectors.toSet());
for (final DomainOwnership toAdd : ownersToAdd) {
domainManager.addDomainOwner(toAdd.getOwner(),
existingEntity,
toAdd.getContext()
);
}
}
domainRepository.save(existingEntity); domainRepository.save(existingEntity);
} }

View File

@ -45,10 +45,10 @@ public class DomainOwnershipImExporter
@Inject @Inject
private DomainManager domainManager; private DomainManager domainManager;
@Inject @Inject
private DomainOwnershipRepository domainOwnershipRepo; private DomainOwnershipRepository domainOwnershipRepo;
@Inject @Inject
private EntityManager entityManager; private EntityManager entityManager;
@ -72,35 +72,34 @@ public class DomainOwnershipImExporter
protected Optional<DomainOwnership> findExistingEntity(final String uuid) { protected Optional<DomainOwnership> findExistingEntity(final String uuid) {
return domainOwnershipRepo.findByUuid(uuid); return domainOwnershipRepo.findByUuid(uuid);
} }
@Override @Override
protected void updateExistingEntity( protected void updateExistingEntity(
final DomainOwnership existingEntity, final DomainOwnership existingEntity,
final DomainOwnership importedEnity final DomainOwnership importedEnity
) { ) {
if (!Objects.equals( if (!Objects.equals(
existingEntity.getContext(), existingEntity.getContext(),
importedEnity.getContext() importedEnity.getContext()
)) { )) {
existingEntity.setContext(importedEnity.getContext()); existingEntity.setContext(importedEnity.getContext());
} }
if (existingEntity.getOwnerOrder() != importedEnity.getOwnerOrder()) { if (existingEntity.getOwnerOrder() != importedEnity.getOwnerOrder()) {
existingEntity.setOwnerOrder(importedEnity.getOwnerOrder()); existingEntity.setOwnerOrder(importedEnity.getOwnerOrder());
} }
if (existingEntity.getDomainOrder() != importedEnity.getDomainOrder()) { if (existingEntity.getDomainOrder() != importedEnity.getDomainOrder()) {
existingEntity.setDomainOrder(importedEnity.getDomainOrder()); existingEntity.setDomainOrder(importedEnity.getDomainOrder());
} }
domainOwnershipRepo.save(existingEntity); domainOwnershipRepo.save(existingEntity);
} }
@Override @Override
protected void saveImportedEntity(final DomainOwnership entity) { protected void saveImportedEntity(final DomainOwnership entity) {
domainOwnershipRepo.save(entity); domainOwnershipRepo.save(entity);
} }
@Override @Override
protected DomainOwnership reloadEntity(final DomainOwnership entity) { protected DomainOwnership reloadEntity(final DomainOwnership entity) {

View File

@ -83,47 +83,7 @@ public class GroupMembershipImExporter
final GroupMembership existingEntity, final GroupMembership existingEntity,
final GroupMembership importedEntity final GroupMembership importedEntity
) { ) {
if (!Objects.equals( // Nothing to update in a GroupMembership
existingEntity.getGroup(),
importedEntity.getGroup()
) && !Objects.equals(
existingEntity.getMember(),
importedEntity.getMember()
)) {
final Group oldGroup = existingEntity.getGroup();
final User oldMember = existingEntity.getMember();
final Group newGroup = importedEntity.getGroup();
final User newMember = importedEntity.getMember();
groupManager.removeMemberFromGroup(oldMember, oldGroup);
groupManager.addMemberToGroup(newMember, newGroup);
}
if (!Objects.equals(
existingEntity.getGroup(),
importedEntity.getGroup()
)) {
final Group oldGroup = existingEntity.getGroup();
final Group newGroup = importedEntity.getGroup();
final User member = existingEntity.getMember();
groupManager.removeMemberFromGroup(member, oldGroup);
groupManager.addMemberToGroup(member, newGroup);
}
if (!Objects.equals(
existingEntity.getMember(),
importedEntity.getMember()
)) {
final User oldMember = existingEntity.getMember();
final User newMember = importedEntity.getMember();
final Group group = existingEntity.getGroup();
groupManager.removeMemberFromGroup(oldMember, group);
groupManager.addMemberToGroup(newMember, group);
}
groupMembershipRepo.save(existingEntity);
} }
@Override @Override

View File

@ -100,18 +100,11 @@ public class PermissionImExporter extends AbstractEntityImExporter<Permission> {
)) { )) {
existingEntity.setCreationIp(importedEntity.getCreationIp()); existingEntity.setCreationIp(importedEntity.getCreationIp());
} }
if (existingEntity.isInherited() != importedEntity.isInherited()) { if (existingEntity.isInherited() != importedEntity.isInherited()) {
existingEntity.setInherited(importedEntity.isInherited()); existingEntity.setInherited(importedEntity.isInherited());
} }
if (!Objects.equals(
existingEntity.getInheritedFrom(),
importedEntity.getInheritedFrom()
)) {
existingEntity.setInheritedFrom(importedEntity.getInheritedFrom());
}
permissionRepository.save(existingEntity); permissionRepository.save(existingEntity);
} }

View File

@ -82,20 +82,7 @@ public class RoleMembershipImExporter
final RoleMembership existingEntity, final RoleMembership existingEntity,
final RoleMembership importedEntity final RoleMembership importedEntity
) { ) {
if (!Objects.equals( // Nothing to update in a RoleMembership
existingEntity.getRole(),
importedEntity.getRole()
)) {
existingEntity.setRole(importedEntity.getRole());
}
if (!Objects.equals(
existingEntity.getMember(),
importedEntity.getMember()
)) {
existingEntity.setMember(importedEntity.getMember());
}
membershipRepo.save(existingEntity);
} }
@Override @Override

View File

@ -43,10 +43,10 @@ public class AssignableTaskImExporter
@Inject @Inject
private AssignableTaskRepository assignableTaskRepository; private AssignableTaskRepository assignableTaskRepository;
@Inject @Inject
private TaskManager taskManager; private TaskManager taskManager;
@Inject @Inject
private AssignableTaskManager assignableTaskManager; private AssignableTaskManager assignableTaskManager;
@ -65,7 +65,7 @@ public class AssignableTaskImExporter
public Class<AssignableTask> getEntityClass() { public Class<AssignableTask> getEntityClass() {
return AssignableTask.class; return AssignableTask.class;
} }
@Override @Override
protected Optional<AssignableTask> findExistingEntity(final String uuid) { protected Optional<AssignableTask> findExistingEntity(final String uuid) {
return assignableTaskRepository.findByUuid(uuid); return assignableTaskRepository.findByUuid(uuid);
@ -75,50 +75,81 @@ public class AssignableTaskImExporter
protected void saveImportedEntity(final AssignableTask entity) { protected void saveImportedEntity(final AssignableTask entity) {
assignableTaskRepository.save(entity); assignableTaskRepository.save(entity);
} }
@Override @Override
protected void updateExistingEntity( protected void updateExistingEntity(
final AssignableTask existingEntity, final AssignableTask existingEntity,
final AssignableTask importedEntity final AssignableTask importedEntity
) { ) {
if(!Objects.equals( if (!Objects.equals(
existingEntity.getLabel(), existingEntity.getLabel(),
importedEntity.getLabel() importedEntity.getLabel()
)) { )) {
syncLocalizedStrings( syncLocalizedStrings(
importedEntity.getLabel(), importedEntity.getLabel(),
existingEntity.getLabel() existingEntity.getLabel()
); );
} }
if(!Objects.equals( if (!Objects.equals(
existingEntity.getDescription(), existingEntity.getDescription(),
importedEntity.getDescription() importedEntity.getDescription()
)) { )) {
syncLocalizedStrings( syncLocalizedStrings(
importedEntity.getDescription(), importedEntity.getDescription(),
existingEntity.getDescription() existingEntity.getDescription()
); );
} }
if (existingEntity.isActive() != importedEntity.isActive()) { if (existingEntity.isActive() != importedEntity.isActive()) {
existingEntity.setActive(importedEntity.isActive()); existingEntity.setActive(importedEntity.isActive());
} }
if (existingEntity.getTaskState() != importedEntity.getTaskState()) {
existingEntity.setTaskState(importedEntity.getTaskState());
}
if (existingEntity.isLocked() != importedEntity.isLocked()) {
existingEntity.setLocked(importedEntity.isLocked());
}
if (!Objects.equals( if (!Objects.equals(
existingEntity.getWorkflow(), existingEntity.getLockingUser(),
importedEntity.getWorkflow() importedEntity.getLockingUser()
)) { )) {
taskManager.removeTask( existingEntity.setLockingUser(importedEntity.getLockingUser());
existingEntity.getWorkflow(), }
existingEntity
); if (!Objects.equals(
taskManager.addTask( existingEntity.getStartDate(),
importedEntity.getWorkflow(), importedEntity.getStartDate()
existingEntity )) {
existingEntity.setStartDate(importedEntity.getStartDate());
}
if (!Objects.equals(
existingEntity.getDueDate(),
importedEntity.getDueDate()
)) {
existingEntity.setDueDate(importedEntity.getDueDate());
}
if (existingEntity.getDurationMinutes() != importedEntity
.getDurationMinutes()) {
existingEntity.setDurationMinutes(
importedEntity.getDurationMinutes()
); );
} }
if (!Objects.equals(
existingEntity.getNotificationSender(),
importedEntity.getNotificationSender()
)) {
existingEntity.setNotificationSender(
importedEntity.getNotificationSender()
);
}
assignableTaskRepository.save(existingEntity); assignableTaskRepository.save(existingEntity);
} }

View File

@ -30,7 +30,6 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Inject; import javax.inject.Inject;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.NoResultException; import javax.persistence.NoResultException;
import javax.transaction.Transactional;
/** /**
* Exporter/Importer for {@link TaskDependency} entities. * Exporter/Importer for {@link TaskDependency} entities.

View File

@ -23,8 +23,6 @@ import org.libreccm.imexport.Processes;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
@ -78,13 +76,6 @@ public class WorkflowImExporter extends AbstractEntityImExporter<Workflow> {
); );
} }
if (!Objects.equals(
existingEntity.getTemplate(),
importedEntity.getTemplate()
)) {
existingEntity.setTemplate(importedEntity.getTemplate());
}
if (!Objects.equals( if (!Objects.equals(
existingEntity.getName(), existingEntity.getName(),
importedEntity.getName() importedEntity.getName()
@ -117,30 +108,7 @@ public class WorkflowImExporter extends AbstractEntityImExporter<Workflow> {
existingEntity.setTasksState(importedEntity.getTasksState()); existingEntity.setTasksState(importedEntity.getTasksState());
} }
if (!Objects.equals(
existingEntity.getObject(),
importedEntity.getObject()
)) {
existingEntity.setObject(importedEntity.getObject());
}
workflowRepository.save(importedEntity); workflowRepository.save(importedEntity);
if (!Objects.equals(
existingEntity.getTasks(),
importedEntity.getTasks()
)) {
final Set<Task> tasksToAdd = importedEntity
.getTasks()
.stream()
.filter(task -> !existingEntity.getTasks().contains(task))
.collect(Collectors.toSet());
for (final Task task : tasksToAdd) {
taskManager.addTask(existingEntity, task);
}
}
} }
@Override @Override

View File

@ -28,7 +28,6 @@ import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.inject.Inject; import javax.inject.Inject;
import javax.transaction.Transactional;
/** /**
* Im/Exporter for importing and exporting {@code File}s from the system into a * Im/Exporter for importing and exporting {@code File}s from the system into a
@ -83,32 +82,32 @@ public class FileImExporter extends AbstractEntityImExporter<File> {
)) { )) {
existingEntity.setDescription(importedEntity.getDescription()); existingEntity.setDescription(importedEntity.getDescription());
} }
if(!Objects.equals( if (!Objects.equals(
existingEntity.getPath(), existingEntity.getPath(),
importedEntity.getPath() importedEntity.getPath()
)) { )) {
existingEntity.setPath(importedEntity.getPath()); existingEntity.setPath(importedEntity.getPath());
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getMimeType(), existingEntity.getMimeType(),
importedEntity.getMimeType() importedEntity.getMimeType()
)) { )) {
existingEntity.setMimeType(importedEntity.getMimeType()); existingEntity.setMimeType(importedEntity.getMimeType());
} }
if (existingEntity.getSize() != importedEntity.getSize()) { if (existingEntity.getSize() != importedEntity.getSize()) {
existingEntity.setSize(importedEntity.getSize()); existingEntity.setSize(importedEntity.getSize());
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getCreationDate(), existingEntity.getCreationDate(),
importedEntity.getCreationDate() importedEntity.getCreationDate()
)) { )) {
existingEntity.setCreationDate(importedEntity.getCreationDate()); existingEntity.setCreationDate(importedEntity.getCreationDate());
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getLastModifiedDate(), existingEntity.getLastModifiedDate(),
importedEntity.getLastModifiedDate() importedEntity.getLastModifiedDate()
@ -117,14 +116,14 @@ public class FileImExporter extends AbstractEntityImExporter<File> {
importedEntity.getLastModifiedDate() importedEntity.getLastModifiedDate()
); );
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getCreationIp(), existingEntity.getCreationIp(),
importedEntity.getCreationIp() importedEntity.getCreationIp()
)) { )) {
existingEntity.setCreationIp(importedEntity.getCreationIp()); existingEntity.setCreationIp(importedEntity.getCreationIp());
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getLastModifiedIp(), existingEntity.getLastModifiedIp(),
importedEntity.getLastModifiedIp() importedEntity.getLastModifiedIp()
@ -133,14 +132,14 @@ public class FileImExporter extends AbstractEntityImExporter<File> {
importedEntity.getLastModifiedIp() importedEntity.getLastModifiedIp()
); );
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getCreationUser(), existingEntity.getCreationUser(),
importedEntity.getCreationUser() importedEntity.getCreationUser()
)) { )) {
existingEntity.setCreationUser(importedEntity.getCreationUser()); existingEntity.setCreationUser(importedEntity.getCreationUser());
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getLastModifiedUser(), existingEntity.getLastModifiedUser(),
importedEntity.getLastModifiedUser() importedEntity.getLastModifiedUser()
@ -149,28 +148,14 @@ public class FileImExporter extends AbstractEntityImExporter<File> {
importedEntity.getLastModifiedUser() importedEntity.getLastModifiedUser()
); );
} }
if (!Objects.equals(
existingEntity.getParent(),
importedEntity.getParent()
)) {
existingEntity.setParent(importedEntity.getParent());
}
if (!Objects.equals(
existingEntity.getRepository(),
importedEntity.getRepository()
)) {
existingEntity.setRepository(importedEntity.getRepository());
}
if (!Objects.equals( if (!Objects.equals(
existingEntity.getContent(), existingEntity.getContent(),
importedEntity.getContent() importedEntity.getContent()
)) { )) {
existingEntity.setContent(importedEntity.getContent()); existingEntity.setContent(importedEntity.getContent());
} }
fileRepository.save(existingEntity); fileRepository.save(existingEntity);
} }

View File

@ -51,7 +51,7 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
public Class<Folder> getEntityClass() { public Class<Folder> getEntityClass() {
return Folder.class; return Folder.class;
} }
@Override @Override
protected Optional<Folder> findExistingEntity(final String uuid) { protected Optional<Folder> findExistingEntity(final String uuid) {
return folderRepository.findByUuid(uuid); return folderRepository.findByUuid(uuid);
@ -61,13 +61,13 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
protected void saveImportedEntity(final Folder entity) { protected void saveImportedEntity(final Folder entity) {
folderRepository.save(entity); folderRepository.save(entity);
} }
@Override @Override
protected void updateExistingEntity( protected void updateExistingEntity(
final Folder existingEntity, final Folder existingEntity,
final Folder importedEntity final Folder importedEntity
) { ) {
if (!Objects.equals( if (!Objects.equals(
existingEntity.getName(), existingEntity.getName(),
importedEntity.getName() importedEntity.getName()
)) { )) {
@ -80,32 +80,32 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
)) { )) {
existingEntity.setDescription(importedEntity.getDescription()); existingEntity.setDescription(importedEntity.getDescription());
} }
if(!Objects.equals( if (!Objects.equals(
existingEntity.getPath(), existingEntity.getPath(),
importedEntity.getPath() importedEntity.getPath()
)) { )) {
existingEntity.setPath(importedEntity.getPath()); existingEntity.setPath(importedEntity.getPath());
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getMimeType(), existingEntity.getMimeType(),
importedEntity.getMimeType() importedEntity.getMimeType()
)) { )) {
existingEntity.setMimeType(importedEntity.getMimeType()); existingEntity.setMimeType(importedEntity.getMimeType());
} }
if (existingEntity.getSize() != importedEntity.getSize()) { if (existingEntity.getSize() != importedEntity.getSize()) {
existingEntity.setSize(importedEntity.getSize()); existingEntity.setSize(importedEntity.getSize());
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getCreationDate(), existingEntity.getCreationDate(),
importedEntity.getCreationDate() importedEntity.getCreationDate()
)) { )) {
existingEntity.setCreationDate(importedEntity.getCreationDate()); existingEntity.setCreationDate(importedEntity.getCreationDate());
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getLastModifiedDate(), existingEntity.getLastModifiedDate(),
importedEntity.getLastModifiedDate() importedEntity.getLastModifiedDate()
@ -114,14 +114,14 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
importedEntity.getLastModifiedDate() importedEntity.getLastModifiedDate()
); );
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getCreationIp(), existingEntity.getCreationIp(),
importedEntity.getCreationIp() importedEntity.getCreationIp()
)) { )) {
existingEntity.setCreationIp(importedEntity.getCreationIp()); existingEntity.setCreationIp(importedEntity.getCreationIp());
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getLastModifiedIp(), existingEntity.getLastModifiedIp(),
importedEntity.getLastModifiedIp() importedEntity.getLastModifiedIp()
@ -130,14 +130,14 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
importedEntity.getLastModifiedIp() importedEntity.getLastModifiedIp()
); );
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getCreationUser(), existingEntity.getCreationUser(),
importedEntity.getCreationUser() importedEntity.getCreationUser()
)) { )) {
existingEntity.setCreationUser(importedEntity.getCreationUser()); existingEntity.setCreationUser(importedEntity.getCreationUser());
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getLastModifiedUser(), existingEntity.getLastModifiedUser(),
importedEntity.getLastModifiedUser() importedEntity.getLastModifiedUser()
@ -146,30 +146,7 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
importedEntity.getLastModifiedUser() importedEntity.getLastModifiedUser()
); );
} }
if (!Objects.equals(
existingEntity.getParent(),
importedEntity.getParent()
)) {
existingEntity.setParent(importedEntity.getParent());
}
if (!Objects.equals(
existingEntity.getRepository(),
importedEntity.getRepository()
)) {
existingEntity.setRepository(importedEntity.getRepository());
}
if (!Objects.equals(
existingEntity.getRootAssignedRepository(),
importedEntity.getRootAssignedRepository()
)) {
existingEntity.setRootAssignedRepository(
importedEntity.getRootAssignedRepository()
);
}
folderRepository.save(importedEntity); folderRepository.save(importedEntity);
} }

View File

@ -49,7 +49,7 @@ public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
public Class<Repository> getEntityClass() { public Class<Repository> getEntityClass() {
return Repository.class; return Repository.class;
} }
@Override @Override
protected Optional<Repository> findExistingEntity(final String uuid) { protected Optional<Repository> findExistingEntity(final String uuid) {
return repositoryRepository.findByUuid(uuid); return repositoryRepository.findByUuid(uuid);
@ -59,7 +59,7 @@ public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
protected void saveImportedEntity(final Repository portableObject) { protected void saveImportedEntity(final Repository portableObject) {
repositoryRepository.save(portableObject); repositoryRepository.save(portableObject);
} }
@Override @Override
protected void updateExistingEntity( protected void updateExistingEntity(
final Repository existingEntity, final Repository existingEntity,
@ -71,27 +71,27 @@ public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
)) { )) {
existingEntity.setDisplayName(importedEntity.getDisplayName()); existingEntity.setDisplayName(importedEntity.getDisplayName());
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getTitle(), existingEntity.getTitle(),
importedEntity.getTitle() importedEntity.getTitle()
)) { )) {
syncLocalizedStrings( syncLocalizedStrings(
importedEntity.getTitle(), importedEntity.getTitle(),
existingEntity.getTitle() existingEntity.getTitle()
); );
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getDescription(), existingEntity.getDescription(),
importedEntity.getDescription() importedEntity.getDescription()
)) { )) {
syncLocalizedStrings( syncLocalizedStrings(
importedEntity.getDescription(), importedEntity.getDescription(),
existingEntity.getDescription() existingEntity.getDescription()
); );
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getApplicationType(), existingEntity.getApplicationType(),
importedEntity.getApplicationType() importedEntity.getApplicationType()
@ -100,7 +100,7 @@ public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
importedEntity.getApplicationType() importedEntity.getApplicationType()
); );
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getPrimaryUrl(), existingEntity.getPrimaryUrl(),
importedEntity.getPrimaryUrl() importedEntity.getPrimaryUrl()
@ -109,28 +109,21 @@ public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
importedEntity.getPrimaryUrl() importedEntity.getPrimaryUrl()
); );
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getName(), existingEntity.getName(),
importedEntity.getName() importedEntity.getName()
)) { )) {
existingEntity.setName(importedEntity.getName()); existingEntity.setName(importedEntity.getName());
} }
if (!Objects.equals(
existingEntity.getRootFolder(),
importedEntity.getRootFolder()
)) {
existingEntity.setRootFolder(importedEntity.getRootFolder());
}
if (!Objects.equals( if (!Objects.equals(
existingEntity.getOwner(), existingEntity.getOwner(),
importedEntity.getOwner() importedEntity.getOwner()
)) { )) {
existingEntity.setOwner(importedEntity.getOwner()); existingEntity.setOwner(importedEntity.getOwner());
} }
repositoryRepository.save(existingEntity); repositoryRepository.save(existingEntity);
} }