public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as DataRequirement; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (TypeElement != null) { dest.TypeElement = (Code <Hl7.Fhir.Model.FHIRAllTypes>)TypeElement.DeepCopy(); } if (ProfileElement != null) { dest.ProfileElement = new List <Hl7.Fhir.Model.FhirUri>(ProfileElement.DeepCopy()); } if (MustSupportElement != null) { dest.MustSupportElement = new List <Hl7.Fhir.Model.FhirString>(MustSupportElement.DeepCopy()); } if (CodeFilter != null) { dest.CodeFilter = new List <Hl7.Fhir.Model.DataRequirement.CodeFilterComponent>(CodeFilter.DeepCopy()); } if (DateFilter != null) { dest.DateFilter = new List <Hl7.Fhir.Model.DataRequirement.DateFilterComponent>(DateFilter.DeepCopy()); } return(dest); }
public Folder Paste(Profile profile, ProfileElement parent) { if (FolderEntity == null) { throw new ArtemisSharedUIException("Couldn't paste folder because FolderEntity deserialized as null"); } if (HasBeenPasted) { throw new ArtemisSharedUIException("Clipboard model can only be pasted once"); } HasBeenPasted = true; // Generate new GUIDs ReplaceGuid(FolderEntity); foreach (FolderEntity folderEntity in Folders) { ReplaceGuid(folderEntity); } foreach (LayerEntity layerEntity in Layers) { ReplaceGuid(layerEntity); } // Inject the pasted elements into the profile profile.ProfileEntity.Folders.AddRange(Folders); profile.ProfileEntity.Layers.AddRange(Layers); // Let the folder initialize and load as usual FolderEntity.Name += " - copy"; Folder folder = new(profile, parent, FolderEntity); return(folder); }
/// <summary> /// Method that creates CodeCompileUnit from the <paramref name="entity"/> parameter. /// </summary> /// <param name="package">ProfileElement element that represents the package</param> /// <param name="entity">ProfileElement element that represents (usualy) class or enumeration</param> /// <returns>CodeCompileUnit unit that will be added to files list, for future compiling or writing to a file</returns> private CodeCompileUnit BuildCodeCompileUnit(Profile profile, ProfileElement package, ProfileElement entity) { CodeCompileUnit unit = null; if (entity.TypeAsEnumValue == ProfileElementTypes.Class) { if (entity.IsEnumeration) { //enumeration OnMessage("\r\n\t Enumeration:\t" + entity.Name); unit = CreateEnumeration(package, entity); } else { //class OnMessage("\r\n\t Class:\t\t" + entity.Name); unit = CreateClass(profile, package, entity); } } else { OnMessage("\r\n\tNot a class or enumeration:" + entity.Name); } return(unit); }
/// <summary> /// Method that creates CodeCompileUnit from the <paramref name="entity"/> parameter. /// </summary> /// <param name="package">ProfileElement element that represents the package</param> /// <param name="entity">ProfileElement element that represents (usualy) class or enumeration</param> /// <returns>CodeCompileUnit unit that will be added to files list, for future compiling or writing to a file</returns> private CodeCompileUnit BuildCodeCompileUnit(Profile profile, ProfileElement package, ProfileElement en) { CodeCompileUnit unit = null; if (ExtractSimpleNameFromResourceURI(en.Type).Equals("Class")) { Class entity = (Class)en; if (entity.IsEnumeration) { //enumeration OnMessage("\r\n\t Enumeration:\t" + entity.Name); unit = CreateEnumeration(package, entity); } else { //class OnMessage("\r\n\t Class:\t\t" + entity.Name); unit = CreateClass(profile, package, entity); } } else { OnMessage("\r\n\tNot a class or enumeration:" + en.Name); } return(unit); }
private void ExcludeDataTypesFromProfile(PredefinedClasses cimPredefined) { if ((cimPredefined != null) && (profile != null) && (profile.ClassCount > 0)) { ClassCategory packageCorePE = profile.FindProfileElementByUri("#Package_Core") as ClassCategory; if (packageCorePE != null) { foreach (string dataTypeName in cimPredefined.PedifinedClassesList) { ProfileElement dataTypePE = profile.ProfileMap[ProfileElementTypes.Class].Find(x => string.Compare(x.Name, dataTypeName) == 0); if (dataTypePE != null) { //// remove dataTypePE from package Core packageCorePE.MembersOfClassCategory.Remove(dataTypePE); //// remove dataTypePE from profile profile.ProfileMap[ProfileElementTypes.Class].Remove(dataTypePE); } } //// remove enums UnitSymbol and UnitMultiplier ProfileElement unitSymbolPE = profile.FindProfileElementByUri("#UnitSymbol"); ProfileElement unitMultiplierlPE = profile.FindProfileElementByUri("#UnitMultiplier"); //// remove from package Core packageCorePE.MembersOfClassCategory.Remove(unitSymbolPE); packageCorePE.MembersOfClassCategory.Remove(unitMultiplierlPE); //// remove from profile profile.ProfileMap[ProfileElementTypes.Class].Remove(unitSymbolPE); profile.ProfileMap[ProfileElementTypes.Class].Remove(unitMultiplierlPE); } } }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as Meta; if (dest != null) { base.CopyTo(dest); if (VersionIdElement != null) { dest.VersionIdElement = (Hl7.Fhir.Model.Id)VersionIdElement.DeepCopy(); } if (LastUpdatedElement != null) { dest.LastUpdatedElement = (Hl7.Fhir.Model.Instant)LastUpdatedElement.DeepCopy(); } if (ProfileElement != null) { dest.ProfileElement = new List <Hl7.Fhir.Model.FhirUri>(ProfileElement.DeepCopy()); } if (Security != null) { dest.Security = new List <Hl7.Fhir.Model.Coding>(Security.DeepCopy()); } if (Tag != null) { dest.Tag = new List <Hl7.Fhir.Model.Coding>(Tag.DeepCopy()); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
public LayerViewModel(ProfileElement layer, IRgbService rgbService, IProfileEditorService profileEditorService, IDialogService dialogService, IProfileTreeVmFactory profileTreeVmFactory, ILayerBrushService layerBrushService) : base(layer, rgbService, profileEditorService, dialogService, profileTreeVmFactory, layerBrushService) { }
// I hate this about DI, oh well public FolderViewModel(ProfileElement folder, IProfileEditorService profileEditorService, IDialogService dialogService, ILayerService layerService, IFolderViewModelFactory folderViewModelFactory, ILayerViewModelFactory layerViewModelFactory) : base(null, folder, profileEditorService, dialogService, layerService, folderViewModelFactory, layerViewModelFactory) { }
// I hate this about DI, oh well public FolderViewModel(ProfileElement folder, IProfileEditorService profileEditorService, IDialogService dialogService, IProfileTreeVmFactory profileTreeVmFactory, ILayerBrushService layerBrushService, ISurfaceService surfaceService) : base(folder, profileEditorService, dialogService, profileTreeVmFactory, layerBrushService, surfaceService) { }
public FolderViewModel(TreeItemViewModel parent, ProfileElement folder, IProfileEditorService profileEditorService, IDialogService dialogService, ILayerService layerService, IFolderViewModelFactory folderViewModelFactory, ILayerViewModelFactory layerViewModelFactory) : base(parent, folder, profileEditorService, dialogService, layerService, folderViewModelFactory, layerViewModelFactory) { }
public void AddFolder() { if (!SupportsChildren) { throw new ArtemisUIException("Cannot add a folder to a profile element of type " + ProfileElement.GetType().Name); } ProfileElement.AddChild(new Folder(ProfileElement.Profile, ProfileElement, "New folder")); UpdateProfileElements(); _profileEditorService.UpdateSelectedProfile(); }
public void RemoveExistingElement(TreeItemViewModel treeItem) { if (!SupportsChildren) { throw new ArtemisUIException("Cannot remove a child from a profile element of type " + ProfileElement.GetType().Name); } ProfileElement.RemoveChild(treeItem.ProfileElement); Children.Remove(treeItem); treeItem.Parent = null; }
public void StartDocument(string filePath) { currentElement = null; profile = new Profile(); profile.SourcePath = filePath; allByType = new SortedDictionary <ProfileElementTypes, List <ProfileElement> >(); checkedElementsCount = 0; documentIdentifiedLikeRDFS = false; abort = false; }
public void AddExistingElement(TreeItemViewModel treeItem) { if (!SupportsChildren) { throw new ArtemisUIException("Cannot add a child to a profile element of type " + ProfileElement.GetType().Name); } ProfileElement.AddChild(treeItem.ProfileElement); Children.Add(treeItem); treeItem.Parent = this; }
/// <summary> /// Method adds given ProfileElement to the MySubclasses list. /// </summary> /// <param fullName="subclass"></param> public void AddToMySubclasses(ProfileElement subclass) { if (mySubclasses == null) { mySubclasses = new List <ProfileElement>(); } if (!mySubclasses.Contains(subclass)) { mySubclasses.Add(subclass); mySubclasses.Sort(CIMComparer.ProfileElementComparer); } }
/// <summary> /// Checks and adds missing URI parts to properties /// </summary> /// <param name="elem">ProfileElement class whose properties are being checked</param> /// <param name="profile">Profile profile that is being checked</param> private void checkPropertiesURI(ProfileElement elem, Profile profile) { if (elem.MyProperties != null) { foreach (ProfileElement property in elem.MyProperties) { if (property.URI.StartsWith("#")) { property.URI = profile.BaseNS + property.URI; } } } }
/// <summary> /// Method adds given ProfileElement to the MyProperties list. /// </summary> /// <param fullName="property"></param> public void AddToMyProperties(ProfileElement property) { if (myProperties == null) { myProperties = new List <ProfileElement>(); } if (!myProperties.Contains(property)) { myProperties.Add(property); myProperties.Sort(CIMComparer.ProfileElementComparer); } }
public LayerViewModel(ProfileElement layer, IRgbService rgbService, IProfileEditorService profileEditorService, IDialogService dialogService, IProfileTreeVmFactory profileTreeVmFactory, ILayerBrushService layerBrushService, IWindowManager windowManager, ILayerHintVmFactory vmFactory) : base(layer, rgbService, profileEditorService, dialogService, profileTreeVmFactory, layerBrushService) { _windowManager = windowManager; _vmFactory = vmFactory; }
/// <summary> /// Checks and adds missing URI parts to enumeration members /// </summary> /// <param name="elem">ProfileElement enumeration that is being checked</param> /// <param name="profile">Profile profile that is being checked</param> private void checkEnumerationURI(ProfileElement elem, Profile profile) { if (elem.MyEnumerationMembers != null) { foreach (ProfileElement enumMember in elem.MyEnumerationMembers) { if (enumMember.URI.StartsWith("#")) { enumMember.URI = profile.BaseNS + enumMember.URI; } } } }
/// <summary> /// Method adds given ProfileElement to the MembersOfClassCategory list. /// /// TODO: added so that sets the subClassOf attribute /// </summary> /// <param fullName="member"></param> public void AddToMembersOfClassCategory(ProfileElement member) { if (membersOfClassCategory == null) { membersOfClassCategory = new List <ProfileElement>(); } if (!membersOfClassCategory.Contains(member)) { membersOfClassCategory.Add(member); membersOfClassCategory.Sort(CIMComparer.ProfileElementComparer); } }
/// <summary> /// Method that creates CodeCompileUnit from the <paramref name="entity"/> parameter. /// </summary> /// <param name="package">ProfileElement element that represents the package</param> /// <param name="entity">ProfileElement element that represents (usualy) class or enumeration</param> /// <returns>CodeCompileUnit unit that will be added to files list, for future compiling or writing to a file</returns> private CodeCompileUnit BuildCodeCompileUnit(Profile profile, ProfileElement package, ProfileElement en) { CodeCompileUnit unit = null; if (ExtractSimpleNameFromResourceURI(en.Type).Equals("Class")) { Class entity = (Class)en; if (entity.IsEnumeration) { //enumeration OnMessage("\r\n\t Enumeration:\t" + entity.Name); unit = CreateEnumeration(package, entity); //unit.AssemblyCustomAttributes.Add(new CodeAttributeDeclaration("AssemblyVersion", new CodeAttributeArgument(new CodePrimitiveExpression("1.0.0.*")))); } else { //class OnMessage("\r\n\t Class:\t\t" + entity.Name); unit = CreateClass(profile, package, entity); //unit.AssemblyCustomAttributes.Add(new CodeAttributeDeclaration("AssemblyVersion", new CodeAttributeArgument(new CodePrimitiveExpression("1.0.0.*")))); } } else { OnMessage("\r\n\tNot a class or enumeration:" + en.Name); } return(unit); //if(entity.TypeAsEnumValue == ProfileElementTypes.Class) //{ // if(entity.IsEnumeration) // { // //enumeration // OnMessage("\r\n\t Enumeration:\t" + entity.Name); // unit = CreateEnumeration(package, entity); // } // else // { // //class // OnMessage("\r\n\t Class:\t\t" + entity.Name); // unit = CreateClass(profile, package, entity); // } //} //else //{ // OnMessage("\r\n\tNot a class or enumeration:" + entity.Name); //} //return unit; }
/// <summary> /// Method creates CodeCompileUnit that represents enumeration /// NOTE: in this method if character '-' is found it is replaced by string "MINUS" /// so that the member field names in CodeCompileUnit ca be valid for C# code /// e.g. Hz-1 will become HzMINUS1 /// </summary> /// <param name="package">ProfileElement element that represents the package</param> /// <param name="entity">ProfileElement element that represents enumeration</param> /// <returns>CodeCompileUnit unit representing enumeration</returns> private CodeCompileUnit CreateEnumeration(ProfileElement package, Class entity) { CodeCompileUnit unit = new CodeCompileUnit(); //namespace string fullNS = package.Name; ProfileElement temp = package; /*while(temp.BelongsToCategoryAsObject != null) * { * temp = temp.BelongsToCategoryAsObject; * fullNS = temp.Name + "." + fullNS; * } * fullNS = defaultNS + "." + fullNS;*/ //CodeNamespace nameSpace = new CodeNamespace(fullNS); CodeNamespace nameSpace = new CodeNamespace(defaultNS); unit.Namespaces.Add(nameSpace); //namespace imports nameSpace.Imports.Add(new CodeNamespaceImport("System")); CodeTypeDeclaration enumeration = new CodeTypeDeclaration(entity.Name); enumeration.IsEnum = true; enumeration.Attributes = MemberAttributes.Public; enumeration.TypeAttributes = TypeAttributes.Public; if (entity.MyEnumerationMembers != null) { foreach (ProfileElement enumMember in entity.MyEnumerationMembers) { /* * REPLACES '-' with "MINUS" because in enumeration '-' is not a valid character */ string value = enumMember.Name; value = StringManipulationManager.ReplaceInvalidEnumerationCharacters(value); CodeMemberField val = new CodeMemberField(typeof(int), value); if (!string.IsNullOrEmpty(enumMember.Comment)) { val.Comments.Add(new CodeCommentStatement(enumMember.Comment, true)); } enumeration.Members.Add(val); } } nameSpace.Types.Add(enumeration); return(unit); }
//novo public void AddProfileElement(ProfileElementTypes tp, ProfileElement el) { List <ProfileElement> elementsOfSameType = null; if (allByType.ContainsKey(tp)) { allByType.TryGetValue(tp, out elementsOfSameType); } if (elementsOfSameType == null) { elementsOfSameType = new List <ProfileElement>(); } allByType.Remove(tp); elementsOfSameType.Add(el); allByType.Add(tp, elementsOfSameType); }
public void AddLayer() { if (!SupportsChildren) { throw new ArtemisUIException("Cannot add a layer to a profile element of type " + ProfileElement.GetType().Name); } var layer = new Layer(ProfileElement.Profile, ProfileElement, "New layer"); foreach (var baseLayerProperty in layer.Properties) { _layerService.InstantiateKeyframeEngine(baseLayerProperty); } ProfileElement.AddChild(layer); UpdateProfileElements(); _profileEditorService.UpdateSelectedProfile(); }
/// <summary> /// Adds information about attribure <c>att</c> to <c>entity</c> /// </summary> /// <param name="entity">ProfileElement to which attribute is being added</param> /// <param name="att">CAttribute contains information about attribute</param> private void addAttributeToElement(ProfileElement entity, CAttribute att, CClass modelClass) { ProfileElement newProperty = new ProfileElement(); newProperty.URI = att.name; newProperty.DataType = att.type; if (ProfileElementStereotype.StereotypeEnumeration.Equals(modelClass.stereotype)) { newProperty.DataType = "int"; newProperty.TypeAsEnumValue = ProfileElementTypes.EnumerationElement; entity.AddToMyEnumerationMembers(newProperty); } else { newProperty.TypeAsEnumValue = ProfileElementTypes.Property; if (!newProperty.IsPropertyDataTypeSimple) { List <ProfileElement> list = new List <ProfileElement>(); list.AddRange(profile.GetAllProfileElementsOfType(ProfileElementTypes.Class)); list.AddRange(predefined); list.AddRange(newPredefined); //if it is not simple, then it is a reference in profile, or another missing one? foreach (ProfileElement type in list) { if (type.UniqueName.Equals(att.type)) { //if its from profile, add needed references newProperty.DataTypeAsComplexObject = type; break; } } if (newProperty.DataTypeAsComplexObject == null) { //not found so it has to be added in next iteration //create flawed element so that it can be found //flawed in a way that it only has URI ProfileElement newElement = new ProfileElement(); newElement.URI = att.type; newPredefined.Add(newElement); newProperty.DataTypeAsComplexObject = newElement; } } entity.AddToMyProperties(newProperty); } }
protected TreeItemViewModel(ProfileElement profileElement, IProfileEditorService profileEditorService, IDialogService dialogService, IProfileTreeVmFactory profileTreeVmFactory, ILayerBrushService layerBrushService, ISurfaceService surfaceService) { _profileEditorService = profileEditorService; _dialogService = dialogService; _profileTreeVmFactory = profileTreeVmFactory; _layerBrushService = layerBrushService; _surfaceService = surfaceService; ProfileElement = profileElement; Subscribe(); UpdateProfileElements(); }
public static MvcHtmlString ProfileElementRenderer(this HtmlHelper html, ProfileElement element, FormCollection collection) { var builder = new StringBuilder(); var elementName = String.Format(ElementNameFormat, (ElementType)element.Type, element.Id); var elementValue = String.Empty; if (collection != null && collection[elementName] != null) { elementValue = collection[elementName]; } builder.Append(html.Label(elementName, element.Title)); builder.Append("<br/>"); builder.Append(ElementTypeUtility.RenderElementType(html, (ElementType)element.Type, elementName, elementValue, element.ElementValues)); builder.Append(html.ValidationMessage(elementName)); return MvcHtmlString.Create(builder.ToString()); }
public static MvcHtmlString ProfileElementRenderer(this HtmlHelper html, ProfileElement element, FormCollection collection) { var builder = new StringBuilder(); var elementName = String.Format(ElementNameFormat, (ElementType)element.Type, element.Id); var elementValue = String.Empty; if (collection != null && collection[elementName] != null) { elementValue = collection[elementName]; } builder.Append(html.Label(elementName, element.Title)); builder.Append("<br/>"); builder.Append(ElementTypeUtility.RenderElementType(html, (ElementType)element.Type, elementName, elementValue, element.ElementValues)); builder.Append(html.ValidationMessage(elementName)); return(MvcHtmlString.Create(builder.ToString())); }
protected TreeItemViewModel(TreeItemViewModel parent, ProfileElement profileElement, IProfileEditorService profileEditorService, IDialogService dialogService, ILayerService layerService, IFolderViewModelFactory folderViewModelFactory, ILayerViewModelFactory layerViewModelFactory) { _profileEditorService = profileEditorService; _dialogService = dialogService; _layerService = layerService; _folderViewModelFactory = folderViewModelFactory; _layerViewModelFactory = layerViewModelFactory; Parent = parent; ProfileElement = profileElement; Children = new BindableCollection <TreeItemViewModel>(); UpdateProfileElements(); }
/// <summary> /// Method adds given ProfileElement to the MyEnumerationMembers list. /// </summary> /// <param fullName="enumerationMemeber"></param> public void AddToMyEnumerationMembers(ProfileElement enumerationMemeber) { if (enumerationMemeber != null) { if (!isEnumeration) { isEnumeration = true; } if (myEnumerationMembers == null) { myEnumerationMembers = new List <ProfileElement>(); } if (!myEnumerationMembers.Contains(enumerationMemeber)) { myEnumerationMembers.Add(enumerationMemeber); myEnumerationMembers.Sort(CIMComparer.ProfileElementComparer); } } }
//// Connect property of class with class and classes with packages. private void AddBelongingInformation(ProfileElement currentElement, string classUri) { if (belongingMap == null) { belongingMap = new Dictionary <string, Stack <ProfileElement> >(); } Stack <ProfileElement> stack; if (!belongingMap.ContainsKey(classUri)) { stack = new Stack <ProfileElement>(); } else { stack = belongingMap[classUri]; } stack.Push(currentElement); belongingMap.Remove(classUri); belongingMap.Add(classUri, stack); }