private void InitializeDataProviders() { try { SpecIfPluginConfiguration configuration = _configurationReaderWriter.GetConfiguration(); _metadataReader = new SpecIfFileMetadataReader(configuration.SpecIfMetadataDirectory); _specIfDataReader = new SpecIfJiraDataReader(configuration.JiraURL, configuration.JiraUserName, configuration.JiraApiKey, _metadataReader); _requirementMasterDataWriter = new SpecIfJiraDataWriter(configuration.JiraURL, configuration.JiraUserName, configuration.JiraApiKey, _metadataReader, _specIfDataReader); _projectIntegrator = new ProjectIntegrator(_repository, _metadataReader, _specIfDataReader); } catch (Exception exception) { MessageBox.Show("Error initializing the data providers\r\n" + exception.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); logger.Error(exception); } }
public static ResourceClass GetResourceType(this Resource resource, ISpecIfMetadataReader dataProvider) { ResourceClass result = null; result = dataProvider.GetResourceClassByKey(resource.Class); return(result); }
//public bool RepositoryIsOpen { get; set; } public SpecIfEaDataReader(EAAPI.Repository eaRepository, ISpecIfMetadataReader metadataReader) { _eaRepository = eaRepository; _metadataReader = metadataReader; if (_eaUmlToSpecIfConverter == null) { _eaUmlToSpecIfConverter = new EaUmlToSpecIfConverter(eaRepository, metadataReader); } }
public SpecIfJiraDataWriter(string url, string userName, string apiKey, ISpecIfMetadataReader metadataReader, ISpecIfDataReader dataReader) : base(metadataReader, dataReader) { _url = url; _jiraClient = new JiraRestClient(url, userName, apiKey); }
public static string GetClassTitle(this Property property, ISpecIfMetadataReader dataProvider) { string result = null; PropertyClass propertyClass = dataProvider.GetPropertyClassByKey(property.Class); if (propertyClass != null) { result = propertyClass.Title; } return(result); }
public static List <string> GetStringValues(this Property property, ISpecIfMetadataReader metadataReader, string language = "en") { List <string> result = new List <string>(); DataType dataType = property.GetDataType(metadataReader); foreach (Value value in property.Values) { result.Add(value.ToString(language)); } return(result); }
public static string GetDataTypeTitle(this PropertyClass propertyClass, ISpecIfMetadataReader dataProvider) { string result = ""; DataType dataType = dataProvider.GetDataTypeByKey(propertyClass.DataType); if (dataType != null) { result = dataType.Title.ToString(); } return(result); }
public static DataType GetDataType(this Property property, ISpecIfMetadataReader dataProvider) { DataType result = null; PropertyClass propertyClass = dataProvider.GetPropertyClassByKey(property.Class); if (propertyClass != null) { DataType dataType = dataProvider.GetDataTypeByKey(propertyClass.DataType); result = dataType; } return(result); }
public static string GetPropertyClassTitle(this Key propertyClassKey, ISpecIfMetadataReader dataProvider) { string result = ""; PropertyClass propertyClass = dataProvider.GetPropertyClassByKey(propertyClassKey); result = propertyClass.Title; return(result); }
public override DataModels.SpecIF GetProject(ISpecIfMetadataReader metadataReader, string projectID, List <Key> hierarchyFilter = null, bool includeMetadata = true) { DataModels.SpecIF result = null; foreach (KeyValuePair <string, DataModels.SpecIF> keyValuePair in SpecIfData) { if (keyValuePair.Value.ID == projectID) { result = keyValuePair.Value; break; } } return(result); }
public static bool IsEnumeration(this Property property, ISpecIfMetadataReader metadataReader) { bool result = false; DataType dataType = property.GetDataType(metadataReader); if (dataType != null) { // enumeration type if (dataType.Enumeration != null && dataType.Enumeration.Count > 0) { result = true; } } return(result); }
public SpecIfJiraDataReader(string url, string userName, string apiKey, ISpecIfMetadataReader metadataReader) { _url = url; _metadataReader = metadataReader; _jiraClient = new JiraRestClient(url, userName, apiKey); if (!_projectInfoInitialized) { InitializeProjectInformations(); _projectInfoInitialized = true; } }
/// <summary> /// Returns the user visible enumeration values. /// </summary> /// <param name="property"></param> /// <param name="metadataReader"></param> /// <param name="language"></param> /// <returns></returns> public static List <List <string> > GetEnumerationValues(this Property property, ISpecIfMetadataReader metadataReader, string language = "en") { List <List <string> > result = new List <List <string> >(); PropertyClass propertyClass = metadataReader.GetPropertyClassByKey(property.Class); DataType dataType = property.GetDataType(metadataReader); if (propertyClass != null && dataType != null) { // enumeration type if (dataType.Enumeration != null && dataType.Enumeration.Count > 0) { // property with multiple values if (propertyClass.Multiple.HasValue && propertyClass.Multiple.Value) { List <string> enumTexts = new List <string>(); foreach (Value value in property.Values) { string id = value.ToSimpleTextString(language); enumTexts.Add(GetEnumTextForIdValue(id, dataType, language)); result.Add(enumTexts); } } else // property with single values { string id = property.GetStringValue(metadataReader, language); List <string> enumValues = new List <string>(); enumValues.Add(GetEnumTextForIdValue(id, dataType, language)); result.Add(enumValues); } } } return(result); }
public SpecIfFileDataWriter(string path, ISpecIfMetadataReader metadataReader, ISpecIfDataReader dataReader) : base(metadataReader, dataReader) { _path = path; _identificatorFilePath = _path + _identificator; if (path == null) { _specIfData = new Dictionary <string, DataModels.SpecIF>(); } else { if (dataReader is SpecIfFileDataReader) { SpecIfFileDataReader fileDataReader = dataReader as SpecIfFileDataReader; _specIfData = fileDataReader.SpecIfData; } } InitializeIdentificators(); }
public static string GetTypeName(this Resource resource, ISpecIfMetadataReader dataProvider) { string result = ""; try { ResourceClass resourceType = dataProvider.GetResourceClassByKey(resource.Class); if (resourceType != null) { if (resourceType.Title is string) { result = resourceType.Title.ToString(); } //result = resourceType.Title.LanguageValues[0]; } } catch (Exception exception) { Debug.WriteLine("Error with getTypeName() " + exception); } return(result); }
public static string GetStringValue(this Property property, ISpecIfMetadataReader metadataReader, string language = "en") { string result = ""; DataType dataType = property.GetDataType(metadataReader); if (property.Values != null && property.Values.Count > 0) { Value firstValue = property.Values[0]; if (firstValue.StringValue != null) { result = firstValue.StringValue; } else if (firstValue.MultilanguageTexts != null && firstValue.MultilanguageTexts.Count > 0) { foreach (MultilanguageText multilanguageText in firstValue.MultilanguageTexts) { if (multilanguageText.Language == null || multilanguageText.Language == "en") { if (language == null || language == "en") { result = multilanguageText.Text; break; } else if (multilanguageText.Language == language) { result = multilanguageText.Text; break; } } } } } return(result); }
public static void SetPropertyValue(this Resource resource, string propertyTitle, string stringValue, ISpecIfMetadataReader metadataProvider, string format = "plain") { ResourceClass resourceClass = metadataProvider.GetResourceClassByKey(resource.Class); Value value = new Value(); foreach (Key propertyClassKey in resourceClass.PropertyClasses) { PropertyClass propertyClass = metadataProvider.GetPropertyClassByKey(propertyClassKey); if (propertyClass.Title == propertyTitle) { DataType dataType = metadataProvider.GetDataTypeByKey(propertyClass.DataType); if (dataType.Type == "xs:string") { MultilanguageText multilanguageText = new MultilanguageText { Text = stringValue, Format = format }; value = new Value(multilanguageText); } else { value = new Value(stringValue); } } } SetPropertyValue(resource, propertyTitle, value, metadataProvider); }
public AbstractSpecIfDataWriter(ISpecIfMetadataReader metadataReader, ISpecIfDataReader dataReader) { _metadataReader = metadataReader; _dataReader = dataReader; }
public static string GetPropertyValue(this Statement statement, string propertyTitle, ISpecIfMetadataReader dataProvider) { string result = ""; if (statement.Properties != null) { foreach (Property property in statement.Properties) { string title = ""; // property.Title.LanguageValues[0].Text; if (title == propertyTitle) { result = property.GetStringValue(dataProvider); break; } } } return(result); }
public JiraToSpecIfConverter(ISpecIfMetadataReader metadataReader, List <Jira3.Status> statusInformation) { _metadataReader = metadataReader; _statusInformation = statusInformation; }
public static string GetPropertyValue(this Resource resource, string propertyTitle, ISpecIfMetadataReader dataProvider, string language = "en") { string result = ""; if (resource != null && resource.Properties != null) { foreach (Property property in resource.Properties) { PropertyClass propertyClass = dataProvider.GetPropertyClassByKey(property.Class); if (propertyClass != null) { if (propertyClass.Title == propertyTitle) { result = property.GetStringValue(dataProvider, language); break; } } } } return(result); }
public override DataModels.SpecIF GetProject(ISpecIfMetadataReader metadataReader, string projectID, List <Key> hierarchyFilter = null, bool includeMetadata = true) { throw new NotImplementedException(); }
public static void SetPropertyValue(this Resource resource, string propertyTitle, Value value, ISpecIfMetadataReader metadataProvider) { bool propertyFound = false; foreach (Property property in resource.Properties) { PropertyClass propertyClass = metadataProvider.GetPropertyClassByKey(property.Class); if (propertyClass != null) { if (propertyClass.Title == propertyTitle) { if (property.Values.Count == 0) { property.Values.Add(value); } else { property.Values[0] = value; } propertyFound = true; break; } } } if (!propertyFound) { ResourceClass resourceType = metadataProvider.GetResourceClassByKey(resource.Class); if (resourceType != null) { PropertyClass matchingPropertyClass = null; Key matchingPropertyKey = null; foreach (Key propertyKey in resourceType.PropertyClasses) { PropertyClass propertyClass = metadataProvider.GetPropertyClassByKey(propertyKey); if (propertyClass.Title == propertyTitle) { matchingPropertyClass = propertyClass; matchingPropertyKey = propertyKey; break; } } if (matchingPropertyClass != null) { Property property = new Property() { Class = matchingPropertyKey, Values = new List <Value> { value } }; resource.Properties.Add(property); } } } }
public abstract SpecIF.DataModels.SpecIF GetProject(ISpecIfMetadataReader metadataReader, string projectID, List <Key> hierarchyFilter = null, bool includeMetadata = true);