use of io.joynr.accesscontrol.global.jee.persistence.MasterRegistrationControlEntryEntity in project joynr by bmwcarit.
the class MasterRegistrationControlEntryManager method findByUserIdDomainInterfaceNameOperationAndType.
private MasterRegistrationControlEntryEntity findByUserIdDomainInterfaceNameOperationAndType(String userId, String domain, String interfaceName, ControlEntryType type) {
Query query = entityManager.createQuery("select mrce from MasterRegistrationControlEntryEntity mrce " + "where mrce.userId = :userId and mrce.domain = :domain and mrce.interfaceName = :interfaceName and mrce.type = :type", MasterRegistrationControlEntryEntity.class);
query.setParameter("userId", userId);
query.setParameter("domain", domain);
query.setParameter("interfaceName", interfaceName);
query.setParameter("type", type);
List<MasterRegistrationControlEntryEntity> resultList = query.getResultList();
MasterRegistrationControlEntryEntity entity = null;
if (resultList.size() == 1) {
entity = resultList.get(0);
} else if (resultList.size() > 1) {
throw new JoynrIllegalStateException(String.format("Too many results found for %s with userId / domain / interfaceName / type: %s / %s / %s / %s", MasterRegistrationControlEntryEntity.class.getSimpleName(), userId, domain, interfaceName, type));
}
return entity;
}
Aggregations