本文整理汇总了C#中IMaintainableRefObject.HasVersion方法的典型用法代码示例。如果您正苦于以下问题:C# IMaintainableRefObject.HasVersion方法的具体用法?C# IMaintainableRefObject.HasVersion怎么用?C# IMaintainableRefObject.HasVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMaintainableRefObject
的用法示例。
在下文中一共展示了IMaintainableRefObject.HasVersion方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildSqlCommand
/// <summary>
/// Build SQL command for retrieving Mapping Set for the dataflow with the specified <paramref name="maintainableRef"/> .
/// </summary>
/// <param name="maintainableRef">
/// The maintainable ref.
/// </param>
/// <param name="mappingStoreDb">
/// The mapping store DB.
/// </param>
/// <param name="allowedDataflows">
/// The allowed dataflows.
/// </param>
/// <returns>
/// The <see cref="StringBuilder"/>.
/// </returns>
private static DbCommand BuildSqlCommand(IMaintainableRefObject maintainableRef, Database mappingStoreDb, IList<IMaintainableRefObject> allowedDataflows)
{
var builder = new DataflowCommandBuilder(mappingStoreDb, ProductionDataflowOnly ? DataflowFilter.Production : (InUsageDataflowOnly ? DataflowFilter.Usage : DataflowFilter.Any));
var sqlCommand = new StringBuilder(MappingStoreSqlStatements.MappingSetDataflow);
// get a specific version of the dataflow
if (!maintainableRef.HasVersion())
{
// or else get the latest
SqlHelper.AddWhereClause(
sqlCommand,
WhereState.And,
" (SELECT COUNT(*) FROM ARTEFACT A2 INNER JOIN DATAFLOW T2 ON A2.ART_ID = T2.DF_ID where A2.ID=A.ID AND A2.AGENCY=A.AGENCY AND dbo.isGreaterVersion(A2.VERSION1, A2.VERSION2, A2.VERSION3, A.VERSION1, A.VERSION2, A.VERSION3)=1 {0} ) = 0 ",
ProductionDataflowOnly ? DataflowConstant.ProductionWhereLatestClause : (InUsageDataflowOnly ? DataflowConstant.InUsageWhereLatestClause : string.Empty));
}
var sqlQueryInfo = new SqlQueryInfo { QueryFormat = sqlCommand.ToString(), WhereStatus = WhereState.And };
return builder.Build(new ArtefactSqlQuery(sqlQueryInfo, maintainableRef), allowedDataflows);
}
示例2: GetMutableHierarchicCodeList
/// <summary>
/// Gets a single HierarchicCodeList , this expects the ref object either to contain
/// a URN or all the attributes required to uniquely identify the object. If version information
/// is missing then the latest version is assumed.
/// </summary>
/// <param name="xref">The maintainable reference.</param>
/// <param name="returnLatest">if set to <c>true</c> [return latest].</param>
/// <param name="returnStub">The return Stub.</param>
/// <returns>
/// The <see cref="T:Org.Sdmxsource.Sdmx.Api.Model.Mutable.Codelist.IHierarchicalCodelistMutableObject" /> .
/// </returns>
public override IHierarchicalCodelistMutableObject GetMutableHierarchicCodeList(IMaintainableRefObject xref, bool returnLatest, bool returnStub)
{
return xref.HasVersion() && !returnLatest
? this._retrievalEngineContainer.HclRetrievalEngine.Retrieve(xref, returnStub.GetComplexQueryDetail(), VersionQueryType.All).FirstOrDefault()
: this._retrievalEngineContainer.HclRetrievalEngine.RetrieveLatest(xref, returnStub.GetComplexQueryDetail());
}
示例3: Contains
/// <summary>
/// Checks if there is a .
/// </summary>
/// <param name="allowedDataflows">
/// The allowed dataflows.
/// </param>
/// <param name="requestedObject">
/// The requested object.
/// </param>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
public static bool Contains(ICollection<IMaintainableRefObject> allowedDataflows, IMaintainableRefObject requestedObject)
{
if (allowedDataflows == null)
{
return true;
}
foreach (IMaintainableRefObject allowedDataflow in allowedDataflows)
{
if ((!requestedObject.HasMaintainableId() || string.Equals(allowedDataflow.MaintainableId, requestedObject.MaintainableId))
&& ((!allowedDataflow.HasVersion() || !requestedObject.HasVersion() || string.Equals(requestedObject.Version, allowedDataflow.Version))
&& (!allowedDataflow.HasAgencyId() || !requestedObject.HasAgencyId() || string.Equals(requestedObject.AgencyId, allowedDataflow.AgencyId))))
{
return true;
}
}
return false;
}
示例4: GetMutableCategorisation
/// <summary>
/// Gets a single Categorisation, this expects the ref object either to contain
/// a URN or all the attributes required to uniquely identify the object. If version information
/// is missing then the latest version is assumed.
/// </summary>
/// <param name="xref">The maintainable reference.</param>
/// <param name="returnLatest">if set to <c>true</c> [return latest].</param>
/// <param name="returnStub">The return Stub.</param>
/// <returns>
/// The <see cref="T:Org.Sdmxsource.Sdmx.Api.Model.Mutable.CategoryScheme.ICategorisationMutableObject" /> .
/// </returns>
public override ICategorisationMutableObject GetMutableCategorisation(IMaintainableRefObject xref, bool returnLatest, bool returnStub)
{
if (xref.HasVersion())
{
return this._retrievalEngineContainer.CategorisationRetrievalEngine.Retrieve(xref, returnStub.GetComplexQueryDetail(), VersionQueryType.All).FirstOrDefault();
}
//// TODO Change this when mapping store is modified to host proper categorisation artefacts
return this._retrievalEngineContainer.CategorisationRetrievalEngine.RetrieveLatest(xref, returnStub.GetComplexQueryDetail());
}
示例5: GetMutableDataflow
/// <summary>
/// Gets a single Dataflow , this expects the ref object either to contain
/// a URN or all the attributes required to uniquely identify the object. If version information
/// is missing then the latest version is assumed.
/// </summary>
/// <param name="xref">The maintainable reference.</param>
/// <param name="returnLatest">if set to <c>true</c> [return latest].</param>
/// <param name="returnStub">The return Stub.</param>
/// <returns>
/// The <see cref="T:Org.Sdmxsource.Sdmx.Api.Model.Mutable.DataStructure.IDataflowMutableObject" /> .
/// </returns>
public override IDataflowMutableObject GetMutableDataflow(IMaintainableRefObject xref, bool returnLatest, bool returnStub)
{
return xref.HasVersion() && !returnLatest
? this._retrievalEngineContainer.DataflowRetrievalEngine.Retrieve(xref, returnStub.GetComplexQueryDetail(), VersionQueryType.All).FirstOrDefault()
: this._retrievalEngineContainer.DataflowRetrievalEngine.RetrieveLatest(xref, returnStub.GetComplexQueryDetail());
}
示例6: GetMutableStructureSet
/// <summary>
/// Gets a structure set @object, this expects the ref object either to contain
/// a URN or all the attributes required to uniquely identify the object. If version information
/// is missing then the latest version is assumed.
/// </summary>
/// <param name="xref">The maintainable reference.</param>
/// <param name="returnLatest">if set to <c>true</c> [return latest].</param>
/// <param name="returnStub">The return Stub.</param>
/// <returns>
/// The <see cref="T:Org.Sdmxsource.Sdmx.Api.Model.Mutable.Mapping.IStructureSetMutableObject" /> .
/// </returns>
/// <exception cref="System.NotImplementedException">Not implemented</exception>
public override IStructureSetMutableObject GetMutableStructureSet(IMaintainableRefObject xref, bool returnLatest, bool returnStub)
{
// 7.11 ISTAT ENHANCEMENT
return xref.HasVersion()
? this._retrievalEngineContainer.StructureSetRetrievalEngine.Retrieve(xref, returnStub.GetComplexQueryDetail(), VersionQueryType.All).FirstOrDefault()
: this._retrievalEngineContainer.StructureSetRetrievalEngine.RetrieveLatest(xref, returnStub.GetComplexQueryDetail());
}
示例7: GetMutableOrganisationUnitScheme
/// <summary>
/// Gets a single organization scheme, this expects the ref object either to contain
/// a URN or all the attributes required to uniquely identify the object. If version information
/// is missing then the latest version is assumed.
/// </summary>
/// <param name="xref">The maintainable reference.</param>
/// <param name="returnLatest">if set to <c>true</c> [return latest].</param>
/// <param name="returnStub">The return Stub.</param>
/// <returns>
/// The <see cref="T:Org.Sdmxsource.Sdmx.Api.Model.Mutable.Base.IOrganisationUnitSchemeMutableObject" /> .
/// </returns>
/// <exception cref="System.NotImplementedException">Not implemented</exception>
public override IOrganisationUnitSchemeMutableObject GetMutableOrganisationUnitScheme(IMaintainableRefObject xref, bool returnLatest, bool returnStub)
{
// 7.9 ISTAT ENHANCEMENT
return xref.HasVersion()
? this._retrievalEngineContainer.OrganisationUnitSchemeRetrievalEngine.Retrieve(xref, returnStub.GetComplexQueryDetail(), VersionQueryType.All).FirstOrDefault()
: this._retrievalEngineContainer.OrganisationUnitSchemeRetrievalEngine.RetrieveLatest(xref, returnStub.GetComplexQueryDetail());
}
示例8: BuildDsd
/// <summary>
/// Builds the DSD.
/// </summary>
/// <returns>The DSD.</returns>
private static IDataStructureObject BuildDsd(IMaintainableRefObject dsdRef, int dimensions)
{
IDataStructureMutableObject dsdMutableObject = new DataStructureMutableCore
{
AgencyId = dsdRef.AgencyId,
Id = dsdRef.MaintainableId,
Version = dsdRef.HasVersion() ? dsdRef.Version : "1.0"
};
dsdMutableObject.AddName("en", "Test data");
// FREQ="Q" ADJUSTMENT="N" STS_ACTIVITY="A"
dsdMutableObject.AddDimension(
new StructureReferenceImpl(agencyId: dsdRef.AgencyId, maintainableId: "TEST_CS", version: "1.0", targetStructureEnum: SdmxStructureEnumType.Concept, identfiableIds: "FREQ"),
new StructureReferenceImpl("SDMX", "CL_FREQ", "1.0", SdmxStructureEnumType.CodeList));
var groupMutableCore = new GroupMutableCore() { Id = "Sibling" };
dsdMutableObject.AddGroup(groupMutableCore);
for (int i = 0; i < dimensions; i++)
{
string id = "DIM" + i.ToString(CultureInfo.InvariantCulture);
var dim = dsdMutableObject.AddDimension(
new StructureReferenceImpl(
agencyId: dsdRef.AgencyId,
maintainableId: "TEST_CS",
version: "1.0",
targetStructureEnum: SdmxStructureEnumType.Concept,
identfiableIds: id), codelistRef: new StructureReferenceImpl(dsdRef.AgencyId, "CL_" + id, "1.0", SdmxStructureEnumType.CodeList));
groupMutableCore.DimensionRef.Add(id);
}
dsdMutableObject.AddDimension(
new DimensionMutableCore
{
ConceptRef =
new StructureReferenceImpl(
agencyId: dsdRef.AgencyId,
maintainableId: "TEST_CS",
version: "1.0",
targetStructureEnum: SdmxStructureEnumType.Concept,
identfiableIds: "TIME_PERIOD"),
TimeDimension = true
});
dsdMutableObject.AddPrimaryMeasure(
new StructureReferenceImpl(agencyId: dsdRef.AgencyId, maintainableId: "TEST_CS", version: "1.0", targetStructureEnum: SdmxStructureEnumType.Concept, identfiableIds: "OBS_VALUE"));
var obsStatus =
dsdMutableObject.AddAttribute(
new StructureReferenceImpl(agencyId: dsdRef.AgencyId, maintainableId: "TEST_CS", version: "1.0", targetStructureEnum: SdmxStructureEnumType.Concept, identfiableIds: "OBS_STATUS"),
new StructureReferenceImpl(dsdRef.AgencyId, "CL_OBS_STATUS", "1.0", SdmxStructureEnumType.CodeList));
obsStatus.AttachmentLevel = AttributeAttachmentLevel.Observation;
obsStatus.AssignmentStatus = "Mandatory";
var obsConf =
dsdMutableObject.AddAttribute(
new StructureReferenceImpl(agencyId: dsdRef.AgencyId, maintainableId: "TEST_CS", version: "1.0", targetStructureEnum: SdmxStructureEnumType.Concept, identfiableIds: "OBS_CONF"),
new StructureReferenceImpl(dsdRef.AgencyId, "CL_OBS_CONF", "1.0", SdmxStructureEnumType.CodeList));
obsConf.AttachmentLevel = AttributeAttachmentLevel.Observation;
obsConf.AssignmentStatus = "Conditional";
AddCodedAttribute(dsdMutableObject, "UNIT_MULT");
AddCodedAttribute(dsdMutableObject, "UNIT");
AddUnCodedAttribute(dsdMutableObject, "TITLE_COMPL");
return dsdMutableObject.ImmutableInstance;
}
示例9: GetMutableAgencyScheme
/// <summary>
/// Gets a single Agency Scheme, this expects the ref object either to contain
/// a URN or all the attributes required to uniquely identify the object. If version information
/// is missing then the latest version is assumed.
/// </summary>
/// <param name="xref">The maintainable reference.</param>
/// <param name="returnLatest">if set to <c>true</c> [return latest].</param>
/// <param name="returnStub">The return Stub.</param>
/// <returns>
/// The <see cref="T:Org.Sdmxsource.Sdmx.Api.Model.Mutable.Base.IAgencySchemeMutableObject" /> .
/// </returns>
/// <exception cref="System.NotImplementedException">Not implemented</exception>
public override IAgencySchemeMutableObject GetMutableAgencyScheme(IMaintainableRefObject xref, bool returnLatest, bool returnStub)
{
return xref.HasVersion()
? this._retrievalEngineContainer.AgencySchemeRetrievalEngine.Retrieve(xref, returnStub.GetComplexQueryDetail(), VersionQueryType.All).FirstOrDefault()
: this._retrievalEngineContainer.AgencySchemeRetrievalEngine.RetrieveLatest(xref, returnStub.GetComplexQueryDetail());
}
示例10: GetAllowedDataflow
/// <summary>
/// Get the latest allowed dataflow with version and agency (if are either defined)
/// </summary>
/// <param name="dataflowRef">
/// The dataflow reference
/// </param>
/// <returns>
/// The allowed dataflow with biggest version
/// </returns>
public IMaintainableRefObject GetAllowedDataflow(IMaintainableRefObject dataflowRef)
{
if (dataflowRef == null)
{
throw new ArgumentNullException("dataflowRef");
}
IMaintainableRefObject actualDataflow = null;
if (dataflowRef.HasAgencyId() && dataflowRef.HasVersion())
{
if (this._authorizationProvider.AccessControl(this._user, dataflowRef))
{
actualDataflow = dataflowRef;
}
}
else
{
IEnumerable<IMaintainableRefObject> dataflowRefBeans = this._authorizationProvider.GetDataflows(
this._user, dataflowRef.MaintainableId);
foreach (IMaintainableRefObject dataflowRefBean in dataflowRefBeans)
{
// TODO fix version comparison
if (actualDataflow == null
|| string.CompareOrdinal(actualDataflow.Version, dataflowRefBean.Version) < 0)
{
actualDataflow = dataflowRefBean;
}
}
}
return actualDataflow;
}