|
Oracle® OLAP Java API Reference 11g Release 2 (11.2) E10794-06 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.olapi.metadata.BaseMetadataObject
oracle.olapi.metadata.mdm.MdmObject
oracle.olapi.metadata.mdm.MdmSource
oracle.olapi.metadata.mdm.MdmDimensionedObject
oracle.olapi.metadata.mdm.MdmAttribute
oracle.olapi.metadata.mdm.MdmSingleValuedAttribute
oracle.olapi.metadata.mdm.MdmBaseAttribute
public final class MdmBaseAttribute
An MdmSingleValuedAttribute
that is typically mapped to one or more columns of a relational table in the database. You can map the same MdmBaseAttribute
to a different column for each level of a dimension or hierarchy, and for attribute values in different languages.
You specify each different mapping with a separate instance of an AttributeMap
. The Expression
of the AttributeMap
can specify a column in a table, or a function or operator that uses one or more columns, or a constant value. You create an AttributeMap
with a findOrCreateAttributeMap
method of a HierarchyLevelMap
, for an MdmHierarchyLevel
, or a MemberListMap
, for an MdmDimensionLevel
or an MdmPrimaryDimension
. The example in this description creates an AttributeMap
for a MemberListMap
for an MdmDimensionLevel
.
You can find an existing MdmBaseAttribute
or create a new one by using the
method of an findOrCreateBaseAttribute
MdmPrimaryDimension
. You can get a List
of the MdmBaseAttribute
objects for an MdmDimension
by using the getAttributes
method.
You can create an MdmBaseAttribute
for an MdmPrimaryDimension
and not associate it with an AttributeMap
. You can then commit the Transaction
and build the dimension. The values of such an unmapped attribute are null for any dimension member.
With the setNVLExpression
method, you can specify a value that substitutes for a null attribute value. The null-value substitution occurs for any null attribute value whether the MdmBaseAttribute
is mapped or unmapped.
When you create an MdmBaseAttribute
, you can specify a SQL data type for it with the setSQLDataType
method. If you do not specify a SQL data type, then Oracle OLAP assigns a default SQL data type that is the common data type of all of the Expression
objects of the AttributeMap
objects that are associated with the MdmBaseAttribute
. If no AttributeMap
objects are associated with the MdmBaseAttribute
, then Oracle OLAP gives the MdmBaseAttribute
a default SQL data type of VARCHAR2(256).
Note: The default data type may change in future versions of this API.
For an existing MdmBaseAttribute
, the AllowAutoDataTypeChange property of the attribute determines how the SQL data type can change. If the AllowAutoDataTypeChange property is false
, which is the default setting, you can only change the SQL data type of the attribute by using the setSQLDataType
method; adding or removing AttributeMap
objects, or changing the Expression
of an AttributeMap
, does not change the SQL data type of the MdmBaseAttribute
.
However, if the AllowAutoDataTypeChange property is true
, then the setSQLDataType
method does not change the SQL data type of the MdmBaseAttribute
. Instead, Oracle OLAP automatically sets the SQL data type of the MdmBaseAttribute
to the data type that is common to all of the Expression
objects in the AttributeMap
objects that are associated with the MdmBaseAttribute
. For example, if you have an attribute that is mapped to a column that has a data type of NUMBER(5) for one level and is also mapped to a column with a data type of NUMBER(12) for another level, then Oracle OLAP uses the NUMBER(12) data type for the attribute. If you then map the same attribute for a third level to a column with a data type of VARCHAR2, then Oracle OLAP determines that it can convert the NUMBER columns to VARCHAR2 data type to match the VARCHAR2 column, and it selects VARCHAR2 as the SQL data type for the MdmBaseAttribute
.
If the AllowAutoDataTypeChange property is true
, then adding or removing an AttributeMap
of a DimensionMap
, or changing the Expression
of an AttributeMap
, may change the SQL data type of the associated MdmBaseAttribute
. You can change the AllowAutoDataTypeChange property with the setAllowAutoDataTypeChange
method.
You can get the data type by calling the getSQLDataType
method. For the data type returned in the various conditions, see Possible Data Types Returned by getSQLDataType table.
// mdmProdDim is an MdmPrimaryDimension that has an MdmDimensionLevel named // ITEM. MdmDimensionLevel mdmItemLevel = mdmProdDim.findOrCreateDimensionLevel("ITEM"); MemberListMap mdmItemLevelMemListMap = mdmItemLevel.findOrCreateMemberListMap(); MdmBaseAttribute mdmPkgAttr = mdmProdDim.findOrCreateBaseAttribute("PACKAGE"); // Map the attribute to a column in a relational table. AttributeMap pkgAttrMap = mdmItemLevelMemListMap.findOrCreateAttributeMap(mdmPkgAttr); ColumnExpression attrColExp = (ColumnExpression) SyntaxObject.fromSyntax("GLOBAL.PRODUCT_DIM.ITEM_PACKAGE", metadataProvider); pkgAttrMap.setExpression(attrColExp); mdmPkgAttr.setAllowAutoDataTypeChange(true); try { // dp is the DataProvider for the session. (dp.getTransactionProvider()).commitCurrentTransaction(); } catch (Exception ex) { println("Could not commit the Transaction. " + ex); } // Build the dimension. BuildItem bldProdDim = new BuildItem(mdmProdDim); ArrayList<BuildItem> items = new ArrayList(); items.add(bldProdDim); BuildProcess bldProc = new BuildProcess(items); try { dp.executeBuild(bldProc, 0); } catch (Exception ex) { println("Could not execute the BuildProcess."); } // Get the SQL data type of the attribute. println("The SQL data type of the " + mdmPkgAttr.getName() + " attribute is " + mdmPkgAttr.getSQLDataType().getSQLText() + "."); // Get the SQL data type of the table column. MdmTable mdmTable = (MdmTable) mdmDBSchema.getTopLevelObject("PRODUCT_DIM"); List<MdmColumn> colList = mdmTable.getColumns(); for (MdmColumn mdmCol : colList) { if (mdmCol.getName().equals("ITEM_PACKAGE")) { println("The SQL data type of the " + mdmCol.getName() + " column is " + mdmCol.getSQLDataType().getSQLText() + "."); } }
The example displays the following.
The SQL data type of the PACKAGE attribute is VARCHAR2(20). The SQL data type of the ITEM_PACKAGE column is VARCHAR2(20).
Method Summary | |
---|---|
java.lang.Object |
acceptVisitor(MdmObjectVisitor visitor, java.lang.Object context) Calls the visitMdmBaseAttribute method of the MdmObjectVisitor and passes that method this MdmBaseAttribute and an Object . |
boolean |
allowAutoDataTypeChange() Indicates whether Oracle OLAP is allowed to automatically change the data type of the attribute. |
java.lang.String |
getAttributeGroupName() Gets the name of the group to which this attribute belongs. |
static SQLDataType |
getDefaultSQLDataType() Gets the default SQL data type for the MdmBaseAttribute . |
MdmViewColumn |
getETAttributeColumn() Gets the MdmViewColumn that represents the ET (Embedded Totals) values for this MdmBaseAttribute . |
Expression |
getNVLExpression() Gets the expression that Oracle OLAP substitutes for an attribute value that is null. |
SQLDataType |
getSQLDataType() Gets the SQL data type for the MdmBaseAttribute . |
boolean |
isMultiLingual() Indicates whether the attribute has values for more than one language. |
boolean |
isPopulateLineage() Indicates whether an analytic workspace associates the values of the MdmBaseAttribute only with the dimension members at the level to which the attribute is mapped or to the members of the mapped level and to the dimension members of all levels that are descendants of the mapped level. |
void |
setAllowAutoDataTypeChange(boolean allowAutoDataTypeChange) Specifies whether to allow Oracle OLAP to automatically change the data type of the attribute. |
void |
setAttributeGroupName(java.lang.String group) Specifies the name of the group to which this attribute belongs. |
void |
setMultiLingual(boolean isMultiLingual) Specifies whether the attribute has values for more than one language. |
void |
setNVLExpression(Expression input) Specifies an Expression that resolves to a value that that you want to substitute for a null attribute value. |
void |
setPopulateLineage(boolean isPopulateLineage) Specifies whether an analytic workspace associates the values of the MdmBaseAttribute only with the dimension members at the level to which the attribute is mapped or to the members of the mapped level and to the dimension members of all levels that are descendants of the mapped level. |
void |
setSQLDataType(SQLDataType type) Specifies a SQL data type for the MdmBaseAttribute . |
Methods inherited from class oracle.olapi.metadata.mdm.MdmAttribute |
---|
getDescriptionType, getDimensionality, getPrimaryDimension, getTargetDimension, getType, isVisibleForAll, setDescriptionType, setIsVisibleForAll, setPrimaryDimension, setTargetDimension |
Methods inherited from class oracle.olapi.metadata.mdm.MdmDimensionedObject |
---|
addDimension, addDimensionality, getDimensions, isBooleanValued, removeDimensionality, setBooleanValued |
Methods inherited from class oracle.olapi.metadata.mdm.MdmSource |
---|
getDataType, getSource |
Methods inherited from class oracle.olapi.metadata.mdm.MdmObject |
---|
addDescription, addObjectClassification, findOrCreateDescription, getDescription, getDescription, getDescription, getDescriptions, getMetadataProvider, getName, getNewName, getObjectClassifications, getShortDescription, isClassifiedAs, removeDescription, removeObjectClassification, setDescription, setDescription, setDescription, setName, setShortDescription |
Methods inherited from class oracle.olapi.metadata.BaseMetadataObject |
---|
getContainedByObject, getID, getOwner |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public java.lang.Object acceptVisitor(MdmObjectVisitor visitor, java.lang.Object context)
visitMdmBaseAttribute
method of the MdmObjectVisitor
and passes that method this MdmBaseAttribute
and an Object
.acceptVisitor
in class MdmObject
visitor
- An MdmObjectVisitor
that implements the Mdm11_ObjectVisitor
interface. .context
- An Object
.Object
returned by the visitMdmBaseAttribute
method.public final boolean isMultiLingual()
boolean
that indicates whether the attribute has values for more than one language.public final void setMultiLingual(boolean isMultiLingual)
isMultiLingual
- A boolean
that specifies whether the attribute has values for more than one language.public final boolean isPopulateLineage()
MdmBaseAttribute
only with the dimension members at the level to which the attribute is mapped or to the members of the mapped level and to the dimension members of all levels that are descendants of the mapped level.boolean
that is true
if attribute values for the mapped level also apply to all descendant levels, or false
if the attribute values apply only to the mapped level.public final void setPopulateLineage(boolean isPopulateLineage)
MdmBaseAttribute
only with the dimension members at the level to which the attribute is mapped or to the members of the mapped level and to the dimension members of all levels that are descendants of the mapped level. You should only specify true
for the isPopulateLineage
parameter for an MdmBaseAttribute
that has the following characteristics:
MdmDimensionLevel
.isPopulateLineage
- A boolean
that is true
to apply the attribute values to the dimension members at the mapped level and to the members at all descendant levels, or false
to apply the attribute values only to the dimension members at the mapped level.public final java.lang.String getAttributeGroupName()
String
that identifies the attribute group.public final void setAttributeGroupName(java.lang.String group)
group
- A String
that identifies the attribute group.public static final SQLDataType getDefaultSQLDataType()
MdmBaseAttribute
.SQLDataType
that represents the default SQL data type.public final SQLDataType getSQLDataType()
MdmBaseAttribute
. Oracle OLAP determines the data type in one of the following ways.
MdmBaseAttribute
has the AllowAutoDataTypeChange property set to true
:
MdmBaseAttribute
has AttributeMap
objects that are associated with it, then the data type is the common data type of all of the Expression
objects of the AttributeMap
objects.MdmBaseAttribute
has no associated AttributeMap
objects, then the data type is the default type, which is VARCHAR2(256).MdmBaseAttribute
has the AllowAutoDataTypeChange property set to false
, which is the default value:
setSQLDataType
method of the attribute, then the data type is the one specified by that method.setSQLDataType
method of the attribute and the MdmBaseAttribute
has AttributeMap
objects associated with it, then the data type is the common data type of all of the Expression
objects of the AttributeMap
objects that were associated with the MdmBaseAttribute
when it was first committed. If the MdmBaseAttribute
had no associated AttributeMap
objects when it was first committed, then the data type is the default type, VARCHAR2(256).getSQLDataType
in class MdmAttribute
SQLDataType
that represents the SQL data type.allowAutoDataTypeChange()
, setAllowAutoDataTypeChange(boolean allowAutoDataTypeChange)
public final void setSQLDataType(SQLDataType type)
MdmBaseAttribute
. If the MdmBaseAttribute
does not have a specified SQL data type and the attribute has one or more associated AttributeMap
objects with valid expressions, then Oracle OLAP uses the common data type of the values specified by the mappings. If the attribute does not have a specified SQL data type and it does not have an associated AttributeMap
, then Oracle OLAP uses the default SQL data type of VARCHAR2(256).
If the AutoDataTypeChange property of the MdmBaseAttribute
is set to true, then Oracle OLAP ignores the data type specified by this method and automatically sets the SQL data type.
type
- The SQLDataType
to associate with this MdmBaseAttribute
.allowAutoDataTypeChange()
, setAllowAutoDataTypeChange(boolean allowAutoDataTypeChange)
public final boolean allowAutoDataTypeChange()
boolean
that is true
if Oracle OLAP can automatically change the data type of the attribute or false
otherwise.public final void setAllowAutoDataTypeChange(boolean allowAutoDataTypeChange)
true
to allow the automatic changing of data types, then Oracle OLAP evaluates the expressions of the AttributeMap
objects for the attribute that are contained by the DimensionMap
for the MdmPrimaryDimension
that contains the attribute. Based on the data types of those expressions, Oracle OLAP determines the appropriate data type for the attribute. If the attribute has mappings on several levels or hierarchies of the dimension, then the automatically derived data type is a common supertype of all of the mapped expressions.allowAutoDataTypeChange
- Specify true
if you want to allow Oracle OLAP to automatically change the data type of the attribute or false
otherwise.public final MdmViewColumn getETAttributeColumn()
MdmViewColumn
that represents the ET (Embedded Totals) values for this MdmBaseAttribute
.MdmViewColumn
that represents the ET column for this MdmBaseAttribute
.public final Expression getNVLExpression()
Expression
that substitutes for an attribute value that is null.public final void setNVLExpression(Expression input)
Expression
that resolves to a value that that you want to substitute for a null attribute value. The setNVLExpression
is similar to the SQL NVL function, and the OLAP DML NAFILL function and $NATRIGGER property.input
- An Expression
that you want to substitute for an attribute value that is null.
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |