use of io.joynr.accesscontrol.global.jee.persistence.OwnerRegistrationControlEntryEntity in project joynr by bmwcarit.
the class OwnerRegistrationControlEntryManager method createOrUpdate.
public CreateOrUpdateResult<OwnerRegistrationControlEntry> createOrUpdate(OwnerRegistrationControlEntry updatedOwnerRce) {
if (!domainRoleEntryManager.hasCurrentUserGotRoleForDomain(Role.OWNER, updatedOwnerRce.getDomain())) {
return null;
}
OwnerRegistrationControlEntryEntity entity = findByUserIdDomainAndInterfaceName(updatedOwnerRce.getUid(), updatedOwnerRce.getDomain(), updatedOwnerRce.getInterfaceName());
boolean created = entity == null;
if (created) {
entity = new OwnerRegistrationControlEntryEntity();
entity.setUserId(updatedOwnerRce.getUid());
entity.setDomain(updatedOwnerRce.getDomain());
entity.setInterfaceName(updatedOwnerRce.getInterfaceName());
entityManager.persist(entity);
}
entity.setRequiredTrustLevel(updatedOwnerRce.getRequiredTrustLevel());
entity.setRequiredAceChangeTrustLevel(updatedOwnerRce.getRequiredAceChangeTrustLevel());
entity.setProviderPermission(updatedOwnerRce.getProviderPermission());
return new CreateOrUpdateResult<>(mapEntityToJoynrType(entity), created ? ChangeType.ADD : ChangeType.UPDATE);
}
Aggregations