You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

499 lines
27 KiB

//======================================================================================================
//Copyright 2020 Siemens Digital Industries Software
//==================================================
//Copyright $2015.
//Siemens Product Lifecycle Management Software Inc.
//All Rights Reserved.
//==================================================
//Copyright 2020 Siemens Digital Industries Software
/**
@file
This header file declares all functions and data types to be used by clients of Attributes & Target module.
*/
#ifndef TEAMCENTER_ATT0_ATTRIBUTE_TARGET_SERVICES_HXX
#define TEAMCENTER_ATT0_ATTRIBUTE_TARGET_SERVICES_HXX
#include <string>
#include <vector>
#include <map>
#include <unidefs.h>
#include <Att0attrtargetmgmt/libatt0attrtargetmgmt_exports.h>
/**
@defgroup ATT0ATTRTARGETMGMT Attributes and Target Management
@ingroup TC
A Measurable Attribute is a characteristic of the system which can be externally observed
and has a target value or range in the context of the product, which must be satisfied before
the product is delivered. It consists of two parts. One is the goal value the other is the
measured/validated value.
A measurable attribute may have more than one measured value (dependent of product maturity) and
can be seen in context of more than one application object.
Example: mass, cost, speed, pressure and other constituents of energy flow
@{
*/
namespace Teamcenter
{
class ATT0ATTRTARGETMGMT_API AttributeTargetServices
{
public:
/**
* This enum represents the synchronization direction.
*/
enum SyncDirection
{
SyncSource, /**< The synchronization direction is from source attribute to input attributes. */
PublishSource /**< The synchronization direction is from output attribute to source attributes. */
};
/**
* Represents the Measurable Attribute type
*/
enum AttrAttributeType
{
SourceAttribute, /**< Specify that the attribute is a source attribute. */
OverriddenAttr, /**< Specify that the attribute is a Overridden attribute. */
InputAttribute, /**< Specify that the attribute is an input attribute. */
SyncCandidate, /**< If the Input attribute is out of sync with source attribute. */
OUTPUTATTR_NOTUPDATE, /**< If the Output attribute no needs for publication. */
OUTPUTATTR_PUBLISHCANDIDATE, /**< If the Output attribute is out of sync with source attribute. */
OUTPUTATTR_PUBLISHED, /**< If the Output attribute has been published. */
SOURCEATTRINPUT, /**< If the attribute for Study is Input on AR */
SOURCEATTROUTPUT /**< If the attribute for Study is Output on AR */
};
/**
* Represents the input information required to retrieve associated attributes
*/
struct AttributeInput
{
tag_t parentObject; /**< The parent object to get the associated attributes. */
tag_t parentLine; /**< The parent line of the measurable attribute. */
tag_t contextLine; /**< If the parent object is a BOMLine and if the overridden attributes are needed then this parameter represents the context in the structure to get the overridden attribute. */
std::vector<std::string> relationList; /**< List of relation type names to get the associated attributes using these relations. */
std::vector<tag_t> apnList; /**< The list of APNs present on the @p parentLine. This is optional parameter. */
std::map< tag_t, std::map<std::string, tag_t> > configInfo; /**< The name value pair of BVR for root object and value as map with name as configuration name and its value. */
/**
* Constructor to auto-initialize internal state.
*/
AttributeInput():parentObject(NULL), contextLine(NULL), parentLine(NULL)
{}
};
/**
* Represents the input information required to retrieve associated attributes
*/
struct AttributeInput2
{
tag_t arObject; /**< The AnalysisRequest object to get the associated input/output attributes. This will be NULL if @p parentObject is provided
This object can either be AnalysiRequest or Study.*/
std::map<tag_t, tag_t> assignedElementToRevisionMap; /**< The name/value pair of assigned element and its underlying revision. The assigned element type is
absOccData. This map will have assigned elements of @p arObject*/
std::map<tag_t, tag_t> assignedElementToRevisionMapForAR; /**< The name/value pair of assigned element and its underlying revision. The assigned element type is absOccData. If @p arObject is Study then this map will have assigned elements of
AnalysisRequest associated with study.*/
std::vector<tag_t> absOccDataList; /**< The list of objects to get the associated overridden attributes. This will be NULL if @p arObject is provided*/
tag_t revObject; /**< The underlying configured revision to get associated attributes. For Attributes on BomLine, this should be configured revision on
BomLine and for Attributes on revision, this should be the revision object to get the attributes.*/
std::vector<std::string> relationList; /**< List of relation type names to get the associated attributes using these relations. */
/**
* Constructor to auto-initialize internal state.
*/
AttributeInput2():arObject(NULLTAG), revObject(NULLTAG)
{}
};
/**
* This enum represents impact analysis type
*/
enum AttrImpactAnlysisType
{
AnlyzeStudyReferences
};
/**
* This structure represents the information for a given attribute.
*/
struct AttributeInfo
{
tag_t attribute; /**< The measurable attribute object. */
tag_t sourceAttribute; /**< The source attribute for the Input/Output attribute. */
AttrAttributeType attrType; /**< The attribute type. */
std::string occName; /**< Name of the occurrence to which attribute is associated with. */
/**
* Constructor to auto-initialize internal state.
*/
AttributeInfo()
{
attribute = 0;
attrType = SourceAttribute;
sourceAttribute = 0;
}
};
/**
* This structure represents all the associated attributes with the given parent using specific relation
*/
struct ParentAttrList
{
std::string relationType; /**< This structure represents all the associated attributes with the given parent using specific relation. */
std::vector<AttributeInfo> objectList; /**< List of objects connected to parent object. */
/**
* Constructor to auto-initialize internal state.
*/
ParentAttrList()
{}
};
/**
* Represents the input information required to find measurable attribute for specific occdata and relation
*/
struct FindContextAttributeInput
{
tag_t sourceAttr; /**< The source attribute to find the associated "Att0AttrBased " attributes. */
tag_t occData; /**< The Abs0OccData to find associated attribute. */
std::string relationName; /**< The relation name used with occData to find associated attribute.*/
/**
* Constructor to auto-initialize internal state.
*/
FindContextAttributeInput():sourceAttr(NULL), occData(NULL)
{}
};
/**
* Represents the input information required to find measurable attribute of synchronized candidates.
*/
struct FindSyncAttributeCandidatesInput
{
tag_t parentObject; /**< The Validation Contract object. */
SyncDirection direction; /**< The direction in which sync operation needs to be performed. If the direction is not provided, the output will have no values */
std::vector<tag_t> attrCandidates; /**< (I) A list of Att0MeasurableAttribute which need to be synchonized, this is optional. This is optional parameter.*/
std::vector<std::string> relationTypeNames; /**< (I) The input/output Att0MeasurableAttribute relation name which is used to find all input/output Att0MeasurableAttribute instances. If the relationTypeNames is not provided, the output will have no values. */
std::map< tag_t, std::map<std::string, tag_t> > configInfo; /**< The name value pair of BVR for root object and value as map with name as configuration name and its value. This is optional parameter.*/
/**
* Constructor to auto-initialize internal state.
*/
FindSyncAttributeCandidatesInput():parentObject(NULL), direction(SyncSource)
{}
};
/**
* Represents the input information perform synchronize or publish measurable attribute.
*/
struct SyncOrPublishAttributeInput
{
tag_t parentObject; /**< The Validation Contract object. */
std::vector<AttributeInfo> attrSyncCandidatesInfoList; /**< A list of Att0MeasurableAttribute which need to be synchonized. This is optional parameter.*/
std::vector<std::string> relationTypeNames; /**< The input/output Att0MeasurableAttribute relation name which is used to find all input/output Att0MeasurableAttribute instances.*/
std::map< tag_t, std::map<std::string, tag_t> > configInfo; /**< The name value pair of BVR for root object and value as map with name as configuration name and its value. This is optional parameter.*/
/**
* Constructor to auto-initialize internal state.
*/
SyncOrPublishAttributeInput():parentObject(NULL)
{}
};
/**
Creates MeasurableAttributes with the properties specified in the nameValuePair.
@returns
<ul>
<li>#ITK_ok on success
<li>#ATT0ATTRTARGETMGMT_disabled_attrdefrev_error if the attribute definition revision &quot;%1$&quot; is not enabled
<li>#ATT0ATTRTARGETMGMT_not_matched_attrdef_type if the attribute definition type is diffrent than attributeType
</ul>
*/
static int attrCreateMeasurableAttribute(
const std::string & typeName, /**< (I) Type of Measurable Attribute to create new object. */
const std::string & attrName, /**< (I) Name of Measurable Attribute. */
const std::map<std::string, std::vector<std::string> > & nameValuePair, /**< (I) Name value pair of properties to be set on new object. */
tag_t & createdObject /**< (O) Created Measurable Attribute object. */
);
/**
Creates MeasureValue with the properties specified in the nameValuePair.
@returns
<ul>
<li>#ITK_ok on success
<li>#ITK_internal_error if @p typeName or @p nameValuePair is empty
</ul>
*/
static int attrCreateMeasureValue(
const std::string & typeName, /**< (I) Type of Measure Value to create new object. */
const std::map<std::string, std::vector<std::string> > & nameValuePair, /**< (I) Name value pair of properties to be set on new object. */
tag_t & createdObject /**< (O) Created Measurable Attribute object. */
);
/**
Creates Measurement from Measurable Attribute and Measure Value list.
@returns
<ul>
<li>#ITK_ok on success
<li>#ITK_internal_error if @p attrTag or @p measureValues is invalid
</ul>
*/
static int attrCreateMeasurement(
tag_t attrTag, /**< (I) Measurable Attribute object. */
const std::vector<tag_t> & measureValues, /**< (I) List of Measure Value objects. */
tag_t & createdObject); /**< (O) Created Measurable Attribute object. */
/**
Retrieves the associated attributes with the given input object.
<br/>If the input object is a BOM Line, it will return both overiden and source attribute objects.
@returns
<ul>
<li>#ITK_ok on success
<li>#ATT0ATTRTARGETMGMT_parent_isnull if parent object is not provided in input
</ul>
*/
static int attrGetMeasurableAttributes(
const AttributeInput & input, /**< (I) Information to get associated attributes on parent object. */
bool & isValidationLine, /**< (O) True if the ParentLine in @p input belongs to the parentObject. */
std::vector < ParentAttrList > & output /**< (O) Associated Measurable Attributes. */
);
/**
Retrieves the associated attributes with the given input object.
<br/>If the input object is a AbsOccData, it will return both overiden and source attribute objects.
@returns
<ul>
<li>#ITK_ok on success
<li>#ATT0ATTRTARGETMGMT_parent_isnull if parent object is not provided in input
</ul>
*/
static int attrGetMeasurableAttributes2(
const AttributeInput2 & input, /**< (I) Information to get associated attributes on parent object. */
std::vector < ParentAttrList > & output /**< (O) Associated Measurable Attributes. */
);
/**
Modifies the existing Att0MeasurableAttribute properties in the database.
@returns
<ul>
<li>#ITK_ok on success
<li>#ITK_internal_error if attrObj is not provided in input
</ul>
*/
static int attrModifyAttributeProperties(tag_t attrObj, /**< (I) Measurable Attribute object */
const std::string & measureValueType, /**< (I) Measure Value type. */
const std::map<std::string, std::vector<std::string> > & attrNameValuePair, /**< (I) Name value pair for the properties to be modified on Measurable Attribute object. This is optional. */
const std::map<std::string, std::vector<std::string> > & measureNameValuePair,/**< (I) Name value pair for the properties to be modified on Measure Value object. */
tag_t & measureValueObj /**< (O) New Measure Value object. */
);
/**
Retrieves the list of Input/Output attributes connected with the parentObject.
@returns
<ul>
<li>#ITK_ok on success
<li>#ATT0ATTRTARGETMGMT_parent_isnull if parentObject is not provided in input
</ul>
*/
static int attrGetInputOuputMeasurableAttributes(
tag_t parentObject, /**< (I) Parent object for Input/Output attribute. */
std::map< tag_t, std::map<std::string, tag_t> > configInfo, /**< The name value pair of BVR for root object and value as map with name as configuration name and its value. */
const std::vector<std::string> & relationTypeNames, /**< (I) List of relation types to get Input/Output relation. */
std::vector< ParentAttrList > & output /**< (O) List of Input/Output attributes with Occurrence Name. */
);
/**
Creates a new copy of source Measurable Attribute object.
<br/>Along with Measurable Attribute, creates a copy of Measurement and MeasureValue object.
@returns
<ul>
<li>#ITK_ok on success
<li>#ITK_internal_error if @p sourceObjList is empty
</ul>
*/
static int attrHardCopy(
const std::vector<tag_t> & sourceObjList, /**< (I) The list of source objects. */
std::vector<tag_t> & newObjTagList /**< (O) The list of new hard copied objects. */
);
/**
Synchronizes the Att0MeasurableAttribute property from the source attribute to the input Att0MeasurableAttribute under the Validation Contract context.
@returns
<ul>
<li>#ITK_ok on success
<li>#ATT0ATTRTARGETMGMT_parent_isnull if @p parentObject is not provided in input
</ul>
*/
static int attrFindSyncMeasurableAttributesCandidates(
tag_t parentObject, /**< (I) The Validation Contract object. */
SyncDirection direction, /**< (I) The direction in which sync operation needs to be performed. If the direction is not provided, the output will have no values */
const std::vector<tag_t> & attrCandidates, /**< (I) A list of Att0MeasurableAttribute which need to be synchonized, this is optional. */
const std::vector<std::string> & relationTypeNames, /**< (I) The input/output Att0MeasurableAttribute relation name which is used to find all input/output Att0MeasurableAttribute instances. If the relationTypeNames is not provided, the output will have no values. */
std::vector<AttributeInfo> & attributeInfoList /**< (O) The Att0MeasurableAttribute instances which needs to be synchronized. */
);
/**
Synchronizes the Att0MeasurableAttribute property from the source attribute to the input Att0MeasurableAttribute under the Validation Contract context.
@returns
<ul>
<li>#ITK_ok on success
<li>#ATT0ATTRTARGETMGMT_parent_isnull if parentObject is not provided in input
</ul>
*/
static int attrSyncMeasurableAttributes( tag_t parentObject, /**< (I) The Validation Contract object. */
const std::vector<AttributeInfo> & attrSyncCandidatesInfoList, /**< (I) A list of Att0MeasurableAttribute which need to be synchonized, this is optional. */
const std::vector<std::string> & inputRelationTypeNames, /**< (I) The input Att0MeasurableAttribute relation name which is used to find all input Att0MeasurableAttribute instances. If the inputRelationTypeNames is not provided, the output will have no values. */
std::vector<tag_t> & synchonizedObjects /**< (O) The Att0MeasurableAttribute instances which are synchronized. */
);
/**
Publishes the output Att0MeasurableAttribute properties under the Validation Contract context to the source Att0MeasurableAttribute instances.
@returns
<ul>
<li>#ITK_ok on success
<li>#ATT0ATTRTARGETMGMT_parent_isnull if parentObject is not provided in input
</ul>
*/
static int attrPublishMeasurableAttributes( tag_t parentObject, /**< (I) The Validation Contract object. */
const std::vector<AttributeInfo> & attrPublishCandidatesInfoList, /**< (I) A list of Att0MeasurableAttribute which need to be published, this is optional. */
const std::vector<std::string> & outputRelationTypeNames, /**< (I) The output Att0MeasurableAttribute relation name which is used to find all output Att0MeasurableAttribute instances. If the outputRelationTypeNames is not provided, the output will have no values. */
std::vector<tag_t> & synchonizedObjects /**< (O) The Att0MeasurableAttribute instances which are publised. */
);
/**
Synchronizes the Att0MeasurableAttribute property from the source attribute to the input Att0MeasurableAttribute under the Validation Contract context.
@returns
<ul>
<li>#ITK_ok on success
<li>#ATT0ATTRTARGETMGMT_parent_isnull if @p parentObject is not provided in input
</ul>
*/
static int attrFindSyncMeasurableAttributesCandidates(
const FindSyncAttributeCandidatesInput & syncAttributeCandidateInput, /**< (I) Information to find synchronize attribute candidates. */
std::vector<AttributeInfo> & attributeInfoList /**< (O) The Att0MeasurableAttribute instances which needs to be synchronized. */
);
/**
Synchronizes the Att0MeasurableAttribute property from the source attribute to the input Att0MeasurableAttribute under the Validation Contract context.
@returns
<ul>
<li>#ITK_ok on success
<li>#ATT0ATTRTARGETMGMT_parent_isnull if parentObject is not provided in input
</ul>
*/
static int attrSyncMeasurableAttributes( const SyncOrPublishAttributeInput & input, /**< (I) Information to perform sync attribute. */
std::vector<tag_t> & synchonizedObjects /**< (O) The Att0MeasurableAttribute instances which are synchronized. */
);
/**
Publishes the output Att0MeasurableAttribute properties under the Validation Contract context to the source Att0MeasurableAttribute instances.
@returns
<ul>
<li>#ITK_ok on success
<li>#ATT0ATTRTARGETMGMT_parent_isnull if parentObject is not provided in input
</ul>
*/
static int attrPublishMeasurableAttributes( const SyncOrPublishAttributeInput & input, /**< (I) Information to perform publish attribute. */
std::vector<tag_t> & synchonizedObjects /**< (O) The Att0MeasurableAttribute instances which are publised. */
);
/**
Find the measurable attribute instance for given Abs0OccData and relation.
@returns
<ul>
<li>#ITK_ok on success
<li>#ATT0ATTRTARGETMGMT_parent_isnull if parentObject is not provided in input
</ul>
*/
static int attrFindMeasurableAttributeForConext( const std::vector< FindContextAttributeInput > &attrFindContextAttrbutesInfoList, /**< (I) Information to get associated attributes on parent object */
std::vector<tag_t> & matchedObjects /**< (O) The Att0MeasurableAttribute instances which are found against input info. */
);
/**
Performs the validation if the provided Analysis Request object is modifiable according to it current state.
@returns
<ul>
<li>#ITK_ok on success
</ul>
*/
static int attrEvaluateCreateCondition( tag_t attributeObj, /**< (I) The MeasurableAttribute object. If the analysisRequestObj is provided then this parameter is optional. */
tag_t analysisRequestObj, /**< (I) The AnalysisRequest object. If the attributeObj is provided then this parameter is optional. */
const std::string & attrTypeStr /**< (I) The possible values are "Input", "Output", "Sync", "Publish" */
);
/**
Returns impacted objects with attribute based on analysisType
@returns
<ul>
<li>#ITK_ok on success
</ul>
*/
static int attrAnalyzeAttrReferences(std::vector<tag_t> attrObjs,
int impactAnalysisType,
std::vector<std::map<tag_t, tag_t > > & output_map_list);
};
}
#include <Att0attrtargetmgmt/libatt0attrtargetmgmt_undef.h>
#endif