Updated JournalImExporter to implement new interface
parent
05abf25373
commit
eb55d3a6b9
|
|
@ -97,11 +97,13 @@ public class Journal implements Exportable, Serializable {
|
|||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
joinTable = @JoinTable(name = "JOURNAL_DESCRIPTIONS",
|
||||
joinTable = @JoinTable(
|
||||
name = "JOURNAL_DESCRIPTIONS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")
|
||||
})
|
||||
}
|
||||
)
|
||||
)
|
||||
private LocalizedString description;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import org.libreccm.imexport.AbstractEntityImExporter;
|
|||
import org.libreccm.imexport.Processes;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
|
|
@ -21,22 +22,79 @@ public class JournalImExporter
|
|||
@Inject
|
||||
private JournalRepository journalRepo;
|
||||
|
||||
@Override
|
||||
public Class<Journal> getEntityClass() {
|
||||
return Journal.class;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Class<Journal> getEntityClass() {
|
||||
return Journal.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Optional<Journal> findExistingEntity(final String uuid) {
|
||||
return journalRepo.findByUuid(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void saveImportedEntity(final Journal journal) {
|
||||
journalRepo.save(journal);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateExistingEntity(
|
||||
final Journal existingEntity,
|
||||
final Journal importedEntity
|
||||
) {
|
||||
if (!Objects.equals(
|
||||
existingEntity.getFirstYear(),
|
||||
importedEntity.getFirstYear()
|
||||
)) {
|
||||
existingEntity.setFirstYear(importedEntity.getFirstYear());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getLastYear(),
|
||||
importedEntity.getLastYear()
|
||||
)) {
|
||||
existingEntity.setLastYear(importedEntity.getLastYear());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getIssn(),
|
||||
importedEntity.getIssn()
|
||||
)) {
|
||||
existingEntity.setIssn(importedEntity.getIssn());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getTitle(),
|
||||
importedEntity.getTitle()
|
||||
)) {
|
||||
existingEntity.setTitle(importedEntity.getTitle());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getDescription(),
|
||||
importedEntity.getDescription()
|
||||
)) {
|
||||
syncLocalizedStrings(
|
||||
importedEntity.getDescription(),
|
||||
existingEntity.getDescription()
|
||||
);
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getSymbol(),
|
||||
importedEntity.getSymbol()
|
||||
)) {
|
||||
existingEntity.setSymbol(importedEntity.getSymbol());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Journal reloadEntity(final Journal journal) {
|
||||
return journalRepo
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
)
|
||||
@NamedQueries({
|
||||
@NamedQuery(
|
||||
name = "VolumeInSeries",
|
||||
name = "VolumeInSeries.findByUuid",
|
||||
query = "SELECT v FROM VolumeInSeries v WHERE v.uuid = :uuid"
|
||||
)
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue