Search in sources :

Example 1 with Organization

use of com.odysseusinc.arachne.portal.model.Organization in project ArachneCentralAPI by OHDSI.

the class OrganizationDTOToOrganizationConverter method convert.

@Override
public Organization convert(OrganizationDTO source) {
    final Organization organization = new Organization();
    organization.setId(source.getId());
    organization.setName(source.getName());
    return organization;
}
Also used : Organization(com.odysseusinc.arachne.portal.model.Organization)

Example 2 with Organization

use of com.odysseusinc.arachne.portal.model.Organization in project ArachneCentralAPI by OHDSI.

the class OrganizationServiceImpl method delete.

@Override
@PreAuthorize("hasPermission(#id, 'Organization', " + "T(com.odysseusinc.arachne.portal.security.ArachnePermission).DELETE_ORGANIZATION)")
public void delete(Long id) {
    final Organization exist = getById(id);
    organizationRepository.deleteById(id);
    logger.info("{} deleted", exist);
}
Also used : Organization(com.odysseusinc.arachne.portal.model.Organization) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 3 with Organization

use of com.odysseusinc.arachne.portal.model.Organization in project ArachneCentralAPI by OHDSI.

the class BaseDataNodeController method createManualDataNode.

@ApiOperation("Create new manual data node.")
@RequestMapping(value = "/api/v1/data-nodes/manual", method = RequestMethod.POST)
public CommonDataNodeCreationResponseDTO createManualDataNode(@RequestBody @Valid CommonDataNodeRegisterDTO commonDataNodeRegisterDTO, Principal principal) throws PermissionDeniedException, AlreadyExistException, ValidationException {
    commonDataNodeRegisterDTO.setId(null);
    final DN dataNode = conversionService.convert(commonDataNodeRegisterDTO, getDataNodeDNClass());
    final Organization organization = conversionService.convert(commonDataNodeRegisterDTO.getOrganization(), Organization.class);
    dataNode.setOrganization(organizationService.getOrCreate(organization));
    return createDataNode(dataNode, principal);
}
Also used : Organization(com.odysseusinc.arachne.portal.model.Organization) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with Organization

use of com.odysseusinc.arachne.portal.model.Organization in project ArachneCentralAPI by OHDSI.

the class OrganizationController method update.

@ApiOperation("Update Organization")
@RequestMapping(value = "/api/v1/user-management/organizations/{id}", produces = APPLICATION_JSON_UTF8_VALUE, consumes = APPLICATION_JSON_UTF8_VALUE, method = PUT)
public OrganizationDTO update(@PathVariable Long id, @RequestBody OrganizationDTO organizationDTO) {
    organizationDTO.setId(id);
    final Organization organization = conversionService.convert(organizationDTO, Organization.class);
    final Organization updated = organizationService.update(organization);
    return conversionService.convert(updated, OrganizationDTO.class);
}
Also used : Organization(com.odysseusinc.arachne.portal.model.Organization) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with Organization

use of com.odysseusinc.arachne.portal.model.Organization in project ArachneCentralAPI by OHDSI.

the class OrganizationController method create.

@ApiOperation("Create Organization")
@RequestMapping(value = "/api/v1/user-management/organizations", produces = APPLICATION_JSON_UTF8_VALUE, method = POST)
public OrganizationDTO create(@RequestBody OrganizationDTO organizationDTO) throws ValidationException {
    final Organization organization = conversionService.convert(organizationDTO, Organization.class);
    final Organization saved = organizationService.create(organization);
    return conversionService.convert(saved, OrganizationDTO.class);
}
Also used : Organization(com.odysseusinc.arachne.portal.model.Organization) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Organization (com.odysseusinc.arachne.portal.model.Organization)7 ApiOperation (io.swagger.annotations.ApiOperation)3 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 Transactional (org.springframework.transaction.annotation.Transactional)2 ValidationException (com.odysseusinc.arachne.portal.exception.ValidationException)1 PostAuthorize (org.springframework.security.access.prepost.PostAuthorize)1