Removed another final modifier

deploy_packages_to_gitea
Jens Pelzetter 2023-01-24 19:22:03 +01:00
parent 0d00794ffb
commit c3e90a27e1
2 changed files with 38 additions and 7 deletions

View File

@ -45,18 +45,18 @@ public abstract class AbstractAssetImExporter<T extends Asset>
@Inject @Inject
@Any @Any
private ItemAttachmentImExporter itemAttachmentImExporter; private ItemAttachmentImExporter itemAttachmentImExporter;
@PostConstruct @PostConstruct
@Override @Override
protected final void init() { protected final void init() {
// ItemAttachmentImExporter requires that all assets to be imported // ItemAttachmentImExporter requires that all assets to be imported
itemAttachmentImExporter.addRequiredEntities(Set.of(getEntityClass())); itemAttachmentImExporter.addRequiredEntities(Set.of(getEntityClass()));
initAssetImExporter(); initAssetImExporter();
} }
protected abstract void initAssetImExporter(); protected abstract void initAssetImExporter();
@Override @Override
protected Optional<T> findExistingEntity(final String uuid) { protected Optional<T> findExistingEntity(final String uuid) {
return assetRepo.findByUuidAndType(uuid, getEntityClass()); return assetRepo.findByUuidAndType(uuid, getEntityClass());
@ -67,8 +67,24 @@ public abstract class AbstractAssetImExporter<T extends Asset>
assetRepo.save(asset); assetRepo.save(asset);
} }
/**
* Implementation of
* {@link AbstractEntityImExporter#updateExistingEntity(org.libreccm.imexport.Exportable, org.libreccm.imexport.Exportable)}
* for {@link Asset}s.
*
* !!!Warning: ImExporters for assets MUST never override this method.
* Instead, they MUST implement
* {@link #updateExistingAsset(org.librecms.contentsection.Asset, org.librecms.contentsection.Asset)}.
*
* Unfortunetly, CDI does not support final methods, therefore we can't make
* this method final.
*
*
* @param existingEntity The existing entity.
* @param importedEntity The imported entity.
*/
@Override @Override
protected final void updateExistingEntity( protected void updateExistingEntity(
final T existingEntity, final T importedEntity final T existingEntity, final T importedEntity
) { ) {
if (!Objects.equals( if (!Objects.equals(
@ -77,7 +93,7 @@ public abstract class AbstractAssetImExporter<T extends Asset>
)) { )) {
existingEntity.setDisplayName(importedEntity.getDisplayName()); existingEntity.setDisplayName(importedEntity.getDisplayName());
} }
if (!Objects.equals( if (!Objects.equals(
existingEntity.getTitle(), existingEntity.getTitle(),
importedEntity.getTitle() importedEntity.getTitle()

View File

@ -100,6 +100,21 @@ public abstract class AbstractContentItemImExporter<T extends ContentItem>
itemRepository.save(entity); itemRepository.save(entity);
} }
/**
* Implementation of
* {@link AbstractEntityImExporter#updateExistingEntity(org.libreccm.imexport.Exportable, org.libreccm.imexport.Exportable)}
* for {@link ContentItem}s.
*
* !!!Warning: Implementations of this abstract class MUST NEVER override
* this method. Instead they MUST override
* {@link #updateExistingContentItem(org.librecms.contentsection.ContentItem, org.librecms.contentsection.ContentItem)}.
*
* Unfortunetly, CDI does not support final methods, therefore we can't make
* this method final.
*
* @param existingEntity
* @param importedEntity
*/
@Override @Override
protected void updateExistingEntity( protected void updateExistingEntity(
final T existingEntity, final T existingEntity,
@ -205,7 +220,7 @@ public abstract class AbstractContentItemImExporter<T extends ContentItem>
importedEntity.getLastModifyingUserName() importedEntity.getLastModifyingUserName()
); );
} }
updateExistingContentItem(existingEntity, importedEntity); updateExistingContentItem(existingEntity, importedEntity);
itemRepository.save(existingEntity); itemRepository.save(existingEntity);