Several bugfixes
parent
71a033cfd1
commit
c3ab47ad90
|
|
@ -46,8 +46,10 @@ public class JournalRepository extends AbstractEntityRepository<Long, Journal> {
|
|||
|
||||
@Override
|
||||
protected void initNewEntity(final Journal entity) {
|
||||
if (entity.getUuid() == null) {
|
||||
entity.setUuid(UUID.randomUUID().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public Optional<Journal> findByUuid(final String uuid) {
|
||||
|
|
|
|||
|
|
@ -53,8 +53,9 @@ public class PublicationRepository
|
|||
|
||||
@Override
|
||||
public void initNewEntity(final Publication entity) {
|
||||
final String uuid = UUID.randomUUID().toString();
|
||||
entity.setUuid(uuid);
|
||||
if (entity.getUuid() == null) {
|
||||
entity.setUuid(UUID.randomUUID().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
|
|
|
|||
|
|
@ -52,8 +52,10 @@ public class PublicationWithPublisherRepository
|
|||
|
||||
@Override
|
||||
public void initNewEntity(final PublicationWithPublisher entity) {
|
||||
if (entity.getUuid() == null) {
|
||||
publicationRepository.initNewEntity(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<PublicationWithPublisher> findByPublisher(
|
||||
|
|
|
|||
|
|
@ -47,8 +47,10 @@ public class PublisherRepository
|
|||
|
||||
@Override
|
||||
protected void initNewEntity(final Publisher entity) {
|
||||
if (entity.getUuid() == null) {
|
||||
entity.setUuid(UUID.randomUUID().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public Optional<Publisher> findByUuid(final String uuid) {
|
||||
|
|
|
|||
|
|
@ -45,8 +45,10 @@ public class SeriesRepository
|
|||
|
||||
@Override
|
||||
public void initNewEntity(final Series entity) {
|
||||
if (entity.getUuid() == null) {
|
||||
entity.setUuid(UUID.randomUUID().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public Optional<Series> findByUuid(final String uuid) {
|
||||
|
|
|
|||
|
|
@ -46,8 +46,10 @@ public class ContactRepository
|
|||
|
||||
@Override
|
||||
public void initNewEntity(final Contact contact) {
|
||||
if (contact.getUuid() == null) {
|
||||
contact.setUuid(UUID.randomUUID().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public Optional<Contact> findByUuid(final String uuid) {
|
||||
|
|
|
|||
|
|
@ -46,8 +46,10 @@ public class DepartmentProjectRepository
|
|||
|
||||
@Override
|
||||
public void initNewEntity(final DepartmentProject project) {
|
||||
if (project.getUuid() == null) {
|
||||
project.setUuid(UUID.randomUUID().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public Optional<DepartmentProject> findByUuid(final String uuid) {
|
||||
|
|
|
|||
|
|
@ -46,8 +46,10 @@ public class MembershipRepository
|
|||
|
||||
@Override
|
||||
public void initNewEntity(final Membership membership) {
|
||||
if (membership.getUuid() == null) {
|
||||
membership.setUuid(UUID.randomUUID().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public Optional<Membership> findByUuid(final String uuid) {
|
||||
|
|
|
|||
|
|
@ -46,19 +46,22 @@ public class ContactRepository
|
|||
|
||||
@Override
|
||||
public void initNewEntity(final Contact contact) {
|
||||
if (contact.getUuid() == null) {
|
||||
contact.setUuid(UUID.randomUUID().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public Optional<Contact> findByUuid(final String uuid) {
|
||||
try {
|
||||
return Optional.of(
|
||||
getEntityManager()
|
||||
.createNamedQuery("SciProjectContact.findByUuid", Contact.class)
|
||||
.createNamedQuery("SciProjectContact.findByUuid",
|
||||
Contact.class)
|
||||
.setParameter("uuid", uuid)
|
||||
.getSingleResult()
|
||||
);
|
||||
} catch(NoResultException ex) {
|
||||
} catch (NoResultException ex) {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue