Exemplo n.º 1
0
 public static bool CanAcceptActivityAndActivityAsSourceAndTarget(Activity source, Activity target)
 {
     if (source is Stop)
     {
         return false;
     }
     else if (source == target)
     {
         return false;
     }
     else
     {
         return source.TargetActs.Count == 0;
     }
 }
Exemplo n.º 2
0
 public static bool CanAcceptActivityAsTarget(Activity candidate)
 {
     return true;
 }
Exemplo n.º 3
0
 public static bool CanAcceptActivityAsSource(Activity candidate)
 {
     return candidate.TargetActs.Count == 0;
 }
Exemplo n.º 4
0
 private static bool CanAcceptWorkflowRuleAndActivityAsSourceAndTarget(WorkflowRule source, Activity target)
 {
     return true;
 }
Exemplo n.º 5
0
		private static void WriteChildElements(DslModeling::SerializationContext serializationContext, Activity element, global::System.Xml.XmlWriter writer)
		{
			// FlowBase
			global::System.Collections.ObjectModel.ReadOnlyCollection<FlowBase> allFlowBaseInstances = FlowBase.GetLinksToTargetActs(element);
			if (!serializationContext.Result.Failed && allFlowBaseInstances.Count > 0)
			{
				writer.WriteStartElement("targetActs");
				foreach (FlowBase eachFlowBaseInstance in allFlowBaseInstances)
				{
					if (serializationContext.Result.Failed)
						break;
	
					DslModeling::DomainClassXmlSerializer relSerializer = serializationContext.Directory.GetSerializer(eachFlowBaseInstance.GetDomainClass().Id);
					global::System.Diagnostics.Debug.Assert(relSerializer != null, "Cannot find serializer for " + eachFlowBaseInstance.GetDomainClass().Name + "!");
					relSerializer.Write(serializationContext, eachFlowBaseInstance, writer);
				}
				writer.WriteEndElement();
			}
	
		}
Exemplo n.º 6
0
		private static void ReadFlowBaseInstances(DslModeling::SerializationContext serializationContext, Activity element, global::System.Xml.XmlReader reader)
		{
			while (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
			{
				DslModeling::DomainClassXmlSerializer newFlowBaseSerializer = serializationContext.Directory.GetSerializer(FlowBase.DomainClassId);
				global::System.Diagnostics.Debug.Assert(newFlowBaseSerializer != null, "Cannot find serializer for FlowBase!");
				FlowBase newFlowBase = newFlowBaseSerializer.TryCreateInstance (serializationContext, reader, element.Partition) as FlowBase;
				if (newFlowBase != null)
				{
					DslModeling::DomainRoleInfo.SetRolePlayer (newFlowBase, FlowBase.SourceActivityDomainRoleId, element);
					DslModeling::DomainClassXmlSerializer targetSerializer = serializationContext.Directory.GetSerializer (newFlowBase.GetDomainClass().Id);	
					global::System.Diagnostics.Debug.Assert (targetSerializer != null, "Cannot find serializer for " + newFlowBase.GetDomainClass().Name + "!");
					targetSerializer.Read(serializationContext, newFlowBase, reader);
				}
				else
				{	// Maybe the relationship is serialized in short-form by mistake.
					DslModeling::DomainClassXmlSerializer newActivityMonikerOfFlowBaseSerializer = serializationContext.Directory.GetSerializer(Activity.DomainClassId);
					global::System.Diagnostics.Debug.Assert(newActivityMonikerOfFlowBaseSerializer != null, "Cannot find serializer for Activity!");
					DslModeling::Moniker newActivityMonikerOfFlowBase = newActivityMonikerOfFlowBaseSerializer.TryCreateMonikerInstance(serializationContext, reader, element, FlowBase.DomainClassId, element.Partition);
					if (newActivityMonikerOfFlowBase != null)
					{
						CloudCoreArchitectSubProcessSerializationBehaviorSerializationMessages.ExpectingFullFormRelationship(serializationContext, reader, typeof(FlowBase));
						new FlowBase(element.Partition, new DslModeling::RoleAssignment(FlowBase.SourceActivityDomainRoleId, element), new DslModeling::RoleAssignment(FlowBase.TargetActivityDomainRoleId, newActivityMonikerOfFlowBase));
						DslModeling::SerializationUtilities.Skip(reader);	// Moniker contains no child XML elements, so just skip.
					}
					else
					{	// Unknown element, skip.
						DslModeling::SerializationUtilities.Skip(reader);
					}
				}
			}
		}
Exemplo n.º 7
0
		/// <summary>
		/// This method deserializes all child model elements.
		/// </summary>
		/// <remarks>
		/// The caller will position the reader at the open tag of the first child XML element to deserialized.
		/// This method will read as many child elements as it can. It returns under three circumstances:
		/// 1) When an unknown child XML element is encountered. In this case, this method will position the reader at the 
		///    open tag of the unknown element. This implies that if the first child XML element is unknown, this method 
		///    should return immediately and do nothing.
		/// 2) When all child XML elemnets are read. In this case, the reader will be positioned at the end tag of the parent element.
		/// 3) EOF.
		/// </remarks>
		/// <param name="serializationContext">Serialization context.</param>
		/// <param name="reader">XmlReader to read serialized data from.</param>
		/// <param name="element">In-memory Activity instance that will get the deserialized data.</param>
		private static void ReadChildElements(DslModeling::SerializationContext serializationContext, Activity element, global::System.Xml.XmlReader reader)
		{
			if (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
			{
				if (string.Compare(reader.LocalName, "targetActs", global::System.StringComparison.CurrentCulture) == 0)
				{
					if (reader.IsEmptyElement)
					{	// No instance of this relationship, just skip
						DslModeling::SerializationUtilities.Skip(reader);
					}
					else
					{
						DslModeling::SerializationUtilities.SkipToFirstChild(reader);  // Skip the open tag of <targetActs>
						ReadFlowBaseInstances(serializationContext, element, reader);
						DslModeling::SerializationUtilities.Skip(reader);  // Skip the close tag of </targetActs>
					}
				}
			}
		}