/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V2.1 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="ReleaseCalendarCore"/> class. /// </summary> /// <param name="releaseCalendarType"> /// The release calendar type. /// </param> /// <param name="parent"> /// The parent. /// </param> public ReleaseCalendarCore(ReleaseCalendarType releaseCalendarType, IContentConstraintObject parent) : base(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.ReleaseCalendar), parent) { this.offset = releaseCalendarType.Offset; this.periodicity = releaseCalendarType.Periodicity; this.tolerance = releaseCalendarType.Tolerance; }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM IMMUTABLE OBJECT ////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="CubeRegionCore"/> class. /// </summary> /// <param name="mutable"> /// The mutable. /// </param> /// <param name="parent"> /// The parent. /// </param> public CubeRegionCore(ICubeRegionMutableObject mutable, IContentConstraintObject parent) : base(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.CubeRegion), parent) { this.keyValues = new List<IKeyValues>(); this.attributeValues = new List<IKeyValues>(); this.keyValues = new List<IKeyValues>(); if (ObjectUtil.ValidCollection(mutable.KeyValues)) { foreach (IKeyValuesMutable keyValuesMutable in mutable.KeyValues) { if (ObjectUtil.ValidCollection(keyValuesMutable.KeyValues)) { this.keyValues.Add(new KeyValuesCore(keyValuesMutable, this)); } } } this.attributeValues = new List<IKeyValues>(); if (ObjectUtil.ValidCollection(mutable.AttributeValues)) { foreach (IKeyValuesMutable keyValuesMutable in mutable.AttributeValues) { if (ObjectUtil.ValidCollection(keyValuesMutable.KeyValues)) { this.attributeValues.Add(new KeyValuesCore(keyValuesMutable, this)); } } } }
public MetadataTargetRegionCore(IMetadataTargetRegionMutableObject mutable, IContentConstraintObject parent) : base(mutable, parent) { _key = new List<IMetadataTargetKeyValues>(); _attributes = new List<IKeyValues>(); this._report = mutable.Report; this._metadataTarget = mutable.MetadataTarget; if (mutable.Key != null) { foreach (IMetadataTargetKeyValuesMutable currentMetadataTarget in mutable.Key) { this._key.Add(new MetadataTargetKeyValuesCore(currentMetadataTarget, this)); } } if (mutable.Attributes != null) { foreach (IKeyValuesMutable currentKeyValue in mutable.Attributes) { this._attributes.Add(new KeyValuesCore(currentKeyValue, this)); } } try { Validate(); } catch (SdmxSemmanticException e) { throw new SdmxSemmanticException(e, ExceptionCode.FailValidation, this); } }
public MetadataTargetRegionCore(MetadataTargetRegionType type, IContentConstraintObject parent) : base(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.MetadataTargetRegion), parent) { _key = new List<IMetadataTargetKeyValues>(); _attributes = new List<IKeyValues>(); this._isInclude = type.include; this._report = type.Report; this._metadataTarget = type.MetadataTarget; var metadataTargetRegionKeyTypes = type.GetTypedKeyValue<MetadataTargetRegionKeyType>(); if (metadataTargetRegionKeyTypes != null) { foreach (MetadataTargetRegionKeyType cv in metadataTargetRegionKeyTypes) { this._key.Add(new MetadataTargetKeyValuesCore(cv, this)); } } var metadataAttributeValueSetTypes = type.GetTypedAttribute<MetadataAttributeValueSetType>(); if (metadataAttributeValueSetTypes != null) { foreach (var cv in metadataAttributeValueSetTypes) { this._attributes.Add(new KeyValuesCore(cv, this)); } } try { Validate(); } catch (SdmxSemmanticException e) { throw new SdmxSemmanticException(e, ExceptionCode.FailValidation, this); } }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM MUTABLE OBJECT ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="ReleaseCalendarCore"/> class. /// </summary> /// <param name="mutable"> /// The mutable. /// </param> /// <param name="parent"> /// The parent. /// </param> public ReleaseCalendarCore(IReleaseCalendarMutableObject mutable, IContentConstraintObject parent) : base(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.ReleaseCalendar), parent) { if (mutable != null) { this.offset = mutable.Offset; this.periodicity = mutable.Periodicity; this.tolerance = mutable.Tolerance; } }
public ReferenceValueObjectBaseCore(IReferenceValue builtFrom, IIdentifiableRetrievalManager retrievalManager) : base(builtFrom) { this.builtFrom = builtFrom; if (builtFrom.IdentifiableReference != null) { identifiableReference = retrievalManager.GetIdentifiableObject(builtFrom.GetIdentifiableReference()); } if (builtFrom.ContentConstraintReference != null) { contentConstraintReference = retrievalManager.GetIdentifiableObject<IContentConstraintObject>( builtFrom.ContentConstraintReference, typeof(IContentConstraintObject)); } }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM MUTABLE OBJECT ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="ReferencePeriodCore"/> class. /// </summary> /// <param name="mutable"> /// The mutable. /// </param> /// <param name="parent"> /// The parent. /// </param> /// <exception cref="SdmxSemmanticException"> /// Throws Validate exception. /// </exception> public ReferencePeriodCore(IReferencePeriodMutableObject mutable, IContentConstraintObject parent) : base(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.ReferencePeriod), parent) { // These items are mandatory and thus should exist if (mutable.StartTime != null) { this.startTime = new SdmxDateCore(mutable.StartTime, TimeFormatEnumType.DateTime); } if (mutable.EndTime != null) { this.endTime = new SdmxDateCore(mutable.EndTime, TimeFormatEnumType.DateTime); } if (this.startTime == null) { throw new SdmxSemmanticException("ReferencePeriodCore - start time can not be null"); } if (this.endTime == null) { throw new SdmxSemmanticException("ReferencePeriodCore - end time can not be null"); } }
/// <summary> /// Adds code references. /// </summary> /// <param name="constraintBean"> /// The constraint object. /// </param> /// <param name="returnReferences"> /// The returned references. /// </param> /// <param name="codelistRef"> /// The code list reference object. /// </param> /// <param name="codeIds"> /// The code ids. /// </param> private void AddCodeReferences(IContentConstraintObject constraintBean, ISet<ICrossReference> returnReferences, ICrossReference codelistRef, ICollection<string> codeIds) { string agencyId = codelistRef.AgencyId; string codelistId = codelistRef.MaintainableId; string version = codelistRef.Version; foreach (string codeId in codeIds) { ICrossReference codeRef = new CrossReferenceImpl(constraintBean, agencyId, codelistId, version, SdmxStructureEnumType.Code, codeId); returnReferences.Add(codeRef); } }
/// <summary> /// Gets the codes list reference for a component. /// </summary> /// <param name="constraintBean"> /// The constraint object. /// </param> /// <param name="componentId"> /// The component id. /// </param> /// <param name="componentMap"> /// The components map. /// </param> /// <returns> /// The cross reference object. /// </returns> private ICrossReference GetCodelistReferenceForComponent(IContentConstraintObject constraintBean, string componentId, IDictionary<string, IComponent> componentMap) { IComponent component = componentMap[componentId]; if (component == null) throw new SdmxSemmanticException("Constraint '" + constraintBean + "' references component which can not be resolved: '" + componentId + "'"); if (component.Representation == null || component.Representation.Representation == null) { //TODO THink about whether we allow to constraint uncoded components //throw new SdmxSemmanticException("Can not constrain component with id '"componentId"' as it is not a coded " component.getStructureType().getType()); return null; } return component.Representation.Representation; }
/// <summary> /// Adds cross references for a cube region to components map. /// </summary> /// <param name="constraintBean"> /// The constraint object /// </param> /// <param name="returnReferences"> /// The returned references /// </param> /// <param name="componentMap"> /// The components map /// </param> /// <param name="keyValues"> /// The key values /// </param> private void AddCrossReferencesForCubeRegion(IContentConstraintObject constraintBean, ISet<ICrossReference> returnReferences, IDictionary<string, IComponent> componentMap, IList<IKeyValues> keyValues) { foreach (IKeyValues kvs in keyValues) { ICrossReference codelistRef = GetCodelistReferenceForComponent(constraintBean, kvs.Id, componentMap); if (codelistRef == null) return; AddCodeReferences(constraintBean, returnReferences, codelistRef, kvs.Values); } }
/// <summary> /// Adds cross references for a cube region to components map. /// </summary> /// <param name="constraintBean"> /// The constraint object /// </param> /// <param name="returnReferences"> /// The returned references /// </param> /// <param name="componentMap"> /// The components map /// </param> /// <param name="cubeRegionBean"> /// The cube region object /// </param> private void AddCrossReferencesForCubeRegion(IContentConstraintObject constraintBean, ISet<ICrossReference> returnReferences, IDictionary<String, IComponent> componentMap, ICubeRegion cubeRegionBean) { if (cubeRegionBean == null) return; AddCrossReferencesForCubeRegion(constraintBean, returnReferences, componentMap, cubeRegionBean.KeyValues); AddCrossReferencesForCubeRegion(constraintBean, returnReferences, componentMap, cubeRegionBean.AttributeValues); }
/// <summary> /// Adds cross references for a constraint key to components map. /// </summary> /// <param name="constraintBean"> /// The constraint object /// </param> /// <param name="returnReferences"> /// The returned references /// </param> /// <param name="componentMap"> /// The components map /// </param> /// <param name="constraintDataKey"> /// The constraint data key /// </param> private void AddCrossReferencesForConstraintKey(IContentConstraintObject constraintBean, ISet<ICrossReference> returnReferences, IDictionary<String, IComponent> componentMap, IConstraintDataKeySet constraintDataKey) { if (constraintDataKey == null) return; IDictionary<string, ISet<string>> componentCodeMap = new Dictionary<string, ISet<string>>(); foreach (IConstrainedDataKey cdk in constraintDataKey.ConstrainedDataKeys) { foreach (IKeyValue kv in cdk.KeyValues) { ISet<string> componentCodes = componentCodeMap[kv.Concept]; if (componentCodes == null) { componentCodes = new HashSet<String>(); componentCodeMap.Add(kv.Concept, componentCodes); } componentCodes.Add(kv.Code); } } foreach (string currentComponentId in componentCodeMap.Keys) { ICrossReference codelistRef = GetCodelistReferenceForComponent(constraintBean, currentComponentId, componentMap); if (codelistRef == null) return; AddCodeReferences(constraintBean, returnReferences, codelistRef, componentCodeMap[currentComponentId]); } }
/// <summary> /// Returns the set of cross referenced structures. /// </summary> /// <param name="retrievalManager"> /// The retrieval manager /// </param> /// <param name="constraintBean"> /// The constraint object /// </param> /// <returns> /// The cross references set. /// </returns> private ISet<ICrossReference> GetCrossReferences(ISdmxObjectRetrievalManager retrievalManager, IContentConstraintObject constraintBean) { ISet<ICrossReference> returnReferences = constraintBean.CrossReferences; IDictionary<string, IComponent> componentMap = new Dictionary<String, IComponent>(); foreach (ICrossReference crossRef in constraintBean.ConstraintAttachment.StructureReference) { switch (crossRef.TargetReference.EnumType) { case SdmxStructureEnumType.ProvisionAgreement: case SdmxStructureEnumType.Dataflow: case SdmxStructureEnumType.Dsd: AddComponenents(retrievalManager, crossRef, componentMap); break; case SdmxStructureEnumType.DataProvider: //Important: //It is important to get this from the BeanRetrievalManager and not the ProvisionRetrievalManager //As the ProvisionRetrievalManager relies on CrossReferecnce retrieval, which may not have been built yet (as //This class is responsible for aiding the building of cross references foreach (IProvisionAgreementObject currentProv in _beanRetrievalManager.GetMaintainableObjects<IProvisionAgreementObject>()) { if (currentProv.DataproviderRef.TargetUrn.Equals(crossRef.TargetUrn)) { AddComponenents(retrievalManager, currentProv.StructureUseage, componentMap); } } foreach (IProvisionAgreementObject currentProv in retrievalManager.GetMaintainableObjects<IProvisionAgreementObject>()) { if (currentProv.DataproviderRef.TargetUrn.Equals(crossRef.TargetUrn)) { AddComponenents(retrievalManager, currentProv.StructureUseage, componentMap); } } break; } } AddCrossReferencesForCubeRegion(constraintBean, returnReferences, componentMap, constraintBean.IncludedCubeRegion); AddCrossReferencesForCubeRegion(constraintBean, returnReferences, componentMap, constraintBean.ExcludedCubeRegion); AddCrossReferencesForConstraintKey(constraintBean, returnReferences, componentMap, constraintBean.IncludedSeriesKeys); AddCrossReferencesForConstraintKey(constraintBean, returnReferences, componentMap, constraintBean.ExcludedSeriesKeys); return returnReferences; }
/// <summary> /// Initializes a new instance of the <see cref="ConstrainableStructureReference"/> class. /// </summary> /// <param name="structureReference"> /// The structure Reference. /// </param> /// <param name="constraint"> /// The constraint. /// </param> public ConstrainableStructureReference(IStructureReference structureReference, IContentConstraintObject constraint) : base(structureReference.MaintainableReference, structureReference.TargetReference) { this._constraint = constraint; }
/// <summary> /// The create mutable instance. /// </summary> /// <param name="parent"> /// The parent. /// </param> /// <returns> /// The <see cref="ICubeRegion"/> . /// </returns> public ICubeRegion CreateMutableInstance(IContentConstraintObject parent) { return new CubeRegionCore(this, parent); }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V2.1 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="ReferencePeriodCore"/> class. /// </summary> /// <param name="refPeriodType"> /// The ref period type. /// </param> /// <param name="parent"> /// The parent. /// </param> /// <exception cref="SdmxSemmanticException"> /// Throws Validate exception. /// </exception> public ReferencePeriodCore(ReferencePeriodType refPeriodType, IContentConstraintObject parent) : base(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.ReferencePeriod), parent) { this.startTime = new SdmxDateCore(refPeriodType.startTime, TimeFormatEnumType.DateTime); this.endTime = new SdmxDateCore(refPeriodType.endTime, TimeFormatEnumType.DateTime); if (this.startTime == null) { throw new SdmxSemmanticException("ReferencePeriodCore - start time can not be null"); } if (this.endTime == null) { throw new SdmxSemmanticException("ReferencePeriodCore - start time can not be null"); } }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V2.1 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="CubeRegionCore"/> class. /// </summary> /// <param name="cubeRegionType"> /// The cube region type. /// </param> /// <param name="negate"> /// The negate. /// </param> /// <param name="parent"> /// The parent. /// </param> public CubeRegionCore(CubeRegionType cubeRegionType, bool negate, IContentConstraintObject parent) : base(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.CubeRegion), parent) { this.keyValues = new List<IKeyValues>(); this.attributeValues = new List<IKeyValues>(); { var attributeValueSetTypes = cubeRegionType.GetTypedAttribute<AttributeValueSetType>(); if (attributeValueSetTypes != null) { foreach (AttributeValueSetType valueSetType in attributeValueSetTypes) { if (!valueSetType.include) { if (negate) { this.attributeValues.Add(new KeyValuesCore(valueSetType, this)); } } else if (!negate) { this.attributeValues.Add(new KeyValuesCore(valueSetType, this)); } } } } var cubeRegionKeyTypes = cubeRegionType.GetTypedKeyValue<CubeRegionKeyType>(); if (cubeRegionKeyTypes != null) { foreach (var valueSetType0 in cubeRegionKeyTypes) { if (!valueSetType0.include) { if (negate) { this.keyValues.Add(new KeyValuesCore(valueSetType0, this)); } } else if (!negate) { this.keyValues.Add(new KeyValuesCore(valueSetType0, this)); } } } }
/// <summary> /// Initializes a new instance of the <see cref="ConstrainableStructureReference"/> class. /// </summary> /// <param name="agencyId"> /// The agency id. /// </param> /// <param name="maintainableId"> /// The maintainable id. /// </param> /// <param name="version"> /// The version. /// </param> /// <param name="targetStructureEnum"> /// The target structure type. /// </param> /// <param name="identfiableIds"> /// The identifiable ids. /// </param> /// <param name="constraint"> /// The constraint. /// </param> public ConstrainableStructureReference( string agencyId, string maintainableId, string version, SdmxStructureType targetStructureEnum, IList<string> identfiableIds, IContentConstraintObject constraint) : base(agencyId, maintainableId, version, targetStructureEnum, identfiableIds) { this._constraint = constraint; }
private void SetGeneralTab(IContentConstraintObject cc) { if (!cc.Id.Contains(_ntdString)) txtCCID.Text = cc.Id; cmbAgencies.SelectedValue = cc.AgencyId; txtAgenciesReadOnly.Text = cc.AgencyId; AnnotationGeneral.OwnerAgency = txtAgenciesReadOnly.Text; if (cc.Version != _ntdCCVersion) txtVersion.Text = cc.Version; chkIsFinal.Checked = cc.IsFinal.IsTrue; if (cc.Uri != null) txtURI.Text = cc.Uri.AbsoluteUri; if (!cc.Urn.ToString().Contains(_ntdString)) txtURN.Text = cc.Urn.AbsoluteUri; if (cc.StartDate != null) txtValidFrom.Text = cc.StartDate.Date.ToString(); if (cc.EndDate != null) txtValidTo.Text = cc.EndDate.Date.ToString(); txtCCName.Text = _localizedUtils.GetNameableName(cc); txtCCDescription.Text = _localizedUtils.GetNameableDescription(cc); if (!Utils.ViewMode && _action != Action.INSERT) { DuplicateArtefact1.Visible = true; } if (_action != Action.VIEW) { IContentConstraintMutableObject ccM = cc.MutableInstance; foreach (ITextTypeWrapperMutableObject name in ccM.Names) { if (name.Value.Contains(_ntdString)) { ccM.Names.Remove(name); break; } } AddTextName.InitTextObjectMutableList = ccM.Names; AddTextDescription.InitTextObjectList = cc.Descriptions; } AnnotationGeneral.AnnotationObjectList = cc.MutableInstance.Annotations; if ( _action == Action.INSERT ) { cmbAgencies.Visible = true; txtAgenciesReadOnly.Visible = false; } else { cmbAgencies.Visible = false; txtAgenciesReadOnly.Visible = true; } }
/// <summary> /// Initializes a new instance of the <see cref="ConstrainableStructureReference"/> class. /// </summary> /// <param name="urn"> /// The urn. /// </param> /// <param name="constraint"> /// The constraint. /// </param> public ConstrainableStructureReference(string urn, IContentConstraintObject constraint) : base(urn) { this._constraint = constraint; }
/// <summary> /// The update references. /// </summary> /// <param name="maintianable"> /// The maintianable. /// </param> /// <param name="updateReferences"> /// The update references. /// </param> /// <param name="newVersionNumber"> /// The new version number. /// </param> /// <returns> /// The <see cref="IContentConstraintObject"/>. /// </returns> public IContentConstraintObject UpdateReferences(IContentConstraintObject maintianable, IDictionary<IStructureReference, IStructureReference> updateReferences, string newVersionNumber) { return null; }
/// <summary> /// Initializes a new instance of the <see cref="ConstrainableStructureReference"/> class. /// </summary> /// <param name="crossReference"> /// The cross reference. /// </param> /// <param name="structureEnumType"> /// The structure type. /// </param> /// <param name="constraint"> /// The constraint. /// </param> public ConstrainableStructureReference(IMaintainableRefObject crossReference, SdmxStructureEnumType structureEnumType, IContentConstraintObject constraint) : base(crossReference, structureEnumType) { this._constraint = constraint; }