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();
}
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;
}
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;
}
Aggregations