/// <summary> /// Delete the specified <paramref name="objects"/> from Mapping Store if they exist. /// </summary> /// <param name="objects"> /// The objects. /// </param> /// <typeparam name="T"> The type of maintainable object</typeparam> protected void DeleteObjects <T>(IEnumerable <T> objects) where T : IMaintainableObject { foreach (var maintainableObject in objects) { using (DbTransactionState state = DbTransactionState.Create(this._database)) { try { IStructureReference structureReference = maintainableObject.AsReference; var status = GetFinalStatus(state, structureReference); if (status != null && status.PrimaryKey > 0) { _log.DebugFormat(CultureInfo.InvariantCulture, "Deleting artefact record {0}.", structureReference.GetAsHumanReadableString()); this.Delete(state, status.PrimaryKey); } else { _log.WarnFormat(CultureInfo.InvariantCulture, "Failed to delete artefact record {0}.", structureReference.GetAsHumanReadableString()); } state.Commit(); } catch (Exception e) { state.RollBack(); _log.Error(maintainableObject.Urn, e); throw; } } } }
/// <summary> /// Gets a maintainable defined by the StructureQueryObject parameter. /// <p/> /// Expects only ONE maintainable to be returned from this query /// </summary> /// <param name="sRref"> /// The query. /// </param> /// <param name="returnStub"> /// If true then a stub object will be returned /// </param> /// <returns> /// The <see cref="IMaintainableObject"/> . /// </returns> /// <exception cref="NotImplementedException"> /// Not implemented. /// </exception> public IMaintainableObject GetMaintainable(IStructureReference sRref, bool returnStub) { IMaintainableRefObject xref = sRref.MaintainableReference; switch (sRref.MaintainableStructureEnumType.EnumType) { case SdmxStructureEnumType.ContentConstraint: return(this.GetContentConstraint(xref)); case SdmxStructureEnumType.Categorisation: return(this.GetCategorisation(xref)); case SdmxStructureEnumType.CategoryScheme: return(this.GetCategoryScheme(xref)); case SdmxStructureEnumType.CodeList: return(this.GetCodelist(xref)); case SdmxStructureEnumType.ConceptScheme: return(this.GetConceptScheme(xref)); case SdmxStructureEnumType.Dataflow: return(this.GetDataflow(xref)); case SdmxStructureEnumType.HierarchicalCodelist: return(this.GetHierarchicCodeList(xref)); case SdmxStructureEnumType.Dsd: return(this.GetDataStructure(xref)); default: throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.GetMaintainableFromSdmxObject, new Exception(sRref.MaintainableStructureEnumType.EnumType.ToString())); } }
/// <summary> /// Return a <see cref="ICategorisationObject"/> with the specified <paramref name="categoryReference"/> and <paramref name="structureReference"/> /// </summary> /// <param name="categoryReference"> /// The category reference. /// </param> /// <param name="structureReference"> /// The structure reference. /// </param> /// <returns> /// The <see cref="ICategorisationObject"/>. /// </returns> public ICategorisationObject Build(IStructureReference categoryReference, IStructureReference structureReference) { ICategorisationMutableObject mutable = new CategorisationMutableCore(); mutable.CategoryReference = categoryReference; mutable.StructureReference = structureReference; var structureRef = structureReference.MaintainableReference; var categorySchemeRef = categoryReference.MaintainableReference; string name = string.Format( CultureInfo.InvariantCulture, "{0}@{1}@{2}@{3}@{4}@{5}", structureRef.MaintainableId, structureRef.AgencyId, structureRef.Version, categorySchemeRef.MaintainableId, categorySchemeRef.Version, categoryReference.ChildReference.Id).Replace(".", string.Empty); mutable.Id = name.Length > 50 ? BuildHash(name) : name; mutable.Version = "1.0"; mutable.AgencyId = categorySchemeRef.AgencyId; mutable.AddName("en", name); return(mutable.ImmutableInstance); }
/// <summary> /// Sends the specified <paramref name="reference"/> to the Web Service defined by <see cref="_config"/> /// </summary> /// <param name="reference"> /// The reference /// </param> /// <param name="resolveReferences"> /// The resolve references /// </param> public ISdmxObjects SendQueryStructureRequest(IStructureReference reference, bool resolveReferences) { IList <IStructureReference> refs = new List <IStructureReference>(); refs.Add(reference); return(SendQueryStructureRequest(refs, resolveReferences)); }
/// <summary> /// Gets the CodeList status. /// </summary> /// <param name="state"> /// The state. /// </param> /// <param name="reference"> /// The reference. /// </param> /// <param name="itemScheme"> /// The item scheme. /// </param> /// <returns> /// The <see cref="ItemSchemeFinalStatus"/>. /// </returns> public ItemSchemeFinalStatus GetReferenceStatus(DbTransactionState state, IStructureReference reference, StructureCache itemScheme) { ItemSchemeFinalStatus codelistStatus = itemScheme.GetStructure(state, reference); this.ValidateFinalStatus(codelistStatus.FinalStatus, reference); return(codelistStatus); }
/// <summary> /// Gets the structure. /// </summary> /// <param name="state">The state.</param> /// <param name="reference">The reference.</param> /// <returns>The <see cref="ItemStatusCollection"/></returns> public ItemSchemeFinalStatus GetStructure(DbTransactionState state, IStructureReference reference) { ItemSchemeFinalStatus returnObjet; if (!this._dictionary.TryGetValue(reference, out returnObjet)) { var artefactFinalStatus = ArtefactBaseEngine.GetFinalStatus(state, reference); ItemStatusCollection collection = null; if (artefactFinalStatus != null && artefactFinalStatus.IsFinal && reference.HasChildReference()) { switch (reference.TargetReference.EnumType) { case SdmxStructureEnumType.Component: case SdmxStructureEnumType.Dimension: case SdmxStructureEnumType.TimeDimension: case SdmxStructureEnumType.MeasureDimension: case SdmxStructureEnumType.DataAttribute: case SdmxStructureEnumType.PrimaryMeasure: case SdmxStructureEnumType.CrossSectionalMeasure: var map = GetComponentMapIds(state, reference); collection = new ItemStatusCollection(map.Select(pair => new ItemStatus(pair.Key, pair.Value))); break; default: collection = GetId(state, reference.TargetReference.EnumType, artefactFinalStatus.PrimaryKey); break; } } returnObjet = new ItemSchemeFinalStatus(artefactFinalStatus ?? ArtefactFinalStatus.Empty, collection); } return(returnObjet); }
/// <summary> /// Initializes a new instance of the <see cref="DatasetStructureReferenceCore"/> class. /// Minimal Constructor /// </summary> /// <param name="structureReference">CategorisationStructure reference object /// </param> public DatasetStructureReferenceCore(IStructureReference structureReference) { this._dimensionAtObservation = DimensionObject.TimeDimensionFixedId; this._structureReference = structureReference; this.Validate(); }
/// <summary> /// Gets the component map ids. /// </summary> /// <param name="state"> /// The state. /// </param> /// <param name="dsdReference"> /// The DSD reference. /// </param> /// <returns> /// The component id to primary key value dictionary /// </returns> public static IDictionary<string, long> GetComponentMapIds(DbTransactionState state, IStructureReference dsdReference) { IDictionary<string, long> map = new Dictionary<string, long>(StringComparer.Ordinal); var idParameter = state.Database.CreateInParameter("p_id", DbType.AnsiString, dsdReference.MaintainableId); var agencyParameter = state.Database.CreateInParameter("p_agency", DbType.AnsiString, dsdReference.AgencyId); var versionParameter = state.Database.CreateInParameter("p_version", DbType.AnsiString, dsdReference.Version); var queryFormat = dsdReference.MaintainableStructureEnumType.EnumType == SdmxStructureEnumType.Dsd ? "select c.COMP_ID, c.ID from COMPONENT c inner join ARTEFACT_VIEW a on a.ART_ID = c.DSD_ID where a.ID = {0} and a.AGENCY = {1} and a.VERSION = {2}" : "select c.COMP_ID, c.ID from COMPONENT c inner join DATAFLOW d on d.DSD_ID = c.DSD_ID inner join ARTEFACT_VIEW a on a.ART_ID = d.DF_ID where a.ID = {0} and a.AGENCY = {1} and a.VERSION = {2}"; using (var command = state.Database.GetSqlStringCommandFormat(queryFormat, idParameter, agencyParameter, versionParameter)) using (var reader = state.Database.ExecuteReader(command)) { var sysIdOrdinal = reader.GetOrdinal("COMP_ID"); var idOrdinal = reader.GetOrdinal("ID"); while (reader.Read()) { map.Add(reader.GetString(idOrdinal), reader.GetInt64(sysIdOrdinal)); } } return map; }
/// <summary> /// Retrieve the primary key from mapping store for the given <paramref name="structureReference"/> /// </summary> /// <param name="structureReference"> /// The structure reference. /// </param> /// <returns> /// The primary key value; otherwise <c>-1</c>. /// </returns> public long Retrieve(IStructureReference structureReference) { var maintainableRef = structureReference.MaintainableReference; var splitVersion = maintainableRef.SplitVersion(3); var tableInfo = this._tableInfoBuilder.Build(structureReference.MaintainableStructureEnumType.EnumType); var parameters = new List <DbParameter>(); var query = string.Format( CultureInfo.InvariantCulture, SqlQueryFromRef, this._mappingStoreDatabase.BuildParameterName("ID"), this._mappingStoreDatabase.BuildParameterName("AGENCY"), this._mappingStoreDatabase.BuildParameterName("VERSION1"), this._mappingStoreDatabase.BuildParameterName("VERSION2"), this._mappingStoreDatabase.BuildParameterName("VERSION3"), tableInfo.PrimaryKey, tableInfo.Table); parameters.Add(this._mappingStoreDatabase.CreateInParameter("ID", DbType.AnsiString, maintainableRef.HasMaintainableId() ? (object)maintainableRef.MaintainableId : DBNull.Value)); parameters.Add(this._mappingStoreDatabase.CreateInParameter("AGENCY", DbType.AnsiString, maintainableRef.HasAgencyId() ? (object)maintainableRef.AgencyId : DBNull.Value)); // TODO fix that after the conclusion of MAT-579 parameters.Add(this._mappingStoreDatabase.CreateInParameter("VERSION1", DbType.Int64, splitVersion[0].ToDbValue())); parameters.Add(this._mappingStoreDatabase.CreateInParameter("VERSION2", DbType.Int64, splitVersion[1].ToDbValue(0))); parameters.Add(this._mappingStoreDatabase.CreateInParameter("VERSION3", DbType.Int64, splitVersion[2].ToDbValue())); var executeScalar = this._mappingStoreDatabase.ExecuteScalar(query, parameters); return(executeScalar is long?(long)executeScalar : -1); }
/// <summary> /// Return a <see cref="ICategorisationObject"/> with the specified <paramref name="categoryReference"/> and <paramref name="structureReference"/> /// </summary> /// <param name="categoryReference"> /// The category reference. /// </param> /// <param name="structureReference"> /// The structure reference. /// </param> /// <returns> /// The <see cref="ICategorisationObject"/>. /// </returns> public ICategorisationObject Build(IStructureReference categoryReference, IStructureReference structureReference) { ICategorisationMutableObject mutable = new CategorisationMutableCore(); mutable.CategoryReference = categoryReference; mutable.StructureReference = structureReference; var structureRef = structureReference.MaintainableReference; var categorySchemeRef = categoryReference.MaintainableReference; string name = string.Format( CultureInfo.InvariantCulture, "{0}@{1}@{2}@{3}@{4}@{5}", structureRef.MaintainableId, structureRef.AgencyId, structureRef.Version, categorySchemeRef.MaintainableId, categorySchemeRef.Version, categoryReference.ChildReference.Id).Replace(".", string.Empty); mutable.Id = name.Length > 50 ? BuildHash(name) : name; mutable.Version = "1.0"; mutable.AgencyId = categorySchemeRef.AgencyId; mutable.AddName("en", name); return mutable.ImmutableInstance; }
/// <summary> /// Returns an error message with the specified <paramref name="format"/> for <paramref name="reference"/> /// </summary> /// <param name="format"> /// The format. /// </param> /// <param name="reference"> /// The component. /// </param> /// <returns> /// The error message. /// </returns> private static string GetError(string format, IStructureReference reference) { IMaintainableRefObject maintainableRefObject = reference.MaintainableReference; return(reference.HasChildReference() ? string.Format(format, maintainableRefObject.MaintainableId, maintainableRefObject.AgencyId, maintainableRefObject.Version, reference.ChildReference.Id) : string.Format(format, maintainableRefObject.MaintainableId, maintainableRefObject.AgencyId, maintainableRefObject.Version)); }
/// <summary> /// Initializes a new instance of the <see cref="RESTStructureQueryCore"/> class. /// Creation of a Structure Query for structures that match the given reference /// </summary> /// <param name="structureReference"> /// The structure reference. /// </param> public RESTStructureQueryCore(IStructureReference structureReference) { this._structureReference = structureReference; if(structureReference.Version != null) { _structureQueryMetadata = new StructureQueryMetadataCore(StructureQueryDetail.GetFromEnum(StructureQueryDetailEnumType.Null), null, null, false); } }
/// <summary> /// Initializes a new instance of the <see cref="InputOutputMutableCore"/> class. /// </summary> /// <param name="inputOutputObject"> /// The inputOutputObject. /// </param> public InputOutputMutableCore(IInputOutputObject inputOutputObject) : base(inputOutputObject) { this._localId = inputOutputObject.LocalId; if (inputOutputObject.StructureReference != null) { this._structureReference = inputOutputObject.StructureReference.CreateMutableInstance(); } }
public DataSetReferenceMutableObjectCore(IDataSetReference createdFrom) : base(createdFrom) { if (createdFrom.DataProviderReference != null) { this.dataProviderRef = new StructureReferenceImpl(createdFrom.DataProviderReference.TargetUrn); } this.datasetId = createdFrom.DatasetId; }
public RESTSchemaQueryCore(IStructureReference reference, string dimAtObs, bool explicitMeasure) { this._reference = reference; if(ObjectUtil.ValidString(dimAtObs)) { this._dimAtObs = dimAtObs; } this._explicitMeasure = explicitMeasure; }
/// <summary> /// Initializes a new instance of the <see cref="IdentifiableRefObjetcImpl"/> class. /// </summary> /// <param name="maintainableParent"> /// The maintainable parent. /// </param> /// <param name="id"> /// The id. /// </param> /// <param name="targetStructureEnumType"> /// The target structure enum type. /// </param> public IdentifiableRefObjetcImpl( IStructureReference maintainableParent, string id, SdmxStructureType targetStructureEnumType) { this._structureEnumType = targetStructureEnumType; this._maintainableParent = maintainableParent; this._id = id; Validate(); }
/// <summary> /// Returns a set of super beans that match the query parameter /// </summary> /// /// <param name="structureQuery"></param> /// <returns></returns> private IObjectsBase IGetObjectsBase(IStructureReference xref) { ISet<IMaintainableObject> maintainables = this.SdmxObjectRetrievalManager .GetMaintainableWithReferences(xref); ISdmxObjects beans = new SdmxObjectsImpl(null, maintainables); if (superBeanBuilder == null) { throw new Exception( "SuperBeansBuilder not set, ISdmxBaseObjectRetrievalManagerImpl is @Configurable please ensure AspectJ weaving is enabled"); } return superBeanBuilder.Build(beans); }
/// <summary> /// Make a key for <see cref="ConceptBean"/> /// </summary> /// <param name="component"> /// The <see cref="ComponentBean"/> containing the concept reference /// </param> /// <returns> /// The key for concept. /// </returns> public static string MakeKeyForConcept(IComponent component) { IStructureReference concept = component.ConceptRef; return(MakeKey( concept.ChildReference.Id, concept.MaintainableReference.MaintainableId, concept.MaintainableReference.AgencyId, concept.MaintainableReference.Version)); }
////// PRIVATE CONSTRUCTOR ///// TODO java 0.9.1 has private ctor that is not accessed anywhere ////#region Constructors and Destructors /////// <summary> /////// Prevents a default instance of the <see cref="SubmitStructureResponseBuilderV2"/> class from being created. /////// </summary> ////private SubmitStructureResponseBuilderV2() ////{ ////} ////#endregion #region Public Methods and Operators /// <summary> /// The build error response. /// </summary> /// <param name="exception"> /// The exception. /// </param> /// <param name="errorBean"> /// The error bean. /// </param> /// <returns> /// The <see cref="RegistryInterface"/>. /// </returns> public RegistryInterface BuildErrorResponse(Exception exception, IStructureReference errorBean) { var responseType = new RegistryInterface(); RegistryInterfaceType regInterface = responseType.Content; V2Helper.Header = regInterface; var returnType = new SubmitStructureResponseType(); regInterface.SubmitStructureResponse = returnType; ProcessMaintainable(returnType, errorBean, exception); return responseType; }
/// <summary> /// Initializes a new instance of the <see cref="GroupMutableCore"/> class. /// </summary> /// <param name="objTarget"> /// The obj target. /// </param> public GroupMutableCore(IGroup objTarget) : base(objTarget) { if (objTarget.AttachmentConstraintRef != null) { this._attachmentConstraintRef = objTarget.AttachmentConstraintRef; } this._dimensionRef = objTarget.DimensionRefs; }
/// <summary> /// Gets the mutable maintainable. /// </summary> /// <param name="structureReference">The structure reference.</param> /// <param name="allowedDataflows">The allowed dataflows.</param> /// <param name="returnStub">if set to <c>true</c> [return stub].</param> /// <returns>The mutable maintainable or null</returns> private IMaintainableMutableObject GetMutableMaintainable(IStructureReference structureReference, IList <IMaintainableRefObject> allowedDataflows, bool returnStub = false) { if (this._retrievalManager != null) { return(this._retrievalManager.GetMutableMaintainable(structureReference, false, returnStub, allowedDataflows)); } var complexStructureQueryDetail = ComplexStructureQueryDetail.GetFromEnum(returnStub.GetComplexQueryDetail()); return(this._retrievalAdvancedManager.GetMutableMaintainable(structureReference.ToComplex(), complexStructureQueryDetail, allowedDataflows)); }
public virtual ISet<ISubscriptionMutableObject> GetSubscriptions( IStructureReference organisationReference) { ISet<ISubscriptionMutableObject> returnSet = new HashSet<ISubscriptionMutableObject>(); ISet<ISubscriptionObject> queryResults = sdmxSubscriptionRetrievalManager .GetSubscriptions(organisationReference); /* foreach */ foreach (ISubscriptionObject currentResult in queryResults) { returnSet.Add(new SubscriptionMutableCore(currentResult)); } return returnSet; }
// FUNC this constructor does not account the sRef having the incorrect SdmxStructureType (i.e from a mutable agencySchemeMutableObject) #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="CrossReferenceImpl"/> class. /// </summary> /// <param name="referencedFrom"> /// The referenced from. /// </param> /// <param name="structureReference"> /// The structure reference /// </param> public CrossReferenceImpl(ISdmxObject referencedFrom, IStructureReference structureReference) : base( structureReference.MaintainableReference.AgencyId, structureReference.MaintainableReference.MaintainableId, structureReference.MaintainableReference.Version, structureReference.TargetReference, structureReference.IdentifiableIds) { this._referencedFrom = referencedFrom; this.ValidateReference(); }
/// <summary> /// Returns an error message. /// </summary> /// <param name="structureReference"> /// The structure reference. /// </param> /// <param name="ex"> /// The ex. /// </param> /// <returns> /// The <see cref="ImportMessage"/>. /// </returns> public static ImportMessage GetErrorMessage(this IStructureReference structureReference, Exception ex) { var errorMessage = string.Format( CultureInfo.InvariantCulture, "Failure: {0} cannot be inserted. REASON: {1}{2}", structureReference.GetAsHumanReadableString(), ex.Message, Environment.NewLine); _log.Error(errorMessage, ex); return(new ImportMessage(ImportMessageStatus.Error, structureReference, errorMessage)); }
/// <summary> /// Initializes a new instance of the <see cref="CrossReferenceResolverMutableEngine"/> class. /// </summary> /// <param name="objects"> /// The objects. /// </param> /// <param name="sdmxStructureTypes"> /// The SDMX structure types. /// </param> public CrossReferenceResolverMutableEngine(IEnumerable <IMaintainableMutableObject> objects, params SdmxStructureType[] sdmxStructureTypes) : this(sdmxStructureTypes) { if (objects != null) { foreach (var mutableObject in objects) { IStructureReference reference = _fromMutable.Build(mutableObject); this._cache.Add(reference, mutableObject); } } }
/// <summary> /// Returns a list of MaintainableObject that cross reference the structure(s) that match the reference parameter /// </summary> /// <param name="structureReference"> /// Who References Me? /// </param> /// <param name="returnStub"> /// The return Stub. /// </param> /// <param name="allowedDataflows"> /// The allowed Dataflows. /// </param> /// <param name="structures"> /// an optional parameter to further filter the list by structure type /// </param> /// <returns> /// The <see cref="IList{IMaintainableMutableObject}"/>. /// </returns> public IList <IMaintainableMutableObject> GetCrossReferencingStructures( IStructureReference structureReference, bool returnStub, IList <IMaintainableRefObject> allowedDataflows, params SdmxStructureType[] structures) { if (structureReference == null) { throw new ArgumentNullException("structureReference"); } IMaintainableMutableObject maintainableObject = this.GetMutableMaintainable(structureReference, allowedDataflows, returnStub); return(this.GetCrossReferencingStructures(maintainableObject, returnStub, allowedDataflows, structures)); }
/// <summary> /// Initializes a new instance of the <see cref="SchemeMapMutableCore"/> class. /// </summary> /// <param name="objTarget"> /// The obj target. /// </param> public SchemeMapMutableCore(ISchemeMapObject objTarget) : base(objTarget) { if (objTarget.SourceRef != null) { this.sourceRef = objTarget.SourceRef.CreateMutableInstance(); } if (objTarget.TargetRef != null) { this.targetRef = objTarget.TargetRef.CreateMutableInstance(); } }
public virtual IList<IProvisionAgreementMutableObject> GetProvisions( IStructureReference xref) { IList<IProvisionAgreementMutableObject> returnedProvisions = new List<IProvisionAgreementMutableObject>(); ISet<IProvisionAgreementObject> provisions = provisionBeanRetrievalManager .GetProvisions(xref); if (provisions != null) { /* foreach */ foreach (IProvisionAgreementObject currentProvision in provisions) { returnedProvisions.Add(currentProvision.MutableInstance); } } return returnedProvisions; }
/// <summary> /// Initializes a new instance of the <see cref="RepresentationMutableCore"/> class. /// </summary> /// <param name="representation"> /// The representation. /// </param> public RepresentationMutableCore(IRepresentation representation) : base(representation) { if (representation.TextFormat != null) { this.textFormat = new TextFormatMutableCore(representation.TextFormat); } if (representation.Representation != null) { this.representationRef = representation.Representation.CreateMutableInstance(); } }
public virtual ISet<IRegistrationMutableObject> GetRegistrations( IStructureReference xref) { ISet<IRegistrationMutableObject> returnSet = new HashSet<IRegistrationMutableObject>(); ISet<IRegistrationObject> registrationBeans = registrationBeanRetrievalManager .GetRegistrations(xref); if (registrationBeans != null) { /* foreach */ foreach (IRegistrationObject currentRegistration in registrationBeans) { returnSet.Add(currentRegistration.MutableInstance); } } return returnSet; }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM IMMUTABLE OBJECT ////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="DataAndMetadataSetMutableReferenceImpl"/> class. /// </summary> /// <param name="immutable"> /// The immutable. /// </param> public DataAndMetadataSetMutableReferenceImpl(IDataAndMetadataSetReference immutable) { this.dataSetReference = null; this.setId = null; this._isIsDataSetReference = false; if (immutable.DataSetReference != null) { this.dataSetReference = immutable.DataSetReference.CreateMutableInstance(); } this.setId = immutable.SetId; this._isIsDataSetReference = immutable.IsDataSetReference; }
/// <summary> /// Initializes a new instance of the <see cref="ComponentMutableCore"/> class. /// </summary> /// <param name="objTarget"> /// The obj target. /// </param> public ComponentMutableCore(IComponent objTarget) : base(objTarget) { if (objTarget.Representation != null) { this.representation = new RepresentationMutableCore(objTarget.Representation); } if (objTarget.ConceptRef != null) { this.conceptRef = objTarget.ConceptRef.CreateMutableInstance(); } }
/// <summary> /// Returns the identification of the specified <paramref name="structureReference"/> as a human readable string. /// </summary> /// <param name="structureReference"> /// The structure reference. /// </param> /// <returns> /// The identification of the specified <paramref name="structureReference"/> as a human readable string. /// </returns> public static string GetAsHumanReadableString(this IStructureReference structureReference) { var artefact = structureReference.MaintainableReference; var errorMessage = string.Format( CultureInfo.InvariantCulture, "{0} {1}:{2} (v{3})", structureReference.MaintainableStructureEnumType, artefact.AgencyId, artefact.MaintainableId, artefact.Version); return(errorMessage); }
/// <summary> /// Build error response for submission of provisions.. /// </summary> /// <param name="exception"> /// The exception. /// </param> /// <param name="structureReference"> /// The structure Reference. /// </param> /// <param name="schemaVersion"> /// The schema version. /// </param> /// <returns> /// The error response for submission of provisions /// </returns> public virtual XTypedElement BuildErrorResponse( Exception exception, IStructureReference structureReference, SdmxSchemaEnumType schemaVersion) { switch (schemaVersion) { case SdmxSchemaEnumType.VersionTwo: return this._submitProvisionResponseBuilderV2.BuildErrorResponse(exception); case SdmxSchemaEnumType.VersionTwoPointOne: return this._v21Builder.BuildErrorResponse(exception, structureReference); default: throw new SdmxNotImplementedException(ExceptionCode.Unsupported, schemaVersion); } }
/// <summary> /// Returns an error message with the specified <paramref name="format"/> for <paramref name="reference"/> /// </summary> /// <param name="format"> /// The format. /// </param> /// <param name="reference"> /// The component. /// </param> /// <returns> /// The error message. /// </returns> public string GetError(string format, IStructureReference reference) { IMaintainableRefObject maintainableRefObject = reference.MaintainableReference; return reference.HasChildReference() ? string.Format( format, maintainableRefObject.MaintainableId, maintainableRefObject.AgencyId, maintainableRefObject.Version, reference.ChildReference.Id, reference.TargetReference) : string.Format(format, maintainableRefObject.MaintainableId, maintainableRefObject.AgencyId, maintainableRefObject.Version, reference.TargetReference); }
/// <summary> /// Gets the enumerated representation. /// </summary> /// <param name="dimension">The dimension.</param> /// <param name="dsd">The DSD.</param> /// <returns>The representation <see cref="IStructureReference"/> of the <paramref name="dimension"/>; otherwise null.</returns> public static IStructureReference GetEnumeratedRepresentation(this IDimensionMutableObject dimension, IDataStructureMutableObject dsd) { if (dimension.MeasureDimension) { var crossDsd = dsd as ICrossSectionalDataStructureMutableObject; if (crossDsd != null) { IStructureReference reference = crossDsd.MeasureDimensionCodelistMapping[dimension.Id]; return(reference); } } return(dimension.GetEnumeratedRepresentation()); }
//TODO - THIS CAN ALL BE ABSTRACTED public virtual ISet<IProvisionAgreementObject> GetProvisions( IStructureReference provisionRef) { if (provisionRef.TargetReference == Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Dsd)) { ISet<IProvisionAgreementObject> returnSet = new HashSet<IProvisionAgreementObject>(); ISet<IMaintainableObject> keyFamilies = beans .GetMaintinables(Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Dsd)); ISet<IMaintainableObject> dataflows = beans .GetMaintinables(Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Dataflow)); /* foreach */ foreach (IMaintainableObject currentDSD in keyFamilies) { if (provisionRef.IsMatch(currentDSD)) { /* foreach */ foreach (IMaintainableObject currentFlow in dataflows) { IDataflowObject df = (IDataflowObject) currentFlow; if (df.DataStructureRef.IsMatch(currentDSD)) { GetByReference(df).AddAll(returnSet); } } } } return returnSet; } if (provisionRef.TargetReference == Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureType.GetFromEnum(SdmxStructureEnumType.DataProvider)) { ISet<IProvisionAgreementObject> returnSet0 = new HashSet<IProvisionAgreementObject>(); ISet<IMaintainableObject> allProvisions = beans .GetMaintinables(Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureType.GetFromEnum(SdmxStructureEnumType.ProvisionAgreement)); ISet<IMaintainableObject> dataProviderSchemes = beans .GetMaintinables(Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureType.GetFromEnum(SdmxStructureEnumType.DataProviderScheme)); /* foreach */ foreach (IMaintainableObject currentDps in dataProviderSchemes) { if (provisionRef.IsMatch(currentDps)) { /* foreach */ foreach (IMaintainableObject currentProvision in allProvisions) { IProvisionAgreementObject prov = (IProvisionAgreementObject) currentProvision; if (prov.DataproviderRef.IsMatch(currentDps)) { returnSet0.Add(prov); } } } } return returnSet0; } if (provisionRef.TargetReference == Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureType.GetFromEnum(SdmxStructureEnumType.ProvisionAgreement)) { return beans.GetProvisionAgreements(provisionRef .MaintainableReference); } return GetByReference(beans.GetMaintinables(provisionRef .MaintainableStructureType)); }
/// <summary> /// Build the error response. /// </summary> /// <param name="exception"> /// The exception. /// </param> /// <param name="errorBean"> /// The error bean. /// </param> /// <returns> /// The <see cref="RegistryInterface"/>. /// </returns> /// <exception cref="BuilderException"> /// Registry could not determine Maintainable Artefact in error /// </exception> public RegistryInterface BuildErrorResponse(Exception exception, IStructureReference errorBean) { if (errorBean == null) { throw new SdmxSemmanticException("Registry could not determine Maintainable Artefact in error", exception); } var responseType = new RegistryInterface(); RegistryInterfaceType regInterface = responseType.Content; V21Helper.Header = regInterface; var returnType = new SubmitStructureResponseType(); regInterface.SubmitStructureResponse = returnType; this.AddSubmissionResult(returnType, errorBean, exception); return responseType; }
/// <summary> /// Returns the final status (id and is final value) of the specified <paramref name="reference"/>; otherwise it returns null /// </summary> /// <param name="state"> /// The state. /// </param> /// <param name="reference"> /// The structure reference. /// </param> /// <exception cref="ArgumentException"> /// <paramref name="reference"/> unsupported structure /// </exception> /// <returns> /// The <see cref="ArtefactFinalStatus"/> of the specified <paramref name="reference"/>; otherwise it returns null. /// </returns> public static ArtefactFinalStatus GetFinalStatus(DbTransactionState state, IStructureReference reference) { if (state == null) { throw new ArgumentNullException("state"); } if (reference == null) { throw new ArgumentNullException("reference"); } var tableInfo = _tableInfoBuilder.Build(reference.MaintainableStructureEnumType.EnumType); if (tableInfo == null) { _log.WarnFormat("Unsupported structure type {0}", reference.MaintainableStructureEnumType.EnumType); return(ArtefactFinalStatus.Empty); ////throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, Resources.ExceptionUnsupportedStructureReferenceFormat1, reference), "reference"); } var finalQueryBuilder = new IsFinalQueryBuilder(state.Database); var query = finalQueryBuilder.Build(tableInfo); var maintainableRefObject = reference.MaintainableReference; var version = maintainableRefObject.SplitVersion(3); ArtefactFinalStatus artefactFinalStatus = ArtefactFinalStatus.Empty; state.ExecuteReaderFormat( query, reader => { if (reader.Read()) { var primaryKey = DataReaderHelper.GetInt64(reader, "primaryKey"); var finalStatus = DataReaderHelper.GetBoolean(reader, "isFinal"); artefactFinalStatus = new ArtefactFinalStatus(primaryKey, finalStatus); } }, state.Database.CreateInParameter("id", DbType.AnsiString, maintainableRefObject.MaintainableId), state.Database.CreateInParameter("agency", DbType.AnsiString, maintainableRefObject.AgencyId), state.Database.CreateInParameter("version1", DbType.AnsiString, version[0].ToDbValue(0)), state.Database.CreateInParameter("version2", DbType.AnsiString, version[1].ToDbValue(0)), state.Database.CreateInParameter("version3", DbType.AnsiString, version[2].ToDbValue())); return(artefactFinalStatus); }
/// <summary> /// Initializes a new instance of the <see cref="ConceptMutableCore"/> class. /// </summary> /// <param name="objTarget"> /// The agencySchemeMutable target. /// </param> public ConceptMutableCore(IConceptObject objTarget) : base(objTarget) { if (objTarget.CoreRepresentation != null) { this._coreRepresentation = new RepresentationMutableCore(objTarget.CoreRepresentation); } if (objTarget.IsoConceptReference != null) { this._isoConceptReference = objTarget.IsoConceptReference.CreateMutableInstance(); } this._parent = objTarget.ParentConcept; this._parentAgency = objTarget.ParentAgency; }
/// <summary> /// Initializes a new instance of the <see cref="RepresentationMapRefMutableCore"/> class. /// </summary> /// <param name="representationMapRef"> /// The iref. /// </param> public RepresentationMapRefMutableCore(IRepresentationMapRef representationMapRef) : base(representationMapRef) { this.valueMappings = new DictionaryOfSets<string, string>(); if (representationMapRef.CodelistMap != null) { this.codelistMap = representationMapRef.CodelistMap.CreateMutableInstance(); } if (representationMapRef.ToTextFormat != null) { this.toTextFormat = new TextFormatMutableCore(representationMapRef.ToTextFormat); } this.toValueType = representationMapRef.ToValueType; this.valueMappings = representationMapRef.ValueMappings; }
/// <summary> /// Fill the components of a KeyFamilyBean object /// </summary> /// <param name="parent"> /// The KeyFamilyBean to populate /// </param> /// <param name="parentSysId"> /// The DSD.DSD_ID PrimaryKey /// </param> /// <returns> /// The <see cref="IDataStructureMutableObject"/> which will be the same as <paramref name="parent"/> unless the DSD /// is cross sectional. /// </returns> private IDataStructureMutableObject FillComponents(IDataStructureMutableObject parent, long parentSysId) { var crossSectionalMeasures = new List <ICrossSectionalMeasureMutableObject>(); var crossDataSet = new HashSet <string>(); var crossGroup = new HashSet <string>(); var crossSection = new HashSet <string>(); var crossObs = new HashSet <string>(); var componentMap = new Dictionary <long, IComponentMutableObject>(); IStructureReference measureCodelistRepresentation = null; using (DbCommand command = this._commandBuilder.Build(new ItemSqlQuery(this._componentQueryInfo, parentSysId))) using (IDataReader dataReader = this.MappingStoreDb.ExecuteReader(command)) { var idIdx = dataReader.GetOrdinal("ID"); var compIdIdx = dataReader.GetOrdinal("COMP_ID"); while (dataReader.Read()) { IComponentMutableObject component = RetrieveComponentType(parent, dataReader, crossSectionalMeasures); componentMap.Add(dataReader.GetInt64(compIdIdx), component); component.Id = DataReaderHelper.GetString(dataReader, idIdx); measureCodelistRepresentation = RetrieveRepresentationReference(dataReader, component); RetrieveConceptRef(dataReader, component); RetrieveCrossSectionalAttachments(dataReader, crossDataSet, component.Id, crossGroup, crossSection, crossObs); } } if (parent.AttributeList != null) { this.SetupGroupAttributes(parent, parentSysId); SetupAttributeAttachmentLevel(parent, this.GetAttributeDimensionRefs(parentSysId)); } parent = SetupCrossSectionalDsd(parent, crossDataSet, crossGroup, crossSection, crossObs, crossSectionalMeasures, measureCodelistRepresentation); this.SetupAttributesAttachmentCrossMeasures(parent as ICrossSectionalDataStructureMutableObject, parentSysId); this.GetTextFormatInformation(parentSysId, componentMap); this._componentAnnotationRetrieverEngine.RetrieveAnnotations(parentSysId, componentMap); return(parent); }
/// <summary> /// Determines whether the specified objects are equal. /// </summary> /// <returns> /// true if the specified objects are equal; otherwise, false. /// </returns> /// <param name="x"> /// The first object of type <see cref="IMaintainableMutableObject"/> to compare. /// </param> /// <param name="y"> /// The second object of type <see cref="IMaintainableMutableObject"/> to compare. /// </param> public bool Equals(IMaintainableMutableObject x, IMaintainableMutableObject y) { if (ReferenceEquals(x, y)) { return(true); } if (x == null || y == null) { return(false); } IStructureReference firstReference = _fromMutable.Build(x); IStructureReference secondReference = _fromMutable.Build(y); return(firstReference.Equals(secondReference)); }
/// <summary> /// Initializes a new instance of the <see cref="SubmitStructureResponseImpl"/> class. /// </summary> /// <param name="structureReference"> /// The structure reference dataStructureObject. /// </param> /// <param name="errorList"> /// The error list. /// </param> /// /// /// <exception cref="ArgumentException"> /// Throws ArgumentException. /// </exception> public SubmitStructureResponseImpl(IStructureReference structureReference, IErrorList errorList) { this._structureReference = structureReference; this._errorList = errorList; if (structureReference != null && structureReference.TargetUrn == null) { throw new ArgumentException("SubmitStructureResponseImpl expects a complete IStructureReference"); } if (!this.IsError) { if (structureReference == null) { throw new ArgumentException("Sucessful SubmitStructureResponse expects a IStructureReference"); } } }
/// <summary> /// Validate the specified CodeList reference. /// </summary> /// <param name="refereceStatus"> /// The codeList status. /// </param> /// <param name="codelistRef"> /// The CodeList reference. /// </param> /// <exception cref="MappingStoreException"> /// The specified <paramref name="refereceStatus"/> is not valid. /// </exception> public void ValidateFinalStatus(ArtefactFinalStatus refereceStatus, IStructureReference codelistRef) { if (refereceStatus == null) { throw new ArgumentNullException("refereceStatus"); } if (refereceStatus.PrimaryKey < 1) { throw new MappingStoreException(this.GetError("Reference {3} {0}, Agency {1}, Version {2} is not available. Cannot import StructureSet.", codelistRef)); } if (!refereceStatus.IsFinal) { throw new MappingStoreException(this.GetError("Referenced {3} {0}, Agency {1}, Version {2} is not Final. Cannot import StructureSet.", codelistRef)); } }
/// <summary> /// Validate codelist. /// </summary> /// <param name="codelistStatus"> /// The codelist status. /// </param> /// <param name="component"> /// The component. /// </param> /// <exception cref="MappingStoreException"> /// The specified <paramref name="codelistStatus"/> is not valid. /// </exception> private static void ValidateCodelist(ArtefactFinalStatus codelistStatus, IStructureReference component) { if (codelistStatus == null) { throw new ArgumentNullException("codelistStatus"); } if (codelistStatus.PrimaryKey < 1) { throw new MappingStoreException(GetError("Codelist {0}, Agency {1}, Version {2} is not available. Cannot import DSD.", component)); } if (!codelistStatus.IsFinal) { throw new MappingStoreException(GetError("Referenced Codelist {0}, Agency {1}, Version {2} is not Final. Cannot import DSD.", component)); } }
/// <summary> /// Returns the message for update failure when an artefact with the specified <paramref name="structureReference"/> already exists in MAPPING STORE and it is FINAL /// </summary> /// <param name="structureReference"> /// The structure reference. /// </param> /// <returns> /// The <see cref="ImportMessage"/>. /// </returns> protected ImportMessage GetCannotReplaceMessage(IStructureReference structureReference) { // "Artefact with ID:" + artefact.GetID() + " VERSION:" + artefact.version + " AGENCY:" + artefact.agencyID + " is FINAL, so no update occurred" + Environment.NewLine; var artefact = structureReference.MaintainableReference; var message = string.Format( CultureInfo.InvariantCulture, "Failure: {0} {1}:{2} (v{3}) cannot be updated, it is final.{4}", structureReference.TargetReference, artefact.AgencyId, artefact.MaintainableId, artefact.Version, Environment.NewLine); _log.WarnFormat(CultureInfo.InvariantCulture, message); var importMessage = new ImportMessage(ImportMessageStatus.Success, structureReference, message); return(importMessage); }
/// <summary> /// Retrieve the component representation reference. /// </summary> /// <param name="dataReader"> /// The data reader. /// </param> /// <param name="component"> /// The component. /// </param> /// <returns> /// The <see cref="IStructureReference"/> of the representation. /// </returns> private static IStructureReference RetrieveRepresentationReference(IDataRecord dataReader, IComponentMutableObject component) { IStructureReference measureCodelistRepresentation = null; string codelist = DataReaderHelper.GetString(dataReader, "CODELIST_ID"); if (!string.IsNullOrWhiteSpace(codelist)) { string codelistAgency = DataReaderHelper.GetString(dataReader, "CODELIST_AGENCY"); string codelistVersion = DataReaderHelper.GetString(dataReader, "CODELIST_VERSION"); var codelistRepresentation = new StructureReferenceImpl(codelistAgency, codelist, codelistVersion, SdmxStructureEnumType.CodeList); component.Representation = new RepresentationMutableCore { Representation = codelistRepresentation }; } // Important. Concept scheme must be checked *after* codelist. var conceptSchemeRepresentation = DataReaderHelper.GetString(dataReader, "REP_CS_ID"); if (!string.IsNullOrWhiteSpace(conceptSchemeRepresentation)) { var measureDimension = component as IDimensionMutableObject; if (measureDimension != null && measureDimension.MeasureDimension) { string agency = DataReaderHelper.GetString(dataReader, "REP_CS_AGENCY"); string version = DataReaderHelper.GetString(dataReader, "REP_CS_VERSION"); if (component.Representation != null) { measureCodelistRepresentation = component.Representation.Representation; } measureDimension.Representation = new RepresentationMutableCore { Representation = new StructureReferenceImpl( agency, conceptSchemeRepresentation, version, SdmxStructureEnumType.ConceptScheme) }; } } return(measureCodelistRepresentation); }
/// <summary> /// Setup cross sectional DSD. /// </summary> /// <param name="parent"> /// The parent. /// </param> /// <param name="crossDataSet"> /// The list of components attached to cross-sectional data set. /// </param> /// <param name="crossGroup"> /// The list of components attached to cross-sectional group. /// </param> /// <param name="crossSection"> /// The list of components attached to cross-sectional section. /// </param> /// <param name="crossObs"> /// The list of components attached to cross-sectional observation level /// </param> /// <param name="crossSectionalMeasures"> /// The cross sectional measures. /// </param> /// <param name="measureCodelistRepresentation"> /// The SDMX v2.0 measure dimension codelist representation; otherwise null /// </param> /// <returns> /// The <see cref="IDataStructureMutableObject"/>. /// </returns> private static IDataStructureMutableObject SetupCrossSectionalDsd( IDataStructureMutableObject parent, ICollection <string> crossDataSet, ICollection <string> crossGroup, ICollection <string> crossSection, ICollection <string> crossObs, IEnumerable <ICrossSectionalMeasureMutableObject> crossSectionalMeasures, IStructureReference measureCodelistRepresentation) { if ( parent.Dimensions.All( o => o.FrequencyDimension || o.TimeDimension || o.MeasureDimension || crossDataSet.Contains(o.Id) || crossGroup.Contains(o.Id) || crossSection.Contains(o.Id) || crossObs.Contains(o.Id))) { if (parent.AttributeList == null || parent.AttributeList.Attributes.All(o => crossDataSet.Contains(o.Id) || crossGroup.Contains(o.Id) || crossSection.Contains(o.Id) || crossObs.Contains(o.Id))) { ICrossSectionalDataStructureMutableObject crossDsd = _crossDsdBuilder.Build(parent); crossDsd.CrossSectionalAttachDataSet.AddAll(crossDataSet); crossDsd.CrossSectionalAttachSection.AddAll(crossSection); crossDsd.CrossSectionalAttachGroup.AddAll(crossGroup); crossDsd.CrossSectionalAttachObservation.AddAll(crossObs); IDimensionMutableObject measure = crossDsd.Dimensions.FirstOrDefault(o => o.MeasureDimension); if (measure != null) { foreach (ICrossSectionalMeasureMutableObject crossSectionalMeasureMutableObject in crossSectionalMeasures) { crossSectionalMeasureMutableObject.MeasureDimension = measure.Id; crossDsd.CrossSectionalMeasures.Add(crossSectionalMeasureMutableObject); } if (measureCodelistRepresentation == null) { DataStructureUtil.ConvertMeasureRepresentation(crossDsd); } } return(crossDsd); } } return(parent); }
/// <summary> /// Retrieve the set of <see cref="IMaintainableMutableObject"/> from Mapping Store that references /// <paramref name="referencedStructure"/> /// . /// </summary> /// <param name="referencedStructure"> /// The maintainable reference which may contain ID, AGENCY ID and/or VERSION. This is the referenced structure. /// </param> /// <param name="detail"> /// The <see cref="StructureQueryDetail"/> which controls if the output will include details or not. /// </param> /// <param name="allowedDataflows"> /// The allowed Dataflows. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="referencedStructure"/> is null. /// </exception> /// <returns> /// The <see cref="ISet{IMaintainableMutableObject}"/>. /// </returns> public override ISet <ICategorisationMutableObject> RetrieveFromReferenced( IStructureReference referencedStructure, ComplexStructureQueryDetailEnumType detail, IList <IMaintainableRefObject> allowedDataflows) { if (referencedStructure == null) { throw new ArgumentNullException("referencedStructure"); } var dataflowCache = new Dictionary <long, IStructureReference>(); var categoryCache = new Dictionary <long, IStructureReference>(); this.RetrieveArtefactReference(dataflowCache, allowedDataflows); this.RetrieveCategoryReference(categoryCache); var retrieveFromReferencedInternal = this.RetrieveFromReferencedInternal(referencedStructure, ComplexStructureQueryDetailEnumType.Full, null, (o, l) => RetrieveReferences(o, l, l1 => GetReference(l1, dataflowCache), l1 => GetReference(l1, categoryCache))); NormalizeDetailLevel(detail, retrieveFromReferencedInternal); return(retrieveFromReferencedInternal); }
/// <summary> /// Retrieve the set of <see cref="IMaintainableMutableObject"/> from Mapping Store that references /// <paramref name="referencedStructure"/> /// . /// </summary> /// <param name="referencedStructure"> /// The maintainable reference which may contain ID, AGENCY ID and/or VERSION. This is the referenced structure. /// </param> /// <param name="detail"> /// The <see cref="StructureQueryDetail"/> which controls if the output will include details or not. /// </param> /// <param name="commandBuilder"> /// The command Builder. /// </param> /// <param name="retrieveDetails">The method that retrieves the details of the artefact.</param> /// <returns> /// The <see cref="ISet{IMaintainableMutableObject}"/>. /// </returns> protected ISet <T> RetrieveFromReferencedInternal(IStructureReference referencedStructure, ComplexStructureQueryDetailEnumType detail, Func <ArtefactSqlQuery, DbCommand> commandBuilder, Func <T, long, T> retrieveDetails) { if (referencedStructure == null) { throw new ArgumentNullException("referencedStructure"); } string innerJoin = this.GetReferencedFromInnerJoins(referencedStructure.MaintainableStructureEnumType.EnumType); ISet <T> mutableObjects; if (innerJoin != null) { SqlQueryInfo sqlQueryInfo = this._artefactParentsSqlBuilder.Build(innerJoin); var artefactSqlQuery = new ArtefactSqlQuery(sqlQueryInfo, referencedStructure.MaintainableReference); mutableObjects = this.RetrieveArtefacts(artefactSqlQuery, detail, commandBuilder, retrieveDetails); } else { mutableObjects = new HashSet <T>(); } return(mutableObjects); }
/// <summary> /// Resolves an reference to a Object of type T, this will return the Object of the given type, throwing an exception if e /// Object is not of type T /// </summary> /// <typeparam name="T">Generic type parameter. /// </typeparam> /// <param name="crossReference">Structure-reference object /// </param> /// <returns> /// SdmxException Not Implemented /// </returns> public T GetIdentifiableObject <T>(IStructureReference crossReference) { throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.GetMaintainableFromSdmxObject, null); }
/// <summary> /// Adds submission result. /// </summary> /// <param name="returnType"> /// The return type. /// </param> /// <param name="structureReference"> /// The structure reference. /// </param> /// <param name="exception"> /// The exception. /// </param> private void AddSubmissionResult( SubmitStructureResponseType returnType, IStructureReference structureReference, Exception exception) { var submissionResult = new SubmissionResultType(); returnType.SubmissionResult.Add(submissionResult); var statusMessageType = new StatusMessageType(); submissionResult.StatusMessage = statusMessageType; this.AddStatus(statusMessageType, exception); var submittedStructure = new SubmittedStructureType(); submissionResult.SubmittedStructure = submittedStructure; var refType = new MaintainableReferenceType(); submittedStructure.MaintainableObject = refType; if (ObjectUtil.ValidString(structureReference.MaintainableUrn)) { refType.URN.Add(structureReference.MaintainableUrn); } else { var xref = new MaintainableRefType(); refType.SetTypedRef(xref); IMaintainableRefObject maintainableReference = structureReference.MaintainableReference; string value = maintainableReference.AgencyId; if (!string.IsNullOrWhiteSpace(value)) { xref.agencyID = maintainableReference.AgencyId; } string value1 = maintainableReference.MaintainableId; if (!string.IsNullOrWhiteSpace(value1)) { xref.agencyID = maintainableReference.MaintainableId; } string value2 = maintainableReference.Version; if (!string.IsNullOrWhiteSpace(value2)) { xref.agencyID = maintainableReference.Version; } } }
/// <summary> /// Gets the CodeList status. /// </summary> /// <param name="state">The state.</param> /// <param name="codeListReference">The codeList reference.</param> /// <param name="itemScheme">The item scheme.</param> /// <returns> /// The <see cref="ItemSchemeFinalStatus"/>. /// </returns> protected ItemSchemeFinalStatus GetReferenceStatus(DbTransactionState state, IStructureReference codeListReference, StructureCache itemScheme) { return(this._validateStatusEngine.GetReferenceStatus(state, codeListReference, itemScheme)); }
public virtual ISet<IMaintainableMutableObject> GetMutableMaintainableWithReferences( IStructureReference query) { ISet<IMaintainableObject> maintainables = this.SdmxObjectRetrievalManager .GetMaintainableWithReferences(query); return ConvertToMutables(maintainables); }
public virtual ISet<IMaintainableMutableObject> GetMutableMaintainables( IStructureReference query) { SdmxStructureType structureType = query.TargetReference; if (!structureType.IsMaintainable()) { throw new UnsupportedException(Org.Sdmxsource.Sdmx.Api.Constants.ExceptionCode.Unsupported, structureType + " is not maintainable"); } IMaintainableRefObject xref = query.MaintainableReference; switch (structureType) { case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.AgencyScheme: return GetMutableAgencySchemeBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.DataProviderScheme: return GetMutableDataProviderSchemeBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.DataConsumerScheme: return GetMutableDataConsumerSchemeBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.Categorisation: return GetMutableCategorisationBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.ContentConstraint: return GetMutableContentConstraintBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.CategoryScheme: return GetMutableCategorySchemeBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.CodeList: return GetMutableCodelistBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.ConceptScheme: return GetMutableConceptSchemeBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.Dataflow: return GetMutableDataflowBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.HierarchicalCodelist: return GetMutableHierarchicCodeListBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.Dsd: return GetMutableDataStructureBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.MetadataFlow: return GetMutableMetadataflowBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.Msd: return GetMutableMetadataStructureBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.OrganisationUnitScheme: return GetMutableOrganisationUnitSchemeBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.ProvisionAgreement: return GetMutableProvisionAgreements(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.Process: return GetMutableProcessBeanBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.StructureSet: return GetMutableStructureSetBeans(xref); case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.ReportingTaxonomy: return GetMutableReportingTaxonomyBeans(xref); } throw new UnsupportedException(Org.Sdmxsource.Sdmx.Api.Constants.ExceptionCode.Unsupported, structureType); }
/// <summary> /// Gets a maintainable defined by the StructureQueryObject parameter. /// <p/> /// Expects only ONE maintainable to be returned from this query /// </summary> /// <param name="structureReference"> /// The reference object defining the search parameters, this is expected to uniquely identify one MaintainableObject /// </param> /// <returns> /// The <see cref="IMaintainableObject"/> . /// </returns> public IMaintainableObject GetMaintainableObject(IStructureReference structureReference) { return(GetMaintainable(structureReference, false)); }
/// <summary> /// Gets a maintainable defined by the StructureQueryObject parameter. /// <p/> /// Expects only ONE maintainable to be returned from this query /// </summary> /// <param name="structureReference"> /// The reference object defining the search parameters, this is expected to uniquely identify one MaintainableObject /// </param> /// <param name="returnStub"> /// If true then a stub object will be returned /// </param> /// <param name="returnLatest"> /// If true then the latest version is returned, regardless of whether version information is supplied /// </param> /// <returns> /// The <see cref="IMaintainableObject"/> . /// </returns> public IMaintainableObject GetMaintainableObject(IStructureReference structureReference, bool returnStub, bool returnLatest) { return(GetMaintainable(structureReference, returnStub)); }
/// <summary> /// Gets the identifiable objects. /// </summary> /// <typeparam name="T">The type of the identifiable objects to return.</typeparam> /// <param name="structureReference">The structure reference.</param> /// <returns>SdmxException Not Implemented</returns> public ISet <T> GetIdentifiableObjects <T>(IStructureReference structureReference) where T : IIdentifiableObject { throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.GetMaintainableFromSdmxObject, null); }
public RESTSchemaQueryCore(IStructureReference reference, string dimAtObs): this(reference, dimAtObs, true) { }