use of net.geoprism.registry.conversion.ServerGeoObjectTypeConverter in project geoprism-registry by terraframe.
the class XMLImporter method createServerGeoObjectType.
private ServerGeoObjectType createServerGeoObjectType(Organization organization, Element elem) {
String code = elem.getAttribute("code");
LocalizedValue label = this.getLabel(elem);
LocalizedValue description = this.getDescription(elem);
String visibility = elem.getAttribute("visibility");
GeometryType geometryType = this.getGeometryType(elem);
boolean isGeometryEditable = this.getIsGeometryEditable(elem);
boolean isAbstract = this.getIsGroup(elem) || (elem.getElementsByTagName("group-item").getLength() > 0);
GeoObjectType type = new GeoObjectType(code, geometryType, label, description, isGeometryEditable, organization.getCode(), adapter);
type.setIsPrivate(this.getIsPrivate(visibility));
type.setIsAbstract(isAbstract);
ServiceFactory.getGeoObjectTypePermissionService().enforceCanCreate(organization.getCode(), type.getIsPrivate());
return new ServerGeoObjectTypeConverter().create(type);
}
use of net.geoprism.registry.conversion.ServerGeoObjectTypeConverter in project geoprism-registry by terraframe.
the class TestGeoObjectTypeInfo method getServerObject.
public ServerGeoObjectType getServerObject(boolean forceFetch) {
if (this.serverObject != null && !forceFetch) {
return this.serverObject;
} else {
Optional<ServerGeoObjectType> got = ServiceFactory.getMetadataCache().getGeoObjectType(code);
if (got.isPresent()) {
this.serverObject = got.get();
return this.serverObject;
} else {
Universal uni = TestDataSet.getUniversalIfExist(getCode());
if (uni == null) {
return null;
}
this.serverObject = new ServerGeoObjectTypeConverter().build(uni);
return this.serverObject;
}
}
}
use of net.geoprism.registry.conversion.ServerGeoObjectTypeConverter in project geoprism-registry by terraframe.
the class ServerGeoObjectType method update.
public void update(GeoObjectType geoObjectTypeNew) {
GeoObjectType geoObjectTypeModified = this.type.copy(geoObjectTypeNew);
Universal universal = updateGeoObjectType(geoObjectTypeModified);
ServerGeoObjectType geoObjectTypeModifiedApplied = new ServerGeoObjectTypeConverter().build(universal);
// If this did not error out then add to the cache
ServiceFactory.getMetadataCache().refreshGeoObjectType(geoObjectTypeModifiedApplied);
// isPrivate). We should refresh them as well.
if (geoObjectTypeModifiedApplied.getIsAbstract()) {
List<ServerGeoObjectType> subtypes = geoObjectTypeModifiedApplied.getSubtypes();
for (ServerGeoObjectType subtype : subtypes) {
ServerGeoObjectType refreshedSubtype = new ServerGeoObjectTypeConverter().build(subtype.getUniversal());
ServiceFactory.getMetadataCache().refreshGeoObjectType(refreshedSubtype);
}
}
this.type = geoObjectTypeModifiedApplied.getType();
this.universal = geoObjectTypeModifiedApplied.getUniversal();
this.mdBusiness = geoObjectTypeModifiedApplied.getMdBusiness();
}
use of net.geoprism.registry.conversion.ServerGeoObjectTypeConverter in project geoprism-registry by terraframe.
the class ServerGeoObjectType method refreshCache.
private void refreshCache() {
ServiceFactory.getMetadataCache().addGeoObjectType(this);
// Refresh all of the subtypes
List<ServerGeoObjectType> subtypes = this.getSubtypes();
for (ServerGeoObjectType subtype : subtypes) {
ServerGeoObjectType type = new ServerGeoObjectTypeConverter().build(subtype.getUniversal());
ServiceFactory.getMetadataCache().addGeoObjectType(type);
}
}
use of net.geoprism.registry.conversion.ServerGeoObjectTypeConverter in project geoprism-registry by terraframe.
the class XMLImporter method addGroupItems.
private List<ServerElement> addGroupItems(Element root, ServerGeoObjectType superType) {
List<ServerElement> list = new LinkedList<ServerElement>();
NodeList nList = root.getElementsByTagName("group-item");
for (int i = 0; i < nList.getLength(); i++) {
Node nNode = nList.item(i);
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element elem = (Element) nNode;
String code = elem.getAttribute("code");
LocalizedValue label = this.getLabel(elem);
LocalizedValue description = this.getDescription(elem);
GeoObjectType type = new GeoObjectType(code, superType.getGeometryType(), label, description, superType.isGeometryEditable(), superType.getOrganization().getCode(), adapter);
type.setSuperTypeCode(superType.getCode());
type.setIsPrivate(superType.getIsPrivate());
ServerGeoObjectType result = new ServerGeoObjectTypeConverter().create(type);
list.add(result);
this.cache.put(code, result);
}
}
return list;
}
Aggregations