Cleanup and fixed some potential problems.
parent
55b2f6c6ba
commit
ca87bcb6af
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@librecms/ccm-cms",
|
||||
"version": "7.0.0-SNAPSHOT.2023-01-18T182914",
|
||||
"version": "7.0.0-SNAPSHOT.2023-01-19T185030",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"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",
|
||||
"dependencies": {
|
||||
"@tiptap/core": "^2.0.0-beta.127",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"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",
|
||||
"main": "target/generated-resources/assets/@content-sections/cms-admin.js",
|
||||
"types": "target/generated-resources/assets/@content-sections/cms-admin.d.ts",
|
||||
|
|
|
|||
|
|
@ -69,6 +69,13 @@ public abstract class AbstractAssetImExporter<T extends Asset>
|
|||
protected final void updateExistingEntity(
|
||||
final T existingEntity, final T importedEntity
|
||||
) {
|
||||
if (!Objects.equals(
|
||||
existingEntity.getDisplayName(),
|
||||
importedEntity.getDisplayName()
|
||||
)) {
|
||||
existingEntity.setDisplayName(importedEntity.getDisplayName());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getTitle(),
|
||||
importedEntity.getTitle()
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.librecms.assets;
|
||||
|
||||
|
||||
import org.librecms.contentsection.Asset;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -67,11 +66,12 @@ public class Bookmark extends Asset implements Serializable {
|
|||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
joinTable = @JoinTable(name = "BOOKMARK_DESCRIPTIONS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "ASSET_ID")
|
||||
}
|
||||
joinTable = @JoinTable(
|
||||
name = "BOOKMARK_DESCRIPTIONS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "ASSET_ID")
|
||||
}
|
||||
)
|
||||
)
|
||||
private LocalizedString description;
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ import javax.persistence.Table;
|
|||
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.
|
||||
*
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
|
|
@ -96,12 +96,10 @@ public class ContactableEntity extends Asset {
|
|||
}
|
||||
|
||||
protected void addContactEntry(final ContactEntry contactEntry) {
|
||||
|
||||
contactEntries.add(contactEntry);
|
||||
}
|
||||
|
||||
protected void removeContactEntry(final ContactEntry contactEntry) {
|
||||
|
||||
contactEntries.remove(contactEntry);
|
||||
}
|
||||
|
||||
|
|
@ -127,7 +125,6 @@ public class ContactableEntity extends Asset {
|
|||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -158,13 +155,15 @@ public class ContactableEntity extends Asset {
|
|||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
|
||||
return super.toString(String.format(
|
||||
"contactEntries = { %s }, "
|
||||
+ "postalAddress = %s%s",
|
||||
Objects.toString(contactEntries),
|
||||
Objects.toString(postalAddress),
|
||||
data));
|
||||
return super.toString(
|
||||
String.format(
|
||||
"contactEntries = { %s }, "
|
||||
+ "postalAddress = %s%s",
|
||||
Objects.toString(contactEntries),
|
||||
Objects.toString(postalAddress),
|
||||
data
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,31 +87,6 @@ public class Person extends ContactableEntity {
|
|||
)
|
||||
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.
|
||||
*/
|
||||
|
|
@ -125,37 +100,6 @@ public class Person extends ContactableEntity {
|
|||
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() {
|
||||
|
||||
return Collections.unmodifiableList(personNames);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.librecms.assets;
|
||||
|
||||
|
||||
import org.librecms.contentsection.Asset;
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.libreccm.l10n.LocalizedString;
|
||||
|
|
@ -64,11 +63,12 @@ public class SideNote extends Asset implements Serializable {
|
|||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
joinTable = @JoinTable(name = "SIDE_NOTE_TEXTS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "SIDE_NOTE_ID")
|
||||
}
|
||||
joinTable = @JoinTable(
|
||||
name = "SIDE_NOTE_TEXTS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "SIDE_NOTE_ID")
|
||||
}
|
||||
)
|
||||
)
|
||||
private LocalizedString text;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,14 @@ public class VideoAssetImExporter
|
|||
final VideoAsset existingAsset,
|
||||
final VideoAsset importedAsset
|
||||
) {
|
||||
if (existingAsset.getWidth() != importedAsset.getWidth()) {
|
||||
existingAsset.setWidth(importedAsset.getWidth());
|
||||
}
|
||||
|
||||
if (existingAsset.getHeight() != importedAsset.getHeight()) {
|
||||
existingAsset.setHeight(importedAsset.getHeight());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingAsset.getLegalMetadata(),
|
||||
importedAsset.getLegalMetadata()
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public abstract class AbstractContentItemImExporter<T extends ContentItem>
|
|||
|
||||
@Inject
|
||||
private AttachmentListImExporter attachmentListImExporter;
|
||||
|
||||
|
||||
@Inject
|
||||
private ContentItemRepository itemRepository;
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ public abstract class AbstractContentItemImExporter<T extends ContentItem>
|
|||
|
||||
//AttachmentList import requiresw all content items to be imported
|
||||
attachmentListImExporter.addRequiredEntities(Set.of(getEntityClass()));
|
||||
|
||||
|
||||
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(
|
||||
existingEntity.getTitle(),
|
||||
importedEntity.getTitle()
|
||||
|
|
@ -203,7 +196,7 @@ public abstract class AbstractContentItemImExporter<T extends ContentItem>
|
|||
importedEntity.getCreationUserName()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getLastModifyingUserName(),
|
||||
importedEntity.getLastModifyingUserName()
|
||||
|
|
@ -214,7 +207,7 @@ public abstract class AbstractContentItemImExporter<T extends ContentItem>
|
|||
}
|
||||
|
||||
updateExistingContentItem(existingEntity, importedEntity);
|
||||
|
||||
|
||||
itemRepository.save(existingEntity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -650,7 +650,8 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
|
|||
name = "CONTENT_ITEM_DESCRIPTIONS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")}
|
||||
@JoinColumn(name = "OBJECT_ID")
|
||||
}
|
||||
))
|
||||
@IndexedEmbedded
|
||||
@XmlElement(name = "description", namespace = CMS_XML_NS)
|
||||
|
|
|
|||
|
|
@ -78,13 +78,6 @@ public class ContentTypeImExporter
|
|||
existingEntity.setDisplayName(importedEntity.getDisplayName());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getContentSection(),
|
||||
importedEntity.getContentSection()
|
||||
)) {
|
||||
existingEntity.setContentSection(importedEntity.getContentSection());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getLabel(),
|
||||
importedEntity.getLabel()
|
||||
|
|
@ -118,11 +111,11 @@ public class ContentTypeImExporter
|
|||
)) {
|
||||
existingEntity.setDescendants(importedEntity.getDescendants());
|
||||
}
|
||||
|
||||
|
||||
if (existingEntity.getMode() != importedEntity.getMode()) {
|
||||
existingEntity.setMode(importedEntity.getMode());
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getDefaultLifecycle(),
|
||||
importedEntity.getDefaultLifecycle()
|
||||
|
|
@ -131,7 +124,7 @@ public class ContentTypeImExporter
|
|||
importedEntity.getDefaultLifecycle()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getDefaultWorkflow(),
|
||||
importedEntity.getDefaultWorkflow()
|
||||
|
|
@ -140,7 +133,7 @@ public class ContentTypeImExporter
|
|||
importedEntity.getDefaultWorkflow()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
contentTypeRepo.save(existingEntity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package org.librecms.contentsection;
|
||||
|
||||
import net.bytebuddy.build.Plugin;
|
||||
import org.libreccm.categorization.Category;
|
||||
import org.libreccm.categorization.CategoryManager;
|
||||
import org.libreccm.categorization.Domain;
|
||||
|
|
@ -14,7 +13,6 @@ import java.util.Set;
|
|||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2022 LibreCCM Foundation.
|
||||
|
|
@ -122,28 +120,6 @@ public class FolderImExporter extends AbstractEntityImExporter<Folder> {
|
|||
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(
|
||||
existingEntity.getTitle(),
|
||||
withImportedEntity.getTitle()
|
||||
|
|
|
|||
|
|
@ -67,11 +67,14 @@ public class Article extends ContentItem implements Serializable {
|
|||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
joinTable = @JoinTable(name = "ARTICLE_TEXTS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")}
|
||||
))
|
||||
joinTable = @JoinTable(
|
||||
name = "ARTICLE_TEXTS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")
|
||||
}
|
||||
)
|
||||
)
|
||||
private LocalizedString text;
|
||||
|
||||
public Article() {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.librecms.contenttypes;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
|
@ -71,11 +70,14 @@ public class Event extends ContentItem implements Serializable {
|
|||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
joinTable = @JoinTable(name = "EVENT_TEXTS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")}
|
||||
))
|
||||
joinTable = @JoinTable(
|
||||
name = "EVENT_TEXTS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")
|
||||
}
|
||||
)
|
||||
)
|
||||
private LocalizedString text;
|
||||
|
||||
@Column(name = "START_DATE")
|
||||
|
|
@ -92,11 +94,14 @@ public class Event extends ContentItem implements Serializable {
|
|||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
joinTable = @JoinTable(name = "EVENT_DATES",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")}
|
||||
))
|
||||
joinTable = @JoinTable(
|
||||
name = "EVENT_DATES",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")
|
||||
}
|
||||
)
|
||||
)
|
||||
private LocalizedString eventDate;
|
||||
|
||||
/**
|
||||
|
|
@ -105,11 +110,14 @@ public class Event extends ContentItem implements Serializable {
|
|||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
joinTable = @JoinTable(name = "EVENT_LOCATIONS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")}
|
||||
))
|
||||
joinTable = @JoinTable(
|
||||
name = "EVENT_LOCATIONS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")
|
||||
}
|
||||
)
|
||||
)
|
||||
private LocalizedString location;
|
||||
|
||||
/**
|
||||
|
|
@ -118,21 +126,27 @@ public class Event extends ContentItem implements Serializable {
|
|||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
joinTable = @JoinTable(name = "EVENT_MAIN_CONTRIBUTORS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")}
|
||||
))
|
||||
joinTable = @JoinTable(
|
||||
name = "EVENT_MAIN_CONTRIBUTORS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")
|
||||
}
|
||||
)
|
||||
)
|
||||
private LocalizedString mainContributor;
|
||||
|
||||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
joinTable = @JoinTable(name = "EVENT_TYPES",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")}
|
||||
))
|
||||
joinTable = @JoinTable(
|
||||
name = "EVENT_TYPES",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")
|
||||
}
|
||||
)
|
||||
)
|
||||
private LocalizedString eventType;
|
||||
|
||||
//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
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
joinTable = @JoinTable(name = "EVENT_COSTS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")}
|
||||
))
|
||||
joinTable = @JoinTable(
|
||||
name = "EVENT_COSTS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")
|
||||
}
|
||||
)
|
||||
)
|
||||
private LocalizedString cost;
|
||||
|
||||
public Event() {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class MultiPartArticleImExporter
|
|||
|
||||
@Inject
|
||||
private MultiPartArticleSectionManager sectionManager;
|
||||
|
||||
|
||||
@Inject
|
||||
private MultiPartArticleSectionRepository sectionRepo;
|
||||
|
||||
|
|
@ -81,17 +81,20 @@ public class MultiPartArticleImExporter
|
|||
existingContentItem.getSummary()
|
||||
);
|
||||
}
|
||||
|
||||
final List<MultiPartArticleSection> missingSections = importedContentItem
|
||||
.getSections()
|
||||
.stream()
|
||||
.filter(
|
||||
section -> existingContentItem.getSections().contains(section)
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for(final MultiPartArticleSection missingSection : missingSections) {
|
||||
final MultiPartArticleSection newSection = new MultiPartArticleSection();
|
||||
|
||||
final List<MultiPartArticleSection> missingSections
|
||||
= importedContentItem
|
||||
.getSections()
|
||||
.stream()
|
||||
.filter(
|
||||
section -> existingContentItem.getSections().contains(
|
||||
section)
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (final MultiPartArticleSection missingSection : missingSections) {
|
||||
final MultiPartArticleSection newSection
|
||||
= new MultiPartArticleSection();
|
||||
newSection.setPageBreak(missingSection.isPageBreak());
|
||||
newSection.setRank(missingSection.getRank());
|
||||
syncLocalizedStrings(
|
||||
|
|
@ -99,13 +102,13 @@ public class MultiPartArticleImExporter
|
|||
newSection.getText()
|
||||
);
|
||||
syncLocalizedStrings(
|
||||
missingSection.getTitle(),
|
||||
missingSection.getTitle(),
|
||||
newSection.getTitle()
|
||||
);
|
||||
|
||||
|
||||
sectionManager.addSectionToMultiPartArticle(
|
||||
newSection,
|
||||
existingContentItem
|
||||
existingContentItem
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,13 +102,6 @@ public class LifecycleDefinitionImExporter
|
|||
);
|
||||
}
|
||||
|
||||
for (final PhaseDefinition phaseDef : importedEntity
|
||||
.getPhaseDefinitions()) {
|
||||
if (!existingEntity.getPhaseDefinitions().contains(phaseDef)) {
|
||||
existingEntity.addPhaseDefinition(phaseDef);
|
||||
}
|
||||
}
|
||||
|
||||
lifecycleDefRepo.save(existingEntity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ public class PhaseDefinition implements Exportable, Serializable {
|
|||
this.definitionId = definitionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,15 @@ public class PhaseDefinitionImExporter
|
|||
);
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getDefaultListener(),
|
||||
importedEntity.getDefaultListener()
|
||||
)) {
|
||||
existingEntity.setDefaultListener(
|
||||
importedEntity.getDefaultListener()
|
||||
);
|
||||
}
|
||||
|
||||
phaseDefinitionRepo.save(existingEntity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,29 +86,15 @@ public class PhaseImExporter
|
|||
)) {
|
||||
existingEntity.setListener(importedEntity.getListener());
|
||||
}
|
||||
|
||||
|
||||
if (existingEntity.isStarted() != importedEntity.isStarted()) {
|
||||
existingEntity.setStarted(importedEntity.isStarted());
|
||||
}
|
||||
|
||||
|
||||
if (existingEntity.isFinished() != 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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,21 +76,6 @@ public class CategorizationImExporter
|
|||
protected void updateExistingEntity(
|
||||
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()) {
|
||||
existingEntity.setIndexObject(importedEntity.isIndexObject());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public class CategoryImExporter extends AbstractEntityImExporter<Category> {
|
|||
importedEntity.getDescription()
|
||||
)) {
|
||||
syncLocalizedStrings(
|
||||
importedEntity.getDescription(),
|
||||
importedEntity.getDescription(),
|
||||
existingEntity.getDescription()
|
||||
);
|
||||
}
|
||||
|
|
@ -115,51 +115,12 @@ public class CategoryImExporter extends AbstractEntityImExporter<Category> {
|
|||
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(
|
||||
existingEntity.getTitle(),
|
||||
importedEntity.getTitle()
|
||||
)) {
|
||||
syncLocalizedStrings(
|
||||
importedEntity.getTitle(),
|
||||
importedEntity.getTitle(),
|
||||
existingEntity.getTitle()
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,13 @@ public class DomainImExporter extends AbstractEntityImExporter<Domain> {
|
|||
final Domain existingEntity,
|
||||
final Domain importedEntity
|
||||
) {
|
||||
if (!Objects.equals(
|
||||
existingEntity.getDisplayName(),
|
||||
importedEntity.getDisplayName()
|
||||
)) {
|
||||
importedEntity.setDisplayName(importedEntity.getDisplayName());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getDomainKey(),
|
||||
importedEntity.getDomainKey()
|
||||
|
|
@ -116,24 +123,6 @@ public class DomainImExporter extends AbstractEntityImExporter<Domain> {
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ public class DomainOwnershipImExporter
|
|||
|
||||
@Inject
|
||||
private DomainManager domainManager;
|
||||
|
||||
|
||||
@Inject
|
||||
private DomainOwnershipRepository domainOwnershipRepo;
|
||||
|
||||
|
||||
@Inject
|
||||
private EntityManager entityManager;
|
||||
|
||||
|
|
@ -72,35 +72,34 @@ public class DomainOwnershipImExporter
|
|||
protected Optional<DomainOwnership> findExistingEntity(final String uuid) {
|
||||
return domainOwnershipRepo.findByUuid(uuid);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void updateExistingEntity(
|
||||
final DomainOwnership existingEntity,
|
||||
final DomainOwnership importedEnity
|
||||
) {
|
||||
if (!Objects.equals(
|
||||
existingEntity.getContext(),
|
||||
existingEntity.getContext(),
|
||||
importedEnity.getContext()
|
||||
)) {
|
||||
existingEntity.setContext(importedEnity.getContext());
|
||||
}
|
||||
|
||||
|
||||
if (existingEntity.getOwnerOrder() != importedEnity.getOwnerOrder()) {
|
||||
existingEntity.setOwnerOrder(importedEnity.getOwnerOrder());
|
||||
}
|
||||
|
||||
|
||||
if (existingEntity.getDomainOrder() != importedEnity.getDomainOrder()) {
|
||||
existingEntity.setDomainOrder(importedEnity.getDomainOrder());
|
||||
}
|
||||
|
||||
|
||||
domainOwnershipRepo.save(existingEntity);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void saveImportedEntity(final DomainOwnership entity) {
|
||||
domainOwnershipRepo.save(entity);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected DomainOwnership reloadEntity(final DomainOwnership entity) {
|
||||
|
|
|
|||
|
|
@ -83,47 +83,7 @@ public class GroupMembershipImExporter
|
|||
final GroupMembership existingEntity,
|
||||
final GroupMembership importedEntity
|
||||
) {
|
||||
if (!Objects.equals(
|
||||
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);
|
||||
// Nothing to update in a GroupMembership
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -100,18 +100,11 @@ public class PermissionImExporter extends AbstractEntityImExporter<Permission> {
|
|||
)) {
|
||||
existingEntity.setCreationIp(importedEntity.getCreationIp());
|
||||
}
|
||||
|
||||
|
||||
if (existingEntity.isInherited() != importedEntity.isInherited()) {
|
||||
existingEntity.setInherited(importedEntity.isInherited());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getInheritedFrom(),
|
||||
importedEntity.getInheritedFrom()
|
||||
)) {
|
||||
existingEntity.setInheritedFrom(importedEntity.getInheritedFrom());
|
||||
}
|
||||
|
||||
|
||||
permissionRepository.save(existingEntity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,20 +82,7 @@ public class RoleMembershipImExporter
|
|||
final RoleMembership existingEntity,
|
||||
final RoleMembership importedEntity
|
||||
) {
|
||||
if (!Objects.equals(
|
||||
existingEntity.getRole(),
|
||||
importedEntity.getRole()
|
||||
)) {
|
||||
existingEntity.setRole(importedEntity.getRole());
|
||||
}
|
||||
if (!Objects.equals(
|
||||
existingEntity.getMember(),
|
||||
importedEntity.getMember()
|
||||
)) {
|
||||
existingEntity.setMember(importedEntity.getMember());
|
||||
}
|
||||
|
||||
membershipRepo.save(existingEntity);
|
||||
// Nothing to update in a RoleMembership
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -43,10 +43,10 @@ public class AssignableTaskImExporter
|
|||
|
||||
@Inject
|
||||
private AssignableTaskRepository assignableTaskRepository;
|
||||
|
||||
|
||||
@Inject
|
||||
private TaskManager taskManager;
|
||||
|
||||
|
||||
@Inject
|
||||
private AssignableTaskManager assignableTaskManager;
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ public class AssignableTaskImExporter
|
|||
public Class<AssignableTask> getEntityClass() {
|
||||
return AssignableTask.class;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Optional<AssignableTask> findExistingEntity(final String uuid) {
|
||||
return assignableTaskRepository.findByUuid(uuid);
|
||||
|
|
@ -75,50 +75,81 @@ public class AssignableTaskImExporter
|
|||
protected void saveImportedEntity(final AssignableTask entity) {
|
||||
assignableTaskRepository.save(entity);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void updateExistingEntity(
|
||||
final AssignableTask existingEntity,
|
||||
final AssignableTask importedEntity
|
||||
) {
|
||||
if(!Objects.equals(
|
||||
if (!Objects.equals(
|
||||
existingEntity.getLabel(),
|
||||
importedEntity.getLabel()
|
||||
)) {
|
||||
syncLocalizedStrings(
|
||||
importedEntity.getLabel(),
|
||||
importedEntity.getLabel(),
|
||||
existingEntity.getLabel()
|
||||
);
|
||||
}
|
||||
|
||||
if(!Objects.equals(
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getDescription(),
|
||||
importedEntity.getDescription()
|
||||
)) {
|
||||
syncLocalizedStrings(
|
||||
importedEntity.getDescription(),
|
||||
importedEntity.getDescription(),
|
||||
existingEntity.getDescription()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (existingEntity.isActive() != 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(
|
||||
existingEntity.getWorkflow(),
|
||||
importedEntity.getWorkflow()
|
||||
existingEntity.getLockingUser(),
|
||||
importedEntity.getLockingUser()
|
||||
)) {
|
||||
taskManager.removeTask(
|
||||
existingEntity.getWorkflow(),
|
||||
existingEntity
|
||||
);
|
||||
taskManager.addTask(
|
||||
importedEntity.getWorkflow(),
|
||||
existingEntity
|
||||
existingEntity.setLockingUser(importedEntity.getLockingUser());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getStartDate(),
|
||||
importedEntity.getStartDate()
|
||||
)) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import javax.enterprise.context.RequestScoped;
|
|||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.NoResultException;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
/**
|
||||
* Exporter/Importer for {@link TaskDependency} entities.
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ import org.libreccm.imexport.Processes;
|
|||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
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(
|
||||
existingEntity.getName(),
|
||||
importedEntity.getName()
|
||||
|
|
@ -117,30 +108,7 @@ public class WorkflowImExporter extends AbstractEntityImExporter<Workflow> {
|
|||
existingEntity.setTasksState(importedEntity.getTasksState());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getObject(),
|
||||
importedEntity.getObject()
|
||||
)) {
|
||||
existingEntity.setObject(importedEntity.getObject());
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import javax.annotation.PostConstruct;
|
|||
import javax.enterprise.context.RequestScoped;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
/**
|
||||
* 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());
|
||||
}
|
||||
|
||||
if(!Objects.equals(
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getPath(),
|
||||
importedEntity.getPath()
|
||||
)) {
|
||||
existingEntity.setPath(importedEntity.getPath());
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getMimeType(),
|
||||
importedEntity.getMimeType()
|
||||
)) {
|
||||
existingEntity.setMimeType(importedEntity.getMimeType());
|
||||
}
|
||||
|
||||
|
||||
if (existingEntity.getSize() != importedEntity.getSize()) {
|
||||
existingEntity.setSize(importedEntity.getSize());
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getCreationDate(),
|
||||
importedEntity.getCreationDate()
|
||||
)) {
|
||||
existingEntity.setCreationDate(importedEntity.getCreationDate());
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getLastModifiedDate(),
|
||||
importedEntity.getLastModifiedDate()
|
||||
|
|
@ -117,14 +116,14 @@ public class FileImExporter extends AbstractEntityImExporter<File> {
|
|||
importedEntity.getLastModifiedDate()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getCreationIp(),
|
||||
importedEntity.getCreationIp()
|
||||
)) {
|
||||
existingEntity.setCreationIp(importedEntity.getCreationIp());
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getLastModifiedIp(),
|
||||
importedEntity.getLastModifiedIp()
|
||||
|
|
@ -133,14 +132,14 @@ public class FileImExporter extends AbstractEntityImExporter<File> {
|
|||
importedEntity.getLastModifiedIp()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getCreationUser(),
|
||||
importedEntity.getCreationUser()
|
||||
)) {
|
||||
existingEntity.setCreationUser(importedEntity.getCreationUser());
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getLastModifiedUser(),
|
||||
importedEntity.getLastModifiedUser()
|
||||
|
|
@ -149,28 +148,14 @@ public class FileImExporter extends AbstractEntityImExporter<File> {
|
|||
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.getContent(),
|
||||
importedEntity.getContent()
|
||||
)) {
|
||||
existingEntity.setContent(importedEntity.getContent());
|
||||
}
|
||||
|
||||
|
||||
fileRepository.save(existingEntity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
|
|||
public Class<Folder> getEntityClass() {
|
||||
return Folder.class;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Optional<Folder> findExistingEntity(final String uuid) {
|
||||
return folderRepository.findByUuid(uuid);
|
||||
|
|
@ -61,13 +61,13 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
|
|||
protected void saveImportedEntity(final Folder entity) {
|
||||
folderRepository.save(entity);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void updateExistingEntity(
|
||||
final Folder existingEntity,
|
||||
final Folder importedEntity
|
||||
) {
|
||||
if (!Objects.equals(
|
||||
if (!Objects.equals(
|
||||
existingEntity.getName(),
|
||||
importedEntity.getName()
|
||||
)) {
|
||||
|
|
@ -80,32 +80,32 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
|
|||
)) {
|
||||
existingEntity.setDescription(importedEntity.getDescription());
|
||||
}
|
||||
|
||||
if(!Objects.equals(
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getPath(),
|
||||
importedEntity.getPath()
|
||||
)) {
|
||||
existingEntity.setPath(importedEntity.getPath());
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getMimeType(),
|
||||
importedEntity.getMimeType()
|
||||
)) {
|
||||
existingEntity.setMimeType(importedEntity.getMimeType());
|
||||
}
|
||||
|
||||
|
||||
if (existingEntity.getSize() != importedEntity.getSize()) {
|
||||
existingEntity.setSize(importedEntity.getSize());
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getCreationDate(),
|
||||
importedEntity.getCreationDate()
|
||||
)) {
|
||||
existingEntity.setCreationDate(importedEntity.getCreationDate());
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getLastModifiedDate(),
|
||||
importedEntity.getLastModifiedDate()
|
||||
|
|
@ -114,14 +114,14 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
|
|||
importedEntity.getLastModifiedDate()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getCreationIp(),
|
||||
importedEntity.getCreationIp()
|
||||
)) {
|
||||
existingEntity.setCreationIp(importedEntity.getCreationIp());
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getLastModifiedIp(),
|
||||
importedEntity.getLastModifiedIp()
|
||||
|
|
@ -130,14 +130,14 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
|
|||
importedEntity.getLastModifiedIp()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getCreationUser(),
|
||||
importedEntity.getCreationUser()
|
||||
)) {
|
||||
existingEntity.setCreationUser(importedEntity.getCreationUser());
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getLastModifiedUser(),
|
||||
importedEntity.getLastModifiedUser()
|
||||
|
|
@ -146,30 +146,7 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
|
|||
public Class<Repository> getEntityClass() {
|
||||
return Repository.class;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Optional<Repository> findExistingEntity(final String uuid) {
|
||||
return repositoryRepository.findByUuid(uuid);
|
||||
|
|
@ -59,7 +59,7 @@ public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
|
|||
protected void saveImportedEntity(final Repository portableObject) {
|
||||
repositoryRepository.save(portableObject);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void updateExistingEntity(
|
||||
final Repository existingEntity,
|
||||
|
|
@ -71,27 +71,27 @@ public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
|
|||
)) {
|
||||
existingEntity.setDisplayName(importedEntity.getDisplayName());
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getTitle(),
|
||||
importedEntity.getTitle()
|
||||
)) {
|
||||
syncLocalizedStrings(
|
||||
importedEntity.getTitle(),
|
||||
importedEntity.getTitle(),
|
||||
existingEntity.getTitle()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getDescription(),
|
||||
importedEntity.getDescription()
|
||||
)) {
|
||||
syncLocalizedStrings(
|
||||
importedEntity.getDescription(),
|
||||
importedEntity.getDescription(),
|
||||
existingEntity.getDescription()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getApplicationType(),
|
||||
importedEntity.getApplicationType()
|
||||
|
|
@ -100,7 +100,7 @@ public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
|
|||
importedEntity.getApplicationType()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getPrimaryUrl(),
|
||||
importedEntity.getPrimaryUrl()
|
||||
|
|
@ -109,28 +109,21 @@ public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
|
|||
importedEntity.getPrimaryUrl()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getName(),
|
||||
importedEntity.getName()
|
||||
)) {
|
||||
existingEntity.setName(importedEntity.getName());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getRootFolder(),
|
||||
importedEntity.getRootFolder()
|
||||
)) {
|
||||
existingEntity.setRootFolder(importedEntity.getRootFolder());
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getOwner(),
|
||||
importedEntity.getOwner()
|
||||
)) {
|
||||
existingEntity.setOwner(importedEntity.getOwner());
|
||||
}
|
||||
|
||||
|
||||
repositoryRepository.save(existingEntity);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue