use of com.odysseusinc.arachne.portal.model.Organization in project ArachneCentralAPI by OHDSI.
the class OrganizationServiceImpl method update.
@Override
@Transactional
@PreAuthorize("hasPermission(#organization, 'Organization', " + "T(com.odysseusinc.arachne.portal.security.ArachnePermission).UPDATE_ORGANIZATION)")
@PostAuthorize("@ArachnePermissionEvaluator.addPermissions(principal, returnObject )")
public Organization update(Organization organization) {
final Organization exist = getByName(organization.getName());
final String name = organization.getName();
if (Objects.nonNull(name)) {
exist.setName(name);
}
final Organization saved = organizationRepository.save(exist);
logger.info("{} updated", saved);
return saved;
}
use of com.odysseusinc.arachne.portal.model.Organization in project ArachneCentralAPI by OHDSI.
the class OrganizationServiceImpl method create.
@Override
@Transactional
@PreAuthorize("hasPermission(#organization, T(com.odysseusinc.arachne.portal.security.ArachnePermission).CREATE_ORGANIZATION)")
public Organization create(Organization organization) throws ValidationException {
final String name = organization.getName();
if (StringUtils.isEmpty(name)) {
throw new ValidationException("Organization must have name");
}
organization.setId(null);
final Organization saved = organizationRepository.save(organization);
logger.info("{} created", saved);
return saved;
}
Aggregations