use of net.geoprism.registry.model.ServerElement in project geoprism-registry by terraframe.
the class XMLImporter method importXMLDefinitions.
@Transaction
public List<ServerElement> importXMLDefinitions(Organization organization, InputStream istream) {
TransactionState state = TransactionState.getCurrentTransactionState();
state.putTransactionObject("transaction-state", this.cache);
LinkedList<ServerElement> list = new LinkedList<ServerElement>();
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = factory.newDocumentBuilder();
Document doc = dBuilder.parse(istream);
list.addAll(this.createTypes(organization, doc));
list.addAll(this.createHierarchies(organization, doc));
list.addAll(this.createDirectedAcyclicGraphTypes(doc));
list.addAll(this.createUndirectedGraphTypes(doc));
} catch (ParserConfigurationException | IOException | SAXException e) {
throw new ProgrammingErrorException(e);
}
return list;
}
use of net.geoprism.registry.model.ServerElement in project geoprism-registry by terraframe.
the class XMLImporter method createUndirectedGraphTypes.
private List<ServerElement> createUndirectedGraphTypes(Document doc) {
LinkedList<ServerElement> list = new LinkedList<ServerElement>();
NodeList nList = doc.getElementsByTagName("undirected-graph");
for (int i = 0; i < nList.getLength(); i++) {
Node nNode = nList.item(i);
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element elem = (Element) nNode;
list.add(this.createUndirectedGraphType(elem));
}
}
return list;
}
use of net.geoprism.registry.model.ServerElement in project geoprism-registry by terraframe.
the class XMLImporter method createDirectedAcyclicGraphTypes.
private List<ServerElement> createDirectedAcyclicGraphTypes(Document doc) {
LinkedList<ServerElement> list = new LinkedList<ServerElement>();
NodeList nList = doc.getElementsByTagName("dag");
for (int i = 0; i < nList.getLength(); i++) {
Node nNode = nList.item(i);
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element elem = (Element) nNode;
list.add(this.createDirectedAcyclicGraphType(elem));
}
}
return list;
}
use of net.geoprism.registry.model.ServerElement 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;
}
use of net.geoprism.registry.model.ServerElement in project geoprism-registry by terraframe.
the class XMLImporter method createTypes.
private List<ServerElement> createTypes(Organization organization, Document doc) {
LinkedList<ServerElement> list = new LinkedList<ServerElement>();
NodeList nList = doc.getElementsByTagName("type");
for (int i = 0; i < nList.getLength(); i++) {
Node nNode = nList.item(i);
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element elem = (Element) nNode;
ServerGeoObjectType type = createServerGeoObjectType(organization, elem);
list.add(type);
this.cache.put(type.getCode(), type);
this.addAttributes(elem, type);
list.addAll(this.addGroupItems(elem, type));
}
}
return list;
}
Aggregations