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