Fixed some typos and added missing calls to save method of responsible
repository.deploy_packages_to_gitea
parent
a2dc05f665
commit
b3f66535a4
|
|
@ -29,6 +29,7 @@ import org.librecms.assets.RelatedLink;
|
|||
import org.librecms.assets.RelatedLinkImExporter;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
|
@ -78,18 +79,145 @@ public abstract class AbstractContentItemImExporter<T extends ContentItem>
|
|||
// Related link import requires all content items to be imported to
|
||||
// get the target item.
|
||||
relatedLinkImExporter.addRequiredEntities(Set.of(getEntityClass()));
|
||||
|
||||
|
||||
initContentItemImExporter();
|
||||
}
|
||||
|
||||
protected abstract void initContentItemImExporter();
|
||||
|
||||
@Override
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected Optional<T> findExistingEntity(final String uuid) {
|
||||
return itemRepository.findByUuid(uuid, getEntityClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveImportedEntity(final T entity) {
|
||||
itemRepository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateExistingEntity(
|
||||
final T existingEntity,
|
||||
final T importedEntity
|
||||
) {
|
||||
if (!Objects.equals(
|
||||
existingEntity.getDisplayName(),
|
||||
importedEntity.getDisplayName()
|
||||
)) {
|
||||
existingEntity.setDisplayName(importedEntity.getDisplayName());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getName(),
|
||||
importedEntity.getName()
|
||||
)) {
|
||||
syncLocalizedStrings(
|
||||
importedEntity.getName(),
|
||||
existingEntity.getName()
|
||||
);
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getContentType(),
|
||||
importedEntity.getContentType()
|
||||
)) {
|
||||
existingEntity.setContentType(importedEntity.getContentType());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getTitle(),
|
||||
importedEntity.getTitle()
|
||||
)) {
|
||||
syncLocalizedStrings(
|
||||
importedEntity.getTitle(),
|
||||
existingEntity.getTitle()
|
||||
);
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getDescription(),
|
||||
importedEntity.getDescription()
|
||||
)) {
|
||||
syncLocalizedStrings(
|
||||
importedEntity.getDescription(),
|
||||
existingEntity.getDescription()
|
||||
);
|
||||
}
|
||||
|
||||
if (existingEntity.getVersion() != importedEntity.getVersion()) {
|
||||
existingEntity.setVersion(importedEntity.getVersion());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getLaunchDate(),
|
||||
importedEntity.getLaunchDate()
|
||||
)) {
|
||||
existingEntity.setLaunchDate(importedEntity.getLaunchDate());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getAncestors(),
|
||||
importedEntity.getAncestors()
|
||||
)) {
|
||||
existingEntity.setAncestors(importedEntity.getAncestors());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getLifecycle(),
|
||||
importedEntity.getLifecycle()
|
||||
)) {
|
||||
existingEntity.setLifecycle(importedEntity.getLifecycle());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getWorkflow(),
|
||||
importedEntity.getWorkflow()
|
||||
)) {
|
||||
existingEntity.setWorkflow(importedEntity.getWorkflow());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getCreationDate(),
|
||||
importedEntity.getCreationDate()
|
||||
)) {
|
||||
existingEntity.setCreationDate(importedEntity.getCreationDate());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getLastModified(),
|
||||
importedEntity.getLastModified()
|
||||
)) {
|
||||
existingEntity.setLastModified(importedEntity.getLastModified());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getCreationUserName(),
|
||||
importedEntity.getCreationUserName()
|
||||
)) {
|
||||
existingEntity.setCreationUserName(
|
||||
importedEntity.getCreationUserName()
|
||||
);
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getLastModifyingUserName(),
|
||||
importedEntity.getLastModifyingUserName()
|
||||
)) {
|
||||
existingEntity.setLastModifyingUserName(
|
||||
importedEntity.getLastModifyingUserName()
|
||||
);
|
||||
}
|
||||
|
||||
updateExistingContentItem(existingEntity, importedEntity);
|
||||
|
||||
itemRepository.save(existingEntity);
|
||||
}
|
||||
|
||||
protected abstract void updateExistingContentItem(
|
||||
final T existingContentItem,
|
||||
final T importedContentItem
|
||||
);
|
||||
|
||||
@Override
|
||||
protected T reloadEntity(final T entity) {
|
||||
return itemRepository
|
||||
|
|
|
|||
|
|
@ -628,11 +628,12 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
|
|||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
joinTable = @JoinTable(name = "CONTENT_ITEM_TITLES",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")
|
||||
}
|
||||
joinTable = @JoinTable(
|
||||
name = "CONTENT_ITEM_TITLES",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")
|
||||
}
|
||||
)
|
||||
)
|
||||
@IndexedEmbedded
|
||||
|
|
@ -645,10 +646,11 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
|
|||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
joinTable = @JoinTable(name = "CONTENT_ITEM_DESCRIPTIONS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")}
|
||||
joinTable = @JoinTable(
|
||||
name = "CONTENT_ITEM_DESCRIPTIONS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")}
|
||||
))
|
||||
@IndexedEmbedded
|
||||
@XmlElement(name = "description", namespace = CMS_XML_NS)
|
||||
|
|
|
|||
|
|
@ -126,6 +126,8 @@ public class ContentSectionImExporter
|
|||
)) {
|
||||
existingEntity.setPrimaryUrl(importedEntity.getPrimaryUrl());
|
||||
}
|
||||
|
||||
sectionRepository.save(existingEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -140,6 +140,8 @@ public class ContentTypeImExporter
|
|||
importedEntity.getDefaultWorkflow()
|
||||
);
|
||||
}
|
||||
|
||||
contentTypeRepo.save(existingEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -163,6 +163,8 @@ public class FolderImExporter extends AbstractEntityImExporter<Folder> {
|
|||
if (existingEntity.isVisible() != withImportedEntity.isVisible()) {
|
||||
existingEntity.setVisible(withImportedEntity.isVisible());
|
||||
}
|
||||
|
||||
folderRepo.save(existingEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ public class LifecycleDefinitionImExporter
|
|||
existingEntity.addPhaseDefinition(phaseDef);
|
||||
}
|
||||
}
|
||||
|
||||
lifecycleDefRepo.save(existingEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -100,6 +100,8 @@ public class LifecycleImExporter extends AbstractEntityImExporter<Lifecycle> {
|
|||
if (existingEntity.isFinished() != importedEntity.isFinished()) {
|
||||
existingEntity.setFinished(importedEntity.isFinished());
|
||||
}
|
||||
|
||||
lifecycleRepo.save(existingEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -95,6 +95,8 @@ public class PhaseDefinitionImExporter
|
|||
importedEntity.getDefaultDuration()
|
||||
);
|
||||
}
|
||||
|
||||
phaseDefinitionRepo.save(existingEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ public class PhaseImExporter
|
|||
)) {
|
||||
existingEntity.setDefinition(importedEntity.getDefinition());
|
||||
}
|
||||
|
||||
phaseRepo.save(existingEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -122,6 +122,8 @@ public class GroupMembershipImExporter
|
|||
groupManager.removeMemberFromGroup(oldMember, group);
|
||||
groupManager.addMemberToGroup(newMember, group);
|
||||
}
|
||||
|
||||
groupMembershipRepo.save(existingEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -117,9 +117,9 @@ public class AssignableTaskImExporter
|
|||
importedEntity.getWorkflow(),
|
||||
existingEntity
|
||||
);
|
||||
|
||||
// ToDo
|
||||
}
|
||||
|
||||
assignableTaskRepository.save(existingEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public class TaskAssignmentImExporter
|
|||
final TaskAssignment exitingEntity,
|
||||
final TaskAssignment importedEntity
|
||||
) {
|
||||
// Task Assignment are not updated
|
||||
// Task Assignments are not updated
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue