Search in sources :

Example 21 with HierarchyType

use of org.commongeoregistry.adapter.metadata.HierarchyType in project geoprism-registry by terraframe.

the class AddChildAction method getMessage.

@Override
protected String getMessage() {
    RegistryAdapter adapter = ServiceFactory.getAdapter();
    MetadataCache cache = adapter.getMetadataCache();
    ServerGeoObjectType parentType = ServerGeoObjectType.get(this.getParentTypeCode());
    ServerGeoObjectType childType = ServerGeoObjectType.get(this.getChildTypeCode());
    HierarchyType hierarchyType = cache.getHierachyType(this.getHierarchyTypeCode()).get();
    String message = LocalizationFacade.getFromBundles("change.request.email.add.child");
    message = message.replaceAll("\\{0\\}", this.getChildId());
    message = message.replaceAll("\\{1\\}", childType.getLabel().getValue(Session.getCurrentLocale()));
    message = message.replaceAll("\\{2\\}", this.getParentId());
    message = message.replaceAll("\\{3\\}", parentType.getLabel().getValue(Session.getCurrentLocale()));
    message = message.replaceAll("\\{4\\}", hierarchyType.getLabel().getValue(Session.getCurrentLocale()));
    return message;
}
Also used : ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) HierarchyType(org.commongeoregistry.adapter.metadata.HierarchyType) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) MetadataCache(org.commongeoregistry.adapter.metadata.MetadataCache) RegistryAdapter(org.commongeoregistry.adapter.RegistryAdapter)

Example 22 with HierarchyType

use of org.commongeoregistry.adapter.metadata.HierarchyType in project geoprism-registry by terraframe.

the class HierarchyController method insertBetweenTypes.

/**
 * Inserts the {@link GeoObjectType} 'middleGeoObjectTypeCode' into the
 * hierarchy as the child of 'parentGeoObjectTypeCode' and the new parent for
 * 'youngestGeoObjectTypeCode'. If an existing parent/child relationship
 * already exists between 'youngestGeoObjectTypeCode' and
 * 'parentgeoObjectTypeCode', it will first be removed.
 *
 * @param sessionId
 * @param hierarchyTypeCode
 *          code of the {@link HierarchyType}
 * @param parentGeoObjectTypeCode
 *          parent {@link GeoObjectType}.
 * @param middleGeoObjectTypeCode
 *          middle child {@link GeoObjectType} after this method returns
 * @param youngestGeoObjectTypeCode
 *          youngest child {@link GeoObjectType} after this method returns
 */
@Endpoint(method = ServletMethod.GET, error = ErrorSerialization.JSON, url = "insertBetweenTypes")
public ResponseIF insertBetweenTypes(ClientRequestIF request, @RequestParamter(name = "hierarchyCode", required = true) String hierarchyCode, @RequestParamter(name = "parentGeoObjectTypeCode", required = true) String parentGeoObjectTypeCode, @RequestParamter(name = "middleGeoObjectTypeCode", required = true) String middleGeoObjectTypeCode, @RequestParamter(name = "youngestGeoObjectTypeCode", required = true) String youngestGeoObjectTypeCode) {
    HierarchyType ht = ServiceFactory.getHierarchyService().insertBetweenTypes(request.getSessionId(), hierarchyCode, parentGeoObjectTypeCode, middleGeoObjectTypeCode, youngestGeoObjectTypeCode);
    CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
    return new RestBodyResponse(ht.toJSON(serializer));
}
Also used : HierarchyType(org.commongeoregistry.adapter.metadata.HierarchyType) CustomSerializer(org.commongeoregistry.adapter.metadata.CustomSerializer) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 23 with HierarchyType

use of org.commongeoregistry.adapter.metadata.HierarchyType in project geoprism-registry by terraframe.

the class HierarchyController method addToHierarchy.

/**
 * Adds the {@link GeoObjectType} with the given child code to the parent
 * {@link GeoObjectType} with the given code for the given
 * {@link HierarchyType} code.
 *
 * @param sessionId
 * @param hierarchyCode
 *          code of the {@link HierarchyType} the child is being added to.
 * @param parentGeoObjectTypeCode
 *          parent {@link GeoObjectType}.
 * @param childGeoObjectTypeCode
 *          child {@link GeoObjectType}.
 */
@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON, url = "add")
public ResponseIF addToHierarchy(ClientRequestIF request, @RequestParamter(name = "hierarchyCode", required = true) String hierarchyCode, @RequestParamter(name = "parentGeoObjectTypeCode", required = true) String parentGeoObjectTypeCode, @RequestParamter(name = "childGeoObjectTypeCode", required = true) String childGeoObjectTypeCode) {
    HierarchyType ht = ServiceFactory.getHierarchyService().addToHierarchy(request.getSessionId(), hierarchyCode, parentGeoObjectTypeCode, childGeoObjectTypeCode);
    CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
    return new RestBodyResponse(ht.toJSON(serializer));
}
Also used : HierarchyType(org.commongeoregistry.adapter.metadata.HierarchyType) CustomSerializer(org.commongeoregistry.adapter.metadata.CustomSerializer) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 24 with HierarchyType

use of org.commongeoregistry.adapter.metadata.HierarchyType in project geoprism-registry by terraframe.

the class HierarchyController method removeInheritedHierarchy.

/**
 * Modifies a hierarchy to remove inheritance from another hierarchy for the
 * given root
 *
 * @param sessionId
 * @param hierarchyTypeCode
 *          code of the {@link HierarchyType} being modified.
 * @param geoObjectTypeCode
 *          code of the root {@link GeoObjectType}.
 */
@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON, url = "removeInherited")
public ResponseIF removeInheritedHierarchy(ClientRequestIF request, @RequestParamter(name = "hierarchyTypeCode", required = true) String hierarchyTypeCode, @RequestParamter(name = "geoObjectTypeCode", required = true) String geoObjectTypeCode) {
    HierarchyType ht = ServiceFactory.getHierarchyService().removeInheritedHierarchy(request.getSessionId(), hierarchyTypeCode, geoObjectTypeCode);
    CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
    return new RestBodyResponse(ht.toJSON(serializer));
}
Also used : HierarchyType(org.commongeoregistry.adapter.metadata.HierarchyType) CustomSerializer(org.commongeoregistry.adapter.metadata.CustomSerializer) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 25 with HierarchyType

use of org.commongeoregistry.adapter.metadata.HierarchyType in project geoprism-registry by terraframe.

the class HierarchyController method removeFromHierarchy.

/**
 * Removes the {@link GeoObjectType} with the given child code from the parent
 * {@link GeoObjectType} with the given code for the given
 * {@link HierarchyType} code.
 *
 * @param sessionId
 * @param hierarchyCode
 *          code of the {@link HierarchyType} the child is being added to.
 * @param parentGeoObjectTypeCode
 *          parent {@link GeoObjectType}.
 * @param childGeoObjectTypeCode
 *          child {@link GeoObjectType}.
 */
@Endpoint(method = ServletMethod.GET, error = ErrorSerialization.JSON, url = "remove")
public ResponseIF removeFromHierarchy(ClientRequestIF request, @RequestParamter(name = "hierarchyCode", required = true) String hierarchyCode, @RequestParamter(name = "parentGeoObjectTypeCode", required = true) String parentGeoObjectTypeCode, @RequestParamter(name = "childGeoObjectTypeCode", required = true) String childGeoObjectTypeCode) {
    HierarchyType ht = ServiceFactory.getHierarchyService().removeFromHierarchy(request.getSessionId(), hierarchyCode, parentGeoObjectTypeCode, childGeoObjectTypeCode, true);
    CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
    return new RestBodyResponse(ht.toJSON(serializer));
}
Also used : HierarchyType(org.commongeoregistry.adapter.metadata.HierarchyType) CustomSerializer(org.commongeoregistry.adapter.metadata.CustomSerializer) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Endpoint(com.runwaysdk.mvc.Endpoint)

Aggregations

HierarchyType (org.commongeoregistry.adapter.metadata.HierarchyType)40 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)21 CustomSerializer (org.commongeoregistry.adapter.metadata.CustomSerializer)12 Endpoint (com.runwaysdk.mvc.Endpoint)11 RestBodyResponse (com.runwaysdk.mvc.RestBodyResponse)11 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)10 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)9 Test (org.junit.Test)9 JsonArray (com.google.gson.JsonArray)6 Request (com.runwaysdk.session.Request)6 JsonObject (com.google.gson.JsonObject)5 GeoObjectType (org.commongeoregistry.adapter.metadata.GeoObjectType)5 HierarchyNode (org.commongeoregistry.adapter.metadata.HierarchyNode)4 List (java.util.List)3 ServerHierarchyTypeBuilder (net.geoprism.registry.conversion.ServerHierarchyTypeBuilder)3 GeoObjectRelationshipPermissionServiceIF (net.geoprism.registry.permission.GeoObjectRelationshipPermissionServiceIF)3 TestUserInfo (net.geoprism.registry.test.TestUserInfo)3 SmartExceptionDTO (com.runwaysdk.business.SmartExceptionDTO)2 MdAttributeCharacterDAO (com.runwaysdk.dataaccess.metadata.MdAttributeCharacterDAO)2 MdAttributeUUIDDAO (com.runwaysdk.dataaccess.metadata.MdAttributeUUIDDAO)2