Removed some more final modifiers

deploy_packages_to_gitea
Jens Pelzetter 2023-01-24 20:00:54 +01:00
parent f9fe016c3f
commit 35a1e712f7
3 changed files with 92 additions and 15 deletions

View File

@ -20,7 +20,6 @@ package org.librecms.assets;
import java.util.Objects;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
@ -29,15 +28,42 @@ import java.util.Objects;
public abstract class AbstractBinaryAssetImExporter<T extends BinaryAsset>
extends AbstractAssetImExporter<T> {
/**
* Implementation of
* {@link AbstractBinaryAssetImExporter#initAssetImExporter()} for subtypes
* of {@link BinaryAsset}.
*
* !!!Warning: Implementations of this abstract class MUST NEVER override
* this method. Instead they MUST implement
* {@link #initBinaryAssetImExporter()}.
*
* Unfortunetly, CDI does not support final methods, therefore we can't make
* this method final.
*/
@Override
protected final void initAssetImExporter() {
protected void initAssetImExporter() {
initBinaryAssetImExporter();
}
protected abstract void initBinaryAssetImExporter();
/**
* Implementation of
* {@link AbstractAssetImExporter#updateExistingAsset(org.librecms.contentsection.Asset, org.librecms.contentsection.Asset)}
* for subtypes of {@link BinaryAsset}.
*
* Implementations of this abstract class MUST NEVER override this method.
* Instead, they MUST implement
* {@link #updateExistingBinaryAsset(org.librecms.assets.BinaryAsset, org.librecms.assets.BinaryAsset)}.
*
* Unfortunetly, CDI does not support final methods, therefore we can't make
* this method final.
*
* @param existingAsset
* @param importedAsset
*/
@Override
protected final void updateExistingAsset(
protected void updateExistingAsset(
final T existingAsset,
final T importedAsset
) {

View File

@ -20,7 +20,6 @@ package org.librecms.assets;
import java.util.Objects;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
@ -29,14 +28,39 @@ import java.util.Objects;
public abstract class AbstractBookmarkImExporter<T extends Bookmark>
extends AbstractAssetImExporter<T> {
/**
* Implementation of {@link AbstractAssetImExporter#initAssetImExporter()}
* for {@link Bookmark} and subtypes of {@link Bookmark}.
*
* !!!Warning: Implementations of this abstract class MUST NEVER override
* this method. Instead, they MUST implement {@link #initBookmarkImExporter()
* }.
*
* Unfortunetly, CDI does not support final methods, therefore we can't make
* this method final.
*/
@Override
protected final void initAssetImExporter() {
initBookmarkImExporter();
}
protected abstract void initBookmarkImExporter();
/**
* Implementation of {@link AbstractAssetImExporter#updateExistingAsset(org.librecms.contentsection.Asset, org.librecms.contentsection.Asset)
* }
* for {@link Bookmark} and subtypes of {@link Bookmark}.
*
* !!!Warning: Implementations of this abstract class MUST NEVER override
* this method. Instead, they MUST implement
* {@link #updateExistingBookmark(org.librecms.assets.Bookmark, org.librecms.assets.Bookmark)}.
*
* Unfortunetly, CDI does not support final methods, therefore we can't make
* this method final.
*
* @param existingAsset
* @param importedAsset
*/
@Override
protected final void updateExistingAsset(
final T existingAsset,
@ -47,24 +71,24 @@ public abstract class AbstractBookmarkImExporter<T extends Bookmark>
importedAsset.getDescription()
)) {
syncLocalizedStrings(
importedAsset.getDescription(),
importedAsset.getDescription(),
existingAsset.getDescription()
);
}
}
if (!Objects.equals(
existingAsset.getUrl(),
importedAsset.getUrl()
)) {
existingAsset.setUrl(importedAsset.getUrl());
}
updateExistingBookmark(existingAsset, importedAsset);
}
protected abstract void updateExistingBookmark(
final T existingBookmark,
final T importedBookmark
);
}

View File

@ -29,8 +29,19 @@ import java.util.Set;
public abstract class AbstractContactableEntityImExporter<T extends ContactableEntity>
extends AbstractAssetImExporter<T> {
/**
* Implementation of {@link AbstractAssetImExporter#initAssetImExporter()}
* for subtypes of {@link ContactableEntity}.
*
* !!!Warning: Implementations of this abstract class MUST NEVER override
* this method. Instead, they MUST override
* {@link #initContactableEntityImExporter()}
*
* Unfortunetly, CDI does not support final methods, therefore we can't make
* this method final.
*/
@Override
protected final void initAssetImExporter() {
protected void initAssetImExporter() {
addRequiredEntities(Set.of(PostalAddress.class));
initContactableEntityImExporter();
@ -38,8 +49,24 @@ public abstract class AbstractContactableEntityImExporter<T extends ContactableE
protected abstract void initContactableEntityImExporter();
/**
* Implementation of
* {@link AbstractAssetImExporter#updateExistingAsset(org.librecms.contentsection.Asset, org.librecms.contentsection.Asset)}
* for subtypes of {@link ContactableEntity}.
*
* !!!Warning: Implemementations of this abstract class MUST NEVER override
* this method. Instead, they MUST implement
* {@link #updateExistingContactable(org.librecms.assets.ContactableEntity, org.librecms.assets.ContactableEntity)}.
*
*
* Unfortunetly, CDI does not support final methods, therefore we can't make
* this method final.
*
* @param existingAsset
* @param importedAsset
*/
@Override
protected final void updateExistingAsset(
protected void updateExistingAsset(
final T existingAsset,
final T importedAsset
) {