Additional improvements for structure for publication im/exporters
parent
92299fb9b0
commit
ae8da39512
|
|
@ -1,10 +1,8 @@
|
||||||
package org.scientificcms.publications;
|
package org.scientificcms.publications;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
|
@ -12,7 +10,7 @@ import javax.annotation.PostConstruct;
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractPublicationWithPublisherImExporter<T extends PublicationWithPublisher>
|
public abstract class AbstractPublicationWithPublisherImExporter<T extends PublicationWithPublisher>
|
||||||
extends AbstractPublicationImExporter<T> {
|
extends AbstractPublicationImExporter<T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected final void initPublicationImExporter() {
|
protected final void initPublicationImExporter() {
|
||||||
addRequiredEntities(
|
addRequiredEntities(
|
||||||
|
|
@ -22,7 +20,81 @@ public abstract class AbstractPublicationWithPublisherImExporter<T extends Publi
|
||||||
);
|
);
|
||||||
initPublicationWithPublisherImExporter();
|
initPublicationWithPublisherImExporter();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void initPublicationWithPublisherImExporter();
|
protected abstract void initPublicationWithPublisherImExporter();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void updateExistingPublication(
|
||||||
|
final T existingPublication,
|
||||||
|
final T withImportedPublication
|
||||||
|
) {
|
||||||
|
if (!Objects.equals(
|
||||||
|
existingPublication.getPublisher(),
|
||||||
|
withImportedPublication.getPublisher()
|
||||||
|
)) {
|
||||||
|
existingPublication.setPublisher(
|
||||||
|
withImportedPublication.getPublisher()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Objects.equals(
|
||||||
|
existingPublication.getIsbn10(),
|
||||||
|
withImportedPublication.getIsbn10()
|
||||||
|
)) {
|
||||||
|
existingPublication.setIsbn10(withImportedPublication.getIsbn10());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Objects.equals(
|
||||||
|
existingPublication.getIsbn13(),
|
||||||
|
withImportedPublication.getIsbn13()
|
||||||
|
)) {
|
||||||
|
existingPublication.setIsbn13(withImportedPublication.getIsbn13());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Objects.equals(
|
||||||
|
existingPublication.getVolume(),
|
||||||
|
withImportedPublication.getVolume()
|
||||||
|
)) {
|
||||||
|
existingPublication.setVolume(withImportedPublication.getVolume());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Objects.equals(
|
||||||
|
existingPublication.getNumberOfVolumes(),
|
||||||
|
withImportedPublication.getNumberOfVolumes()
|
||||||
|
)) {
|
||||||
|
existingPublication.setNumberOfVolumes(
|
||||||
|
withImportedPublication.getNumberOfVolumes()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Objects.equals(
|
||||||
|
existingPublication.getNumberOfPages(),
|
||||||
|
withImportedPublication.getNumberOfPages()
|
||||||
|
)) {
|
||||||
|
existingPublication.setNumberOfPages(
|
||||||
|
withImportedPublication.getNumberOfPages()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Objects.equals(
|
||||||
|
existingPublication.getEdition(),
|
||||||
|
withImportedPublication.getEdition()
|
||||||
|
)) {
|
||||||
|
syncLocalizedStrings(
|
||||||
|
withImportedPublication.getEdition(),
|
||||||
|
existingPublication.getEdition()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateExistingPublicationWithPublisher(
|
||||||
|
existingPublication,
|
||||||
|
withImportedPublication
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void updateExistingPublicationWithPublisher(
|
||||||
|
final T existingPublication,
|
||||||
|
final T withImportedPublication
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package org.scientificcms.publications;
|
||||||
|
|
||||||
import org.librecms.assets.Organization;
|
import org.librecms.assets.Organization;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -23,4 +24,49 @@ public abstract class AbstractUnPublishedImExporter<T extends UnPublished>
|
||||||
|
|
||||||
protected abstract void initUnPublishedImExporter();
|
protected abstract void initUnPublishedImExporter();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void updateExistingPublication(
|
||||||
|
final T existingPublication,
|
||||||
|
final T withImportedPublication
|
||||||
|
) {
|
||||||
|
if (!Objects.equals(
|
||||||
|
existingPublication.getPlace(),
|
||||||
|
withImportedPublication.getPlace()
|
||||||
|
)) {
|
||||||
|
existingPublication.setPlace(withImportedPublication.getPlace());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Objects.equals(
|
||||||
|
existingPublication.getNumber(),
|
||||||
|
withImportedPublication.getNumber()
|
||||||
|
)) {
|
||||||
|
existingPublication.setNumber(
|
||||||
|
withImportedPublication.getNumber()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (existingPublication.getNumberOfPages() != withImportedPublication
|
||||||
|
.getNumberOfPages()) {
|
||||||
|
existingPublication.setNumberOfPages(
|
||||||
|
withImportedPublication.getNumberOfPages()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Objects.equals(
|
||||||
|
existingPublication.getOrganization(),
|
||||||
|
withImportedPublication.getOrganization()
|
||||||
|
)) {
|
||||||
|
existingPublication.setOrganization(
|
||||||
|
withImportedPublication.getOrganization()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateExistingUnPublished(existingPublication, withImportedPublication);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void updateExistingUnPublished(
|
||||||
|
final T existingPublication,
|
||||||
|
final T withImportedPublication
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue