use of org.orcid.persistence.jpa.entities.GroupIdRecordEntity in project ORCID-Source by ORCID.
the class GroupIdRecordDaoImpl method findByGroupId.
@Override
public GroupIdRecordEntity findByGroupId(String groupId) {
TypedQuery<GroupIdRecordEntity> query = entityManager.createQuery("from GroupIdRecordEntity where trim(lower(groupId)) = trim(lower(:groupId))", GroupIdRecordEntity.class);
query.setParameter("groupId", groupId);
GroupIdRecordEntity result = query.getSingleResult();
return result;
}
use of org.orcid.persistence.jpa.entities.GroupIdRecordEntity in project ORCID-Source by ORCID.
the class GroupIdRecordDaoImpl method findByName.
@Override
public GroupIdRecordEntity findByName(String name) {
TypedQuery<GroupIdRecordEntity> query = entityManager.createQuery("from GroupIdRecordEntity where trim(lower(group_name)) = trim(lower(:group_name))", GroupIdRecordEntity.class);
query.setParameter("group_name", name);
GroupIdRecordEntity result = query.getSingleResult();
return result;
}
use of org.orcid.persistence.jpa.entities.GroupIdRecordEntity in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_GeneralTest method testOrcidProfileCreateCanViewAndCreateGroupIds.
@Test
public void testOrcidProfileCreateCanViewAndCreateGroupIds() {
SecurityContextTestUtils.setUpSecurityContextForClientOnly();
try {
serviceDelegator.viewGroupIdRecord(1L);
} catch (Exception e) {
fail();
}
try {
serviceDelegator.viewGroupIdRecords("10", "1");
} catch (Exception e) {
fail();
}
GroupIdRecord groupIdRecord = Utils.getGroupIdRecord();
try {
serviceDelegator.createGroupIdRecord(groupIdRecord);
} catch (Exception e) {
fail();
}
GroupIdRecordEntity toDelete = groupIdRecordDao.findByGroupId(groupIdRecord.getGroupId());
groupIdRecordDao.remove(toDelete.getId());
}
use of org.orcid.persistence.jpa.entities.GroupIdRecordEntity in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getGroupIdRecordMapperFacade.
public MapperFacade getGroupIdRecordMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ClassMapBuilder<GroupIdRecord, GroupIdRecordEntity> classMap = mapperFactory.classMap(GroupIdRecord.class, GroupIdRecordEntity.class);
addV3CommonFields(classMap);
registerSourceConverters(mapperFactory, classMap);
classMap.field("name", "groupName");
classMap.field("groupId", "groupId");
classMap.field("description", "groupDescription");
classMap.field("type", "groupType");
classMap.register();
return mapperFactory.getMapperFacade();
}
use of org.orcid.persistence.jpa.entities.GroupIdRecordEntity in project ORCID-Source by ORCID.
the class GroupIdRecordManagerImpl method deleteGroupIdRecord.
@Override
public void deleteGroupIdRecord(Long putCode) {
GroupIdRecordEntity existingEntity = groupIdRecordDao.find(putCode);
if (existingEntity != null) {
if (groupIdRecordDao.haveAnyPeerReview(existingEntity.getGroupId())) {
throw new OrcidElementCantBeDeletedException("Unable to delete group id because there are peer reviews associated to it");
}
orcidSecurityManager.checkSource(existingEntity);
groupIdRecordDao.remove(Long.valueOf(putCode));
} else {
throw new GroupIdRecordNotFoundException();
}
}
Aggregations