Search in sources :

Example 1 with RegistryAdapter

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

the class GeoRegistryUtil method createHierarchyType.

@Authenticate
public static String createHierarchyType(String htJSON) {
    RegistryAdapter adapter = ServiceFactory.getAdapter();
    HierarchyType hierarchyType = HierarchyType.fromJSON(htJSON, adapter);
    ServiceFactory.getHierarchyPermissionService().enforceCanCreate(hierarchyType.getOrganizationCode());
    ServerHierarchyType sType = new ServerHierarchyTypeBuilder().createHierarchyType(hierarchyType);
    // The transaction did not error out, so it is safe to put into the cache.
    ServiceFactory.getMetadataCache().addHierarchyType(sType);
    return hierarchyType.getCode();
}
Also used : ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) HierarchyType(org.commongeoregistry.adapter.metadata.HierarchyType) ServerHierarchyTypeBuilder(net.geoprism.registry.conversion.ServerHierarchyTypeBuilder) RegistryAdapter(org.commongeoregistry.adapter.RegistryAdapter) Authenticate(com.runwaysdk.business.rbac.Authenticate)

Example 2 with RegistryAdapter

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

the class RemoveChildAction 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.remove.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 3 with RegistryAdapter

use of org.commongeoregistry.adapter.RegistryAdapter 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)

Aggregations

ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)3 RegistryAdapter (org.commongeoregistry.adapter.RegistryAdapter)3 HierarchyType (org.commongeoregistry.adapter.metadata.HierarchyType)3 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)2 MetadataCache (org.commongeoregistry.adapter.metadata.MetadataCache)2 Authenticate (com.runwaysdk.business.rbac.Authenticate)1 ServerHierarchyTypeBuilder (net.geoprism.registry.conversion.ServerHierarchyTypeBuilder)1