private void _recurseTree(ICswNbtTree results, CswNbtAPITree.CswNbtTreeResource Parent) { for (int i = 0; i < results.getChildNodeCount(); i++) { results.goToNthChild(i); CswNbtNodeKey NodeKey = results.getNodeKeyForCurrentPosition(); string Name = results.getNodeNameForCurrentPosition(); CswNbtMetaDataNodeType nt = _CswNbtResources.MetaData.getNodeType(NodeKey.NodeTypeId); CswNbtMetaDataObjectClass oc = nt.getObjectClass(); CswNbtMetaDataPropertySet propSet = oc.getPropertySet(); string PropSetName = string.Empty; if (null != propSet) { PropSetName = propSet.Name; } CswNbtAPITree.CswNbtTreeResource SubParent = Parent.Add(Name, NodeKey.NodeId, nt.NodeTypeName, oc.ObjectClassName, PropSetName, string.Empty); _recurseTree(results, SubParent); results.goToParentNode(); } }
public void RunTree(CswNbtAPITree Return, int ViewIdInt) { try { CswNbtViewId ViewId = new CswNbtViewId(ViewIdInt); CswNbtView View = _CswNbtResources.ViewSelect.restoreView(ViewId); if (null != View) { ICswNbtTree results = _CswNbtResources.Trees.getTreeFromView(View, true, false, false); for (int i = 0; i < results.getChildNodeCount(); i++) { results.goToNthChild(i); CswNbtNodeKey NodeKey = results.getNodeKeyForCurrentPosition(); string Name = results.getNodeNameForCurrentPosition(); CswNbtMetaDataNodeType nt = _CswNbtResources.MetaData.getNodeType(NodeKey.NodeTypeId); CswNbtMetaDataObjectClass oc = nt.getObjectClass(); CswNbtMetaDataPropertySet propSet = oc.getPropertySet(); string PropSetName = string.Empty; if (null != propSet) { PropSetName = propSet.Name; } CswNbtAPITree.CswNbtTreeResource Parent = Return.Add(Name, NodeKey.NodeId, nt.NodeTypeName, oc.ObjectClassName, PropSetName, BuildURI(nt.NodeTypeName, NodeKey.NodeId.PrimaryKey)); _recurseTree(results, Parent); results.goToParentNode(); } Return.Status = HttpStatusCode.OK; } else { Return.Status = HttpStatusCode.NotFound; } } catch (Exception) { Return.Status = HttpStatusCode.InternalServerError; } }