Updated PublisherImExporter to implement new interface.
parent
eb55d3a6b9
commit
879083029d
|
|
@ -3,6 +3,9 @@ package org.scientificcms.publications;
|
|||
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;
|
||||
import javax.inject.Inject;
|
||||
|
|
@ -18,21 +21,46 @@ public class PublisherImExporter extends AbstractEntityImExporter<Publisher> {
|
|||
@Inject
|
||||
private PublisherRepository publisherRepo;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Publisher> getEntityClass() {
|
||||
return Publisher.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
// Nothing
|
||||
protected Optional<Publisher> findExistingEntity(final String uuid) {
|
||||
return publisherRepo.findByUuid(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void saveImportedEntity(final Publisher publisher) {
|
||||
publisherRepo.save(publisher);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateExistingEntity(
|
||||
final Publisher existingEntity,
|
||||
final Publisher importedEntity
|
||||
) {
|
||||
if (!Objects.equals(
|
||||
existingEntity.getName(),
|
||||
importedEntity.getName()
|
||||
)) {
|
||||
existingEntity.setName(importedEntity.getName());
|
||||
}
|
||||
|
||||
if (!Objects.equals(
|
||||
existingEntity.getPlace(),
|
||||
importedEntity.getPlace()
|
||||
)) {
|
||||
existingEntity.setPlace(importedEntity.getPlace());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Publisher reloadEntity(final Publisher publisher) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue