use of net.geoprism.registry.conversion.OrganizationConverter in project geoprism-registry by terraframe.
the class RegistryService method updateOrganization.
/**
* Updates the given {@link OrganizationDTO} represented as JSON.
*
* @pre given {@link OrganizationDTO} must already exist.
*
* @param sessionId
* @param json
* JSON of the {@link OrganizationDTO} to be updated.
* @return updated {@link OrganizationDTO}
*/
@Request(RequestType.SESSION)
public OrganizationDTO updateOrganization(String sessionId, String json) {
OrganizationDTO organizationDTO = OrganizationDTO.fromJSON(json);
final Organization org = new OrganizationConverter().update(organizationDTO);
// If this did not error out then add to the cache
ServiceFactory.getMetadataCache().addOrganization(org);
return ServiceFactory.getAdapter().getMetadataCache().getOrganization(org.getCode()).get();
}
use of net.geoprism.registry.conversion.OrganizationConverter in project geoprism-registry by terraframe.
the class RegistryService method createOrganization.
/**
* Creates a {@link OrganizationDTO} from the given JSON.
*
* @param sessionId
* @param json
* JSON of the {@link OrganizationDTO} to be created.
* @return newly created {@link OrganizationDTO}
*/
@Request(RequestType.SESSION)
public OrganizationDTO createOrganization(String sessionId, String json) {
OrganizationDTO organizationDTO = OrganizationDTO.fromJSON(json);
final Organization org = new OrganizationConverter().create(organizationDTO);
// If this did not error out then add to the cache
ServiceFactory.getMetadataCache().addOrganization(org);
return ServiceFactory.getAdapter().getMetadataCache().getOrganization(org.getCode()).get();
}
Aggregations