use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class RegistryService method createGeoObjectType.
/**
* Creates a {@link GeoObjectType} from the given JSON.
*
* @param sessionId
* @param gtJSON
* JSON of the {@link GeoObjectType} to be created.
* @return newly created {@link GeoObjectType}
*/
@Request(RequestType.SESSION)
public GeoObjectType createGeoObjectType(String sessionId, String gtJSON) {
ServerGeoObjectType type = null;
type = new ServerGeoObjectTypeConverter().create(gtJSON);
((Session) Session.getCurrentSession()).reloadPermissions();
// If this did not error out then add to the cache
ServiceFactory.getMetadataCache().addGeoObjectType(type);
NotificationFacade.queue(new GlobalNotificationMessage(MessageType.TYPE_CACHE_CHANGE, null));
return type.getType();
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class RegistryService method updateTerm.
/**
* Creates a new {@link Term} object and makes it a child of the term with the
* given code.
*
* @param sessionId
* @param parentTermCode
* TODO
* @param termJSON
* JSON of the term object.
* @return Updated {@link Term} object.
*/
@Request(RequestType.SESSION)
public Term updateTerm(String sessionId, String parentTermCode, String termJSON) {
JsonObject termJSONobj = JsonParser.parseString(termJSON).getAsJsonObject();
String termCode = termJSONobj.get(Term.JSON_CODE).getAsString();
LocalizedValue value = LocalizedValue.fromJSON(termJSONobj.get(Term.JSON_LOCALIZED_LABEL).getAsJsonObject());
Classifier classifier = TermConverter.updateClassifier(parentTermCode, termCode, value);
TermConverter termBuilder = new TermConverter(classifier.getKeyName());
Term returnTerm = termBuilder.build();
List<MdAttributeConcrete> mdAttrList = this.findRootClassifier(classifier);
this.refreshAttributeTermTypeInCache(mdAttrList);
return returnTerm;
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class RegistryService method getGeoObjectOverTime.
@Request(RequestType.SESSION)
public GeoObjectOverTime getGeoObjectOverTime(String sessionId, String id, String typeCode) {
ServerGeoObjectIF object = this.service.getGeoObject(id, typeCode);
if (object == null) {
net.geoprism.registry.DataNotFoundException ex = new net.geoprism.registry.DataNotFoundException();
ex.setTypeLabel(GeoObjectMetadata.get().getClassDisplayLabel());
ex.setDataIdentifier(id);
ex.setAttributeLabel(GeoObjectMetadata.get().getAttributeDisplayLabel(DefaultAttribute.UID.getName()));
throw ex;
}
ServiceFactory.getGeoObjectPermissionService().enforceCanRead(object.getType().getOrganization().getCode(), object.getType());
return object.toGeoObjectOverTime();
}
use of com.runwaysdk.session.Request 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 com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class RegistryService method updateAttributeType.
/**
* Updates an attribute in the given {@link GeoObjectType}.
*
* @pre given {@link GeoObjectType} must already exist.
*
* @param sessionId
* @param geoObjectTypeCode
* string of the {@link GeoObjectType} to be updated.
* @param attributeTypeJSON
* AttributeType to be added to the GeoObjectType
* @return updated {@link AttributeType}
*/
@Request(RequestType.SESSION)
public AttributeType updateAttributeType(String sessionId, String geoObjectTypeCode, String attributeTypeJSON) {
ServerGeoObjectType got = ServerGeoObjectType.get(geoObjectTypeCode);
ServiceFactory.getGeoObjectTypePermissionService().enforceCanWrite(got.getOrganization().getCode(), got, got.getIsPrivate());
AttributeType attrType = got.updateAttributeType(attributeTypeJSON);
return attrType;
}
Aggregations