/// <summary> /// Creates the sub node load for node edge row. /// </summary> /// <param name="node">The node.</param> /// <param name="edge">The edge.</param> /// <param name="row">The row.</param> protected override void CreateSubNodeLoadForNodeEdgeRow(UPMCoINode node, UPMCoIEdge edge, UPCRMResultRow row) { this.vistedNodes[node.Identifier] = node; this.nodeConfigMapping.SetObjectForKey(this.childrenTreeConfig, node.Identifier); this.RootNode.AddChildNodeChildRelation(node, edge); this.ChangedIdentifiers.Add(node.Identifier); }
/// <summary> /// Switches to edit. /// </summary> /// <param name="edge">The edge.</param> public override void SwitchToEdit(UPMCoIEdge edge) { string edgeRecordIdentification = ((RecordIdentifier)edge.Identifier).RecordIdentification; string trgtNodeRecordIdentification = ((RecordIdentifier)edge.TargetNodeIdentifier).RecordIdentification; CoITreeInfoAreaConfig infoAreaConfig = this.recordIdentifierInfoAreaConfigMapping[trgtNodeRecordIdentification]; string editAction = infoAreaConfig.Definition.ValueOrDefault("EdgeEditAction") as string; editAction = !string.IsNullOrEmpty(editAction) ? editAction : "EDITRECORD"; this.SwitchToRecord(edgeRecordIdentification, editAction, false, true, null); }
protected override void CreateSubNodeLoadForNodeEdgeRow(UPMCoINode node, UPMCoIEdge edge, UPCRMResultRow row) { this.vistedNodes.SetObjectForKey(node, node.Identifier); this.RootNode.AddChildNodeChildRelation(node, edge); this.ChangedIdentifiers.Add(node.Identifier); if (this.depth < this.maxDepth) { this.pendingCount++; CoINodeLoader loader = new CoINodeLoader(node, this.viewReference, this.depth + 1, -1, this.vistedNodes); loader.Mode = CoINodeLoaderMode.SubNodeLoader; loader.fiResultColumnIndex = this.fiResultColumnIndex; loader.kpResultColumnIndex = this.kpResultColumnIndex; this.subNodeLoader.Add(loader); loader.TheDelegate = this; } }
/// <summary> /// Creates the edge from result row. /// </summary> /// <param name="row">The row.</param> /// <param name="infoAreaSuffix">The information area suffix.</param> /// <param name="srcNode">The source node.</param> /// <param name="dstNode">The DST node.</param> /// <returns></returns> public static UPMCoIEdge CreateEdgeFromResultRow(UPCRMResultRow row, string infoAreaSuffix, UPMCoINode srcNode, UPMCoINode dstNode) { string nodeInfoAreaSuffix = infoAreaSuffix ?? string.Empty; string listFieldFunctionName = $"listField{nodeInfoAreaSuffix}"; UPMCoIEdge edge = new UPMCoIEdge(new RecordIdentifier(row.RootRecordIdentification)) { TargetNodeIdentifier = dstNode.Identifier, SrcNodeIdentifier = srcNode.Identifier }; List <UPMStringField> listFields = FieldsForResultRow(row, listFieldFunctionName, 1, true); if (listFields.Count > 0) { edge.ListFields = listFields; } return(edge); }
/// <summary> /// Nodes are loaded succesfull. /// </summary> /// <param name="nodeloader">The nodeloader.</param> public override void NodesLoadedSuccesfull(CoIBaseNodeLoader nodeloader) { if (this.tmpGroupNode != null && this.tmpGroupNode.ChildCount > 0) { this.vistedNodes.SetObjectForKey(this.tmpGroupNode, this.tmpGroupNode.Identifier); this.nodeConfigMapping.SetObjectForKey(this.childrenTreeConfig, this.tmpGroupNode.Identifier); // Create Edge UPMCoIEdge edge = new UPMCoIEdge(StringIdentifier.IdentifierWithStringId($"Edge {this.childrenTreeConfig.SearchAndListName}")); edge.ListFields = this.tmpGroupNode.Fields; this.RootNode.AddChildNodeChildRelation(this.tmpGroupNode, edge); this.RootNode.AddAllRelationToRelation(this.tmpGroupNode, edge); this.ChangedIdentifiers.Add(this.tmpGroupNode.Identifier); this.tmpGroupNode = null; } this.RootNode.ChildsLoaded = true; base.NodesLoadedSuccesfull(nodeloader); }
/// <summary> /// Creates the edge from result row source node DST node. /// </summary> /// <param name="row">The row.</param> /// <param name="srcNode">The source node.</param> /// <param name="dstNode">The DST node.</param> /// <returns></returns> protected override UPMCoIEdge CreateEdgeFromResultRow(UPCRMResultRow row, UPMCoINode srcNode, UPMCoINode dstNode) { string trgtNodeFieldSuffix = string.Empty; if (this.infoAreaConfigs != null) { foreach (CoITreeInfoAreaConfig infoAreaConfig in this.infoAreaConfigs) { string linkRecordIdentifictaion = row.RecordIdentificationForLinkInfoAreaIdLinkId(infoAreaConfig.InfoAreaId, infoAreaConfig.LinkId); if (!string.IsNullOrEmpty(linkRecordIdentifictaion.RecordId())) { trgtNodeFieldSuffix = infoAreaConfig.FunctionNameSuffix; break; } } } UPMCoIEdge edge = CreateEdgeFromResultRow(row, trgtNodeFieldSuffix, srcNode, dstNode); return(edge); }
/// <summary> /// Creates the edge from result row source node DST node. /// </summary> /// <param name="row">The row.</param> /// <param name="srcNode">The source node.</param> /// <param name="dstNode">The DST node.</param> /// <returns></returns> protected override UPMCoIEdge CreateEdgeFromResultRow(UPCRMResultRow row, UPMCoINode srcNode, UPMCoINode dstNode) { UPMCoIEdge edge = CreateEdgeFromResultRow(row, this.PhysicalInfoArea(row), srcNode, dstNode); return(edge); }
/// <summary> /// Creates the sub node load for node edge row. /// </summary> /// <param name="node">The node.</param> /// <param name="edge">The edge.</param> /// <param name="row">The row.</param> protected virtual void CreateSubNodeLoadForNodeEdgeRow(UPMCoINode node, UPMCoIEdge edge, UPCRMResultRow row) { // Override }
private void AddNodesFromResult(UPCRMResult result) { for (int index = 0; index < result.RowCount; index++) { UPCRMResultRow row = (UPCRMResultRow)result.ResultRowAtIndex(index); UPMCoINode relationNode = this.CreateNodeFromResultRow(row); if (relationNode != null) { relationNode.OnlineData = !row.HasLocalCopy; relationNode.Parent = this.RootNode; UPMCoIEdge edge = this.CreateEdgeFromResultRow(row, this.RootNode, relationNode); List <UPMStringField> relationNameList = FieldsForResultRow(row, "relationName", 0, true); List <UPMStringField> relationIntensityList = FieldsForResultRow(row, "relationIntensity", 0, true); // Only one relatioName ist supported if (relationNameList.Count > 0) { edge.RelationName = relationNameList[0]; } if (relationIntensityList.Count > 0) { UPMStringField field = relationIntensityList[0]; if (!string.IsNullOrEmpty(field.StringValue)) { edge.RelationIntensity = Convert.ToInt32(field.StringValue); } } // Node allready added? UPMCoINode vistedNode = this.vistedNodes.ValueOrDefault(relationNode.Identifier); bool additionalRealtion = false; if (vistedNode != null) { this.RootNode.AddAllRelationToRelation(vistedNode, edge); // handle double nodes // Bedingung if (relationNode.Parent.Identifier.MatchesIdentifier(vistedNode.Parent?.Identifier) || this.RootNode?.Parent?.Identifier?.MatchesIdentifier(vistedNode.Identifier) == true) { // Same Relation ignore continue; } if (vistedNode.Parent == null) { // No Addtional Relations or Back relations to root node continue; } if (relationNode.Parent.Identifier.MatchesIdentifier(relationNode.Identifier)) { // Self relation ignore continue; } additionalRealtion = true; // Check Additional Relation allready Added? for (int index2 = 0; index2 < this.RootNode.AdditionalRelationsCount; index2++) { UPMCoINode addRelationNode = this.RootNode.AdditionalRelationNodeAtIndex(index2); if (addRelationNode.Identifier.MatchesIdentifier(vistedNode.Identifier)) { additionalRealtion = false; } } if (!additionalRealtion) { continue; } } else { this.RootNode.AddAllRelationToRelation(relationNode, edge); } if (additionalRealtion) { this.RootNode.AddAdditionalRelationToRelation(vistedNode, edge); this.ChangedIdentifiers.Add(this.RootNode.Identifier); } else { this.CreateSubNodeLoadForNodeEdgeRow(relationNode, edge, row); } } } if (this.subNodeLoader.Count == 0) { this.ChangedIdentifiers.Add(this.RootNode.Identifier); this.TheDelegate.NodesLoadedSuccesfull(this); } foreach (CoIBaseNodeLoader loaderItem in this.subNodeLoader) { loaderItem.LoadNodeSubNodes(); } }
/// <summary> /// Switches to edit. /// </summary> /// <param name="edge">The edge.</param> public virtual void SwitchToEdit(UPMCoIEdge edge) { this.SwitchToRecord(((RecordIdentifier)edge.Identifier).RecordIdentification, "EDITRECORD", false, true, null); }