public virtual void Initialize()
 {
     this.store.TransactionManager.DoWithinTransaction(() =>
     {
         this.tool = this.store.ElementFactory.CreateElement<ProductionTool>();
     });
 }
 public virtual void Initialize()
 {
     this.store.TransactionManager.DoWithinTransaction(() =>
     {
         this.tool = this.store.ElementFactory.CreateElement<ProductionTool>();
     });
     validationContext = new ValidationContext(ValidationCategories.Save, this.tool);
 }
		/// <summary>
		/// Constructor
		/// Creates a SuppliedAssetSuppliesProductionTools link in the same Partition as the given SuppliedAsset
		/// </summary>
		/// <param name="source">SuppliedAsset to use as the source of the relationship.</param>
		/// <param name="target">ProductionTool to use as the target of the relationship.</param>
		internal SuppliedAssetSuppliesProductionTools(SuppliedAsset source, ProductionTool target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(SuppliedAssetSuppliesProductionTools.SuppliedAssetDomainRoleId, source), new DslModeling::RoleAssignment(SuppliedAssetSuppliesProductionTools.ProductionToolDomainRoleId, target)}, null)
		{
		}
		internal static DslModeling::LinkedElementCollection<ProducedAsset> GetSuppliedProducedAssets(ProductionTool element)
		{
			return GetRoleCollection<DslModeling::LinkedElementCollection<ProducedAsset>, ProducedAsset>(element, ProductionToolDomainRoleId);
		}
		/// <summary>
		/// Constructor
		/// Creates a ProductionToolReferencesVariabilityRequirements link in the same Partition as the given ProductionTool
		/// </summary>
		/// <param name="source">ProductionTool to use as the source of the relationship.</param>
		/// <param name="target">VariabilityRequirement to use as the target of the relationship.</param>
		internal ProductionToolReferencesVariabilityRequirements(ProductionTool source, VariabilityRequirement target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(ProductionToolReferencesVariabilityRequirements.ProductionToolDomainRoleId, source), new DslModeling::RoleAssignment(ProductionToolReferencesVariabilityRequirements.VariabilityRequirementDomainRoleId, target)}, null)
		{
		}
		/// <summary>
		/// Constructor
		/// Creates a ProductionToolProducesProducedAssets link in the same Partition as the given ProductionTool
		/// </summary>
		/// <param name="source">ProductionTool to use as the source of the relationship.</param>
		/// <param name="target">ProducedAsset to use as the target of the relationship.</param>
		internal ProductionToolProducesProducedAssets(ProductionTool source, ProducedAsset target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(ProductionToolProducesProducedAssets.ProductionToolDomainRoleId, source), new DslModeling::RoleAssignment(ProductionToolProducesProducedAssets.ProducedAssetDomainRoleId, target)}, null)
		{
		}
		internal static DslModeling::LinkedElementCollection<VariabilityRequirement> GetVariabilityRequirements(ProductionTool element)
		{
			return GetRoleCollection<DslModeling::LinkedElementCollection<VariabilityRequirement>, VariabilityRequirement>(element, ProductionToolDomainRoleId);
		}
		internal static void SetDesign(ProductionTool element, Design newDesign)
		{
			DslModeling::DomainRoleInfo.SetLinkedElement(element, ProductionToolDomainRoleId, newDesign);
		}
		internal static Design GetDesign(ProductionTool element)
		{
			return DslModeling::DomainRoleInfo.GetLinkedElement(element, ProductionToolDomainRoleId) as Design;
		}
		/// <summary>
		/// Constructor
		/// Creates a DesignHasProductionTools link in the same Partition as the given Design
		/// </summary>
		/// <param name="source">Design to use as the source of the relationship.</param>
		/// <param name="target">ProductionTool to use as the target of the relationship.</param>
		internal DesignHasProductionTools(Design source, ProductionTool target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(DesignHasProductionTools.DesignDomainRoleId, source), new DslModeling::RoleAssignment(DesignHasProductionTools.ProductionToolDomainRoleId, target)}, null)
		{
		}
		internal static DslModeling::ReadOnlyLinkedElementCollection<Asset> GetAllSuppliedAssets(ProductionTool element)
		{
			return GetRoleCollection<DslModeling::ReadOnlyLinkedElementCollection<Asset>, Asset>(element, ProductionToolDomainRoleId);
		}
Exemple #12
0
		private static void WriteChildElements(DslModeling::SerializationContext serializationContext, ProductionTool element, global::System.Xml.XmlWriter writer)
		{
			// ProductionToolReferencesVariabilityRequirements
			global::System.Collections.ObjectModel.ReadOnlyCollection<ProductionToolReferencesVariabilityRequirements> allProductionToolReferencesVariabilityRequirementsInstances = ProductionToolReferencesVariabilityRequirements.GetLinksToVariabilityRequirements(element);
			if (!serializationContext.Result.Failed && allProductionToolReferencesVariabilityRequirementsInstances.Count > 0)
			{
				writer.WriteStartElement("variabilityRequirements");
				foreach (ProductionToolReferencesVariabilityRequirements eachProductionToolReferencesVariabilityRequirementsInstance in allProductionToolReferencesVariabilityRequirementsInstances)
				{
					if (serializationContext.Result.Failed)
						break;
	
					DslModeling::DomainClassXmlSerializer relSerializer = serializationContext.Directory.GetSerializer(eachProductionToolReferencesVariabilityRequirementsInstance.GetDomainClass().Id);
					global::System.Diagnostics.Debug.Assert(relSerializer != null, "Cannot find serializer for " + eachProductionToolReferencesVariabilityRequirementsInstance.GetDomainClass().Name + "!");
					relSerializer.Write(serializationContext, eachProductionToolReferencesVariabilityRequirementsInstance, writer);
				}
				writer.WriteEndElement();
			}
	
			// ProductionToolProducesProducedAssets
			global::System.Collections.ObjectModel.ReadOnlyCollection<ProductionToolProducesProducedAssets> allProductionToolProducesProducedAssetsInstances = ProductionToolProducesProducedAssets.GetLinksToProducedProducedAssets(element);
			if (!serializationContext.Result.Failed && allProductionToolProducesProducedAssetsInstances.Count > 0)
			{
				writer.WriteStartElement("producedAssets");
				foreach (ProductionToolProducesProducedAssets eachProductionToolProducesProducedAssetsInstance in allProductionToolProducesProducedAssetsInstances)
				{
					if (serializationContext.Result.Failed)
						break;
	
					DslModeling::DomainClassXmlSerializer relSerializer = serializationContext.Directory.GetSerializer(eachProductionToolProducesProducedAssetsInstance.GetDomainClass().Id);
					global::System.Diagnostics.Debug.Assert(relSerializer != null, "Cannot find serializer for " + eachProductionToolProducesProducedAssetsInstance.GetDomainClass().Name + "!");
					relSerializer.Write(serializationContext, eachProductionToolProducesProducedAssetsInstance, writer);
				}
				writer.WriteEndElement();
			}
	
		}
Exemple #13
0
		private static void ReadProductionToolProducesProducedAssetsInstances(DslModeling::SerializationContext serializationContext, ProductionTool element, global::System.Xml.XmlReader reader)
		{
			while (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
			{
				DslModeling::DomainClassXmlSerializer newProductionToolProducesProducedAssetsSerializer = serializationContext.Directory.GetSerializer(ProductionToolProducesProducedAssets.DomainClassId);
				global::System.Diagnostics.Debug.Assert(newProductionToolProducesProducedAssetsSerializer != null, "Cannot find serializer for ProductionToolProducesProducedAssets!");
				ProductionToolProducesProducedAssets newProductionToolProducesProducedAssets = newProductionToolProducesProducedAssetsSerializer.TryCreateInstance (serializationContext, reader, element.Partition) as ProductionToolProducesProducedAssets;
				if (newProductionToolProducesProducedAssets != null)
				{
					DslModeling::DomainRoleInfo.SetRolePlayer (newProductionToolProducesProducedAssets, ProductionToolProducesProducedAssets.ProductionToolDomainRoleId, element);
					DslModeling::DomainClassXmlSerializer targetSerializer = serializationContext.Directory.GetSerializer (newProductionToolProducesProducedAssets.GetDomainClass().Id);	
					global::System.Diagnostics.Debug.Assert (targetSerializer != null, "Cannot find serializer for " + newProductionToolProducesProducedAssets.GetDomainClass().Name + "!");
					targetSerializer.Read(serializationContext, newProductionToolProducesProducedAssets, reader);
				}
				else
				{	// Maybe the relationship is serialized in short-form by mistake.
					DslModeling::DomainClassXmlSerializer newProducedAssetMonikerOfProductionToolProducesProducedAssetsSerializer = serializationContext.Directory.GetSerializer(ProducedAsset.DomainClassId);
					global::System.Diagnostics.Debug.Assert(newProducedAssetMonikerOfProductionToolProducesProducedAssetsSerializer != null, "Cannot find serializer for ProducedAsset!");
					DslModeling::Moniker newProducedAssetMonikerOfProductionToolProducesProducedAssets = newProducedAssetMonikerOfProductionToolProducesProducedAssetsSerializer.TryCreateMonikerInstance(serializationContext, reader, element, ProductionToolProducesProducedAssets.DomainClassId, element.Partition);
					if (newProducedAssetMonikerOfProductionToolProducesProducedAssets != null)
					{
						WorkflowDesignSerializationBehaviorSerializationMessages.ExpectingFullFormRelationship(serializationContext, reader, typeof(ProductionToolProducesProducedAssets));
						new ProductionToolProducesProducedAssets(element.Partition, new DslModeling::RoleAssignment(ProductionToolProducesProducedAssets.ProductionToolDomainRoleId, element), new DslModeling::RoleAssignment(ProductionToolProducesProducedAssets.ProducedAssetDomainRoleId, newProducedAssetMonikerOfProductionToolProducesProducedAssets));
						DslModeling::SerializationUtilities.Skip(reader);	// Moniker contains no child XML elements, so just skip.
					}
					else
					{	// Unknown element, skip.
						DslModeling::SerializationUtilities.Skip(reader);
					}
				}
			}
		}
Exemple #14
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 ProductionTool instance that will get the deserialized data.</param>
		private static void ReadChildElements(DslModeling::SerializationContext serializationContext, ProductionTool element, global::System.Xml.XmlReader reader)
		{
			while (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
			{
				switch (reader.LocalName)
				{
					case "variabilityRequirements":	// Relationship "ProductionToolReferencesVariabilityRequirements"
						if (reader.IsEmptyElement)
						{	// No instance of this relationship, just skip
							DslModeling::SerializationUtilities.Skip(reader);
						}
						else
						{
							DslModeling::SerializationUtilities.SkipToFirstChild(reader);  // Skip the open tag of <variabilityRequirements>
							ReadProductionToolReferencesVariabilityRequirementsInstances(serializationContext, element, reader);
							DslModeling::SerializationUtilities.Skip(reader);  // Skip the close tag of </variabilityRequirements>
						}
						break;
					case "producedAssets":	// Relationship "ProductionToolProducesProducedAssets"
						if (reader.IsEmptyElement)
						{	// No instance of this relationship, just skip
							DslModeling::SerializationUtilities.Skip(reader);
						}
						else
						{
							DslModeling::SerializationUtilities.SkipToFirstChild(reader);  // Skip the open tag of <producedAssets>
							ReadProductionToolProducesProducedAssetsInstances(serializationContext, element, reader);
							DslModeling::SerializationUtilities.Skip(reader);  // Skip the close tag of </producedAssets>
						}
						break;
					default:
						return;  // Don't know this element.
				}
			}
		}