/// <summary> /// The update references. /// </summary> /// <param name="maintainable"> /// The maintainable. /// </param> /// <param name="updateReferences"> /// The update references. /// </param> /// <param name="newVersionNumber"> /// The new version number. /// </param> /// <returns> /// The <see cref="IConceptSchemeObject"/>. /// </returns> public IConceptSchemeObject UpdateReferences( IConceptSchemeObject maintainable, IDictionary<IStructureReference, IStructureReference> updateReferences, string newVersionNumber) { IConceptSchemeMutableObject conceptScheme = maintainable.MutableInstance; if (!conceptScheme.Id.Equals(ConceptSchemeObject.DefaultSchemeId)) conceptScheme.Version = newVersionNumber; foreach (IConceptMutableObject concept in conceptScheme.Items) { this.UpdateRepresentationReference(concept.CoreRepresentation, updateReferences); } return conceptScheme.ImmutableInstance; }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM MUTABLE OBJECT ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="ConceptCore"/> class. /// </summary> /// <param name="parent"> /// The parent. /// </param> /// <param name="itemMutableObject"> /// The sdmxObject. /// </param> public ConceptCore(IConceptSchemeObject parent, IConceptMutableObject itemMutableObject) : base(itemMutableObject, parent) { if(itemMutableObject.CoreRepresentation != null && (itemMutableObject.CoreRepresentation.TextFormat != null || itemMutableObject.CoreRepresentation.Representation != null)) { this.coreRepresentation = new RepresentationCore(itemMutableObject.CoreRepresentation, this); } if (itemMutableObject.IsoConceptReference != null) { this.isoConceptReference = new CrossReferenceImpl(this, itemMutableObject.IsoConceptReference); } this.parentConcept = itemMutableObject.ParentConcept; this.parentAgency = itemMutableObject.ParentAgency; }
public ConceptSchemeObjectBaseCore(IConceptSchemeObject conceptSchemeType, IDictionary<IConceptObject, ICodelistObjectBase> representations) : base(conceptSchemeType) { if (conceptSchemeType == null) { throw new ModelException(Org.Sdmxsource.Sdmx.Api.Constants.ExceptionCode.JavaRequiredObjectNull, typeof(IConceptSchemeObject).FullName); } this._conceptScheme = conceptSchemeType; _concepts = new HashSet<IConceptObjectBase>(); if (conceptSchemeType.Items != null) { /* foreach */ foreach (IConceptObject currentConcept in conceptSchemeType.Items) { IConceptObjectBase concept = new ConceptObjectBaseCore( currentConcept, representations[currentConcept]); _concepts.Add(concept); } } }
/// <summary> /// Populate a Conceptscheme property of SDMXObjectBuilder for insert this in DataStructure response /// whitout calling all dataflows and whitout calling a list of concept /// </summary> public void BuildConcepts(string DataflowRealCode, List <IConceptObjectImpl> ListConcepts) { ConceptBuilder _conceptBuilder = new ConceptBuilder(this.ConceptSchemeNames, this.parsingObject, this.versionTypeResp); _conceptBuilder.Code = string.Format(FlyConfiguration.ConceptSchemeFormat, DataflowRealCode); _conceptBuilder.VersionTypeResp = this.versionTypeResp; if (!this.parsingObject.ReturnStub) { _conceptBuilder.Concepts = ListConcepts; } IConceptSchemeObject conceptScheme = _conceptBuilder.BuildConceptScheme(); this.ReferencesObject.ConceptSchemes.Add(conceptScheme); this.ReferencesObject.Concepts.Add(conceptScheme.Id, ListConcepts); }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V1.0 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="ConceptCore"/> class. /// </summary> /// <param name="parent"> /// The parent. /// </param> /// <param name="concept"> /// The sdmxObject. /// </param> public ConceptCore( IConceptSchemeObject parent, Org.Sdmx.Resources.SdmxMl.Schemas.V10.structure.ConceptType concept) : base( concept, SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Concept), concept.id, concept.uri, concept.Name, null, concept.Annotations, parent) { }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V2 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="ConceptCore"/> class. /// </summary> /// <param name="parent"> /// The parent. /// </param> /// <param name="concept"> /// The sdmxObject. /// </param> public ConceptCore( IConceptSchemeObject parent, Org.Sdmx.Resources.SdmxMl.Schemas.V20.structure.ConceptType concept) : base( concept, SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Concept), concept.id, concept.uri, concept.Name, concept.Description, concept.Annotations, parent) { if (!string.IsNullOrWhiteSpace(concept.coreRepresentation)) { string representationAgency = concept.coreRepresentationAgency; if (representationAgency == null) { representationAgency = parent.AgencyId; } string representationVersion = concept.CoreRepresentationVersionEstat ?? MaintainableObject.DefaultVersion; this.coreRepresentation = new RepresentationCore( concept.TextFormat, representationAgency, concept.coreRepresentation, representationVersion, this); } else if (concept.TextFormat != null) { this.coreRepresentation = new RepresentationCore(concept.TextFormat, null, null, null, this); } this.parentConcept = concept.parent; this.parentAgency = concept.parentAgency; }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V2.1 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="ConceptCore"/> class. /// </summary> /// <param name="parent"> /// The parent. /// </param> /// <param name="concept"> /// The sdmxObject. /// </param> public ConceptCore(IConceptSchemeObject parent, ConceptType concept) : base(concept, SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Concept), parent) { if (concept.CoreRepresentation != null) { this.coreRepresentation = new RepresentationCore(concept.CoreRepresentation, this); } if (concept.ISOConceptReference != null) { this.isoConceptReference = new CrossReferenceImpl( this, concept.ISOConceptReference.ConceptAgency, concept.ISOConceptReference.ConceptSchemeID, null, SdmxStructureEnumType.Concept, concept.ISOConceptReference.ConceptID); } var localItemReferenceType = concept.GetTypedParent<LocalConceptReferenceType>(); if (localItemReferenceType != null) { if (ObjectUtil.ValidCollection(localItemReferenceType.URN)) { IStructureReference structureReference = new StructureReferenceImpl(localItemReferenceType.URN[0]); this.parentConcept = structureReference.ChildReference.Id; this.parentAgency = structureReference.MaintainableReference.AgencyId; } else { this.parentConcept = localItemReferenceType.GetTypedRef<LocalConceptRefType>().id; this.parentAgency = this.MaintainableParent.AgencyId; } } }
/// <summary> /// Creates and returns a concept with the specified <paramref name="id"/>, <paramref name="name"/> and adds it to /// <paramref name="parent"/> /// </summary> /// <param name="parent"> /// The parent. /// </param> /// <param name="id"> /// The id. /// </param> /// <param name="name"> /// The name. /// </param> /// <returns> /// The <see cref="IConceptObject"/>. /// </returns> private static IConceptObject CreateConcept(IConceptSchemeObject parent, string id, string name) { var concept = new ConceptMutableCore { Id = id }; concept.AddName("en", name); //// parent.AddItem(concept); return new ConceptCore(parent, concept); }
private void SetGeneralTab(IConceptSchemeObject cs) { txtDSDID.Text = cs.Id; txtAgenciesReadOnly.Text = cs.AgencyId; txtVersion.Text = cs.Version; chkIsFinal.Checked = cs.IsFinal.IsTrue; FileDownload31.ucID = cs.Id; FileDownload31.ucAgency = cs.AgencyId; FileDownload31.ucVersion = cs.Version; FileDownload31.ucArtefactType = "ConceptScheme"; txtDSDURI.Text = (cs.Uri != null) ? cs.Uri.AbsoluteUri : string.Empty; txtDSDURN.Text = (cs.Urn != null) ? cs.Urn.AbsoluteUri : string.Empty; txtValidFrom.Text = (cs.StartDate != null) ? string.Format("{0}/{1}/{2}", cs.StartDate.Date.Value.Day.ToString(), cs.StartDate.Date.Value.Month.ToString(), cs.StartDate.Date.Value.Year.ToString()) : string.Empty; txtValidTo.Text = (cs.EndDate != null) ? string.Format("{0}/{1}/{2}", cs.EndDate.Date.Value.Day.ToString(), cs.EndDate.Date.Value.Month.ToString(), cs.EndDate.Date.Value.Year.ToString()) : string.Empty; txtDSDName.Text = _localizedUtils.GetNameableName(cs); txtDSDDescription.Text = _localizedUtils.GetNameableDescription(cs); // Svuoto le griglie name e description //=========================================== if (AddTextName.TextObjectList != null && AddTextName.TextObjectList.Count != 0) { AddTextName.ClearTextObjectList(); } if (AddTextDescription.TextObjectList != null && AddTextDescription.TextObjectList.Count != 0) { AddTextDescription.ClearTextObjectList(); } txtDSDID.Enabled = false; txtVersion.Enabled = false; cmbAgencies.Enabled = false; if (_action == Action.VIEW || cs.IsFinal.IsTrue) { AddTextName.Visible = false; AddTextDescription.Visible = false; txtAllDescriptions.Visible = true; txtAllNames.Visible = true; chkIsFinal.Enabled = false; txtAllDescriptions.Text = _localizedUtils.GetNameableDescription(cs); txtAllNames.Text = _localizedUtils.GetNameableName(cs); } else { AspConfirmationExit = "true"; AddTextName.Visible = true; AddTextDescription.Visible = true; txtAllDescriptions.Visible = false; txtAllNames.Visible = false; /* * DA IMPLEMENTARE L'ADDING NELLE GRIDS DI MASSIMILIANO */ AddTextName.InitTextObjectList = cs.Names; AddTextDescription.InitTextObjectList = cs.Descriptions; } if (_action != Action.VIEW) { DuplicateArtefact1.Visible = true; } AnnotationGeneralControl.AddText_ucOpenTabName = AnnotationGeneralControl.ClientID; AnnotationGeneralControl.AnnotationObjectList = cs.MutableInstance.Annotations; AnnotationGeneralControl.EditMode = (cs.IsFinal.IsTrue || _action == Action.VIEW) ? false : true; AnnotationGeneralControl.OwnerAgency = txtAgenciesReadOnly.Text; ctr_annotation_update.EditMode = (cs.IsFinal.IsTrue || _action == Action.VIEW) ? false : true; if (cs.IsFinal.IsTrue || _action == Action.VIEW) { txtValidFrom.Enabled = false; txtValidTo.Enabled = false; txtDSDName.Enabled = false; txtDSDDescription.Enabled = false; txtDSDURI.Enabled = false; chkIsFinal.Enabled = false; } else { txtValidFrom.Enabled = true; txtValidTo.Enabled = true; txtDSDName.Enabled = true; txtDSDDescription.Enabled = true; txtDSDURI.Enabled = true; chkIsFinal.Enabled = true; } //=========================================== if (_action == Action.INSERT) { cmbAgencies.Visible = true; txtAgenciesReadOnly.Visible = false; } else { cmbAgencies.Visible = false; txtAgenciesReadOnly.Visible = true; } SetCodeDetailPanel(cs); }
private void SetCodeDetailPanel(IConceptSchemeObject cs) { // Verifico se la codelist è final if (cs.IsFinal.IsTrue || _action == Action.VIEW) { // Se final il pulsante di add e le colonne di modifica // dei codici non devono apparire btnSaveMemoryConceptScheme.Visible = false; btnAddNewConcept.Visible = false; AddTextName_Update.ucEditMode = false; AddTextDescription_Update.ucEditMode = false; txt_parentid_update.Enabled = false; AnnotationGeneralControl.EditMode = false; btnSaveAnnotationCode.Enabled = false; btnUpdateConcept.Enabled = false; //gvConceptschemesItem.Columns[3].Visible = false; //gvConceptschemesItem.Columns[4].Visible = false; gvConceptschemesItem.Columns[5].Visible = false; cmbLanguageForCsv.Visible = false; imgImportCsv.Visible = false; } else { btnSaveMemoryConceptScheme.Visible = true; btnAddNewConcept.Visible = true; gvConceptschemesItem.Columns[3].Visible = true; gvConceptschemesItem.Columns[4].Visible = true; gvConceptschemesItem.Columns[5].Visible = true; Utils.PopulateCmbLanguages(cmbLanguageForCsv, AVAILABLE_MODES.MODE_FOR_ADD_TEXT); cmbLanguageForCsv.Visible = true; imgImportCsv.Visible = true; } }