/// <summary> /// Преобразовывает прикладной объект в объект xml-модели, используя указанный маппер. /// </summary> /// <param name="appObject"></param> /// <returns></returns> private IEnumerable <ISync> GetXMLObjectByMapper <TItem>(DataObject appObject) where TItem : IChangedItem { IEnumerable <ISync> xmlObjects; SyncSetting setting = null; IPropertyMapper mapper = null; try { // Преобразуем вычитанный изменнённый объект в его xml-представление. //TODO Проверить обработку мастеровых и детейловых объектов при маппинге. В маппинге используется дочитка, возможно сброситься состояние полученное при откате изменений. var field = GetXMLDestinationTypeByChangedItem <TItem>(appObject); // Этот объект так же должен поддерживать ISync. var syncObj = appObject as ISync; setting = SettingService.Current.GetSettings(syncObj).First(s => s.Destination.Name == field.FullName); mapper = setting.ExtractMapper <IPropertyMapper>(); xmlObjects = mapper.Map(appObject).Cast <ISync>(); } catch (ArgumentException ex) { throw; } catch (Exception ex) { throw new MappingException(appObject, setting, mapper, ex.Message); } return(xmlObjects); }
public Build Map(BuildResponse build) { if (build == null) { return(null); } return(new Build { Id = build.Id, BuildConfigurationId = build.BuildTypeId, Agent = _agentMapper.Map(build.Agent), ArtifactDependencies = Map(build.ArtifactDependencies), BranchName = build.BranchName, BuildConfiguration = _buildConfigurationMapper.Map(build.BuildType), FinishDate = build.FinishDate, Href = build.Href, IsDefaultBranch = build.DefaultBranch || string.Equals(build.BranchName, "develop") || string.Equals(build.BranchName, "master"), LastChanges = _buildChangeMapper.Map(build.LastChanges), Number = build.Number, PercentageComplete = build.PercentageComplete ?? build.RunningInfo?.PercentageComplete, ElapsedSeconds = build.RunningInfo?.ElapsedSeconds, EstimatedTotalSeconds = build.RunningInfo?.EstimatedTotalSeconds, CurrentStageText = build.RunningInfo?.CurrentStageText, Properties = _propertyMapper.Map(build.Properties), QueuedDate = build.QueuedDate, SnapshotDependencies = Map(build.SnapshotDependencies), StartDate = build.StartDate, State = build.State, Status = _buildStatusMapper.Map(build.Status), StatusText = build.StatusText, WebUrl = build.WebUrl }); }
public void Execute() { var mapperTestNode = new MapperTestNode(); prepareNode(mapperTestNode); mapper.Map(result, mapperTestNode, typeof(MapperTestItem).GetProperty(propertyName)); }
protected void MapPropertiesFromAttributes(TDestination dest, INode source) { var properties = typeof(TDestination).GetProperties(); foreach (var propertyInfo in properties) { propertyMapper.Map(dest, source, propertyInfo); } }
public SnapshotDependency Map(SnapshotDependencyResponse snapshotDependency) { if (snapshotDependency == null) { return(null); } return(new SnapshotDependency { Id = snapshotDependency.Id, Properties = _propertyMapper.Map(snapshotDependency.Properties) }); }
private void MapProperties(PageType pageType, ContentType contentType) { foreach (var pageDefinition in pageType.Definitions.Where(SupportedPropertiesPredicate)) { var propertyDefinition = _propertyMapper.Map(pageDefinition); if (propertyDefinition != null) { contentType.PropertyDefinitions.Add(propertyDefinition); } } }
public ArtifactDependency Map(ArtifactDependencyResponse artifactDependency) { if (artifactDependency == null) { return(null); } return(new ArtifactDependency { Id = artifactDependency.Id, Type = artifactDependency.Type, Properties = _propertyMapper.Map(artifactDependency.Properties) }); }
public AgentRequirement Map(AgentRequirementResponse agentRequirement) { if (agentRequirement == null) { return(null); } return(new AgentRequirement { Id = agentRequirement.Id, Type = agentRequirement.Type, Properties = _propertyMapper.Map(agentRequirement.Properties) }); }
public BuildStep Map(BuildStepResponse buildStep) { if (buildStep == null) { return(null); } return(new BuildStep { Id = buildStep.Id, Name = buildStep.Name, Type = buildStep.Type, Properties = _propertyMapper.Map(buildStep.Properties) }); }
public BuildTrigger Map(BuildTriggerResponse buildTrigger) { if (buildTrigger == null) { return(null); } return(new BuildTrigger { Id = buildTrigger.Id, Type = buildTrigger.Type, Properties = _propertyMapper.Map(buildTrigger.Properties) }); }
public BuildConfiguration Map(BuildTypeResponse buildType) { if (buildType == null) { return(null); } return(new BuildConfiguration { Id = buildType.Id, Href = buildType.Href, Name = buildType.Name, ProjectId = buildType.ProjectId, WebUrl = buildType.WebUrl, AgentRequirements = _agentRequirementMapper.Map(buildType.AgentRequirements), ArtifactDependencies = _artifactDependencyMapper.Map(buildType.ArtifactDependencies), Parameters = _propertyMapper.Map(buildType.Parameters), Settings = _propertyMapper.Map(buildType.Settings), SnapshotDependencies = _snapshotDependencyMapper.Map(buildType.SnapshotDependencies), Steps = _buildStepMapper.Map(buildType.Steps), Triggers = _buildTriggerMapper.Map(buildType.Triggers), VcsRootEntries = _vcsRootEntryMapper.Map(buildType.VcsRootEntries) }); }
public VcsRoot Map(VcsRootResponse vcsRoot) { if (vcsRoot == null) { return(null); } return(new VcsRoot { Href = vcsRoot.Href, Id = vcsRoot.Id, Name = vcsRoot.Name, VcsName = vcsRoot.VcsName, LastChecked = vcsRoot.LastChecked, Project = _projectMapper.Value.Map(vcsRoot.Project), Properties = _propertyMapper.Map(vcsRoot.Properties) }); }
/// <summary> /// Преобразовывает прикладной объект в объект xml-модели, используя указанный маппер. /// </summary> /// <param name="mapper"></param> /// <param name="appObject"></param> /// <returns></returns> private IEnumerable <ISync> GetXMLObjectByMapper(IPropertyMapper mapper, DataObject appObject) { IEnumerable <ISync> xmlObjects; try { //Преобразуем вычитанный изменнённый объект в его xml-представление. //TODO Проверить обработку мастеровых и детейловых объектов при маппинге. В маппинге используется дочитка, возможно сброситься состояние полученное при откате изменений. xmlObjects = mapper.Map(appObject).Cast <ISync>(); } catch (Exception ex) { throw new MappingException(appObject, ex.Message); } return(xmlObjects); }