|
Query |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BusinessModel
Specified an abstract, persistable container that contains BusinessModelObject type items. The container can have up to one parent container and multiple child containers, with child container items (BusinessModelObjects) able to leverage the definitions of items in parent containers. The lineage from a business model, to its parent, to its grandparent and so on is called the business model chain.
The business model chain as described above is viewed relative to a specific business model -- always looking upwards through the parent to its ancestor business models. A business model tree is the tree of business models that exists when finding a business model's topmost ancestor (the root business model) and looking down the tree from that root model.
Each business model has an ID that must be unique within its business model chain. SAS Query Services does not require all business models within a tree to have unique IDs ... just in all of the chains that traverse through the tree.
A BusinessModel allows for the creation and management of a set of data sources, business rules to use when accessing those data sources, and business items -- which represent a variety of types of objects (see the BusinessItem interface for details). The business model provides a logical layer for shielding, sharing and transparency of the data described by physical metadata.
Multiple logical layers can be created by creating child business models of other child business models. In practice, this is provided by creating DataSelections based on other DataSelections.
Business models can be chained together to allow for one business model to be "based upon" another business model. A single business model can be directly based on at most one other business model. A business model is said to be an extended business model if it has a base model. This "basing" of business models upon one another allows for providing the ability of an extended business model to use data sources defined by prior business models (in its chain of business models) in the definition of business items contained within the extended business model. The concatenated list of business rules defined in business models within the business model chain (in the order from "root business model" to the business model in question) are said to be "in effect" for an extended business model unless they are overridden by business rules in those extended business models. Business items defined in base business models are not "contained" within extended business models but are available for use by those extended models (for example, in defining business items based on previous models' business items) and by business queries that use those extended models.
There are three base object types containable within a business model. They are:
Data sources provide information on the sources of data such as database objects or files and information on how to access the sources.
Business rules provide information on how to use the data from the data sources. For example, how to join tables or preferences on which servers to move data from or to.
Business items provide a layer of business information above the physical information that adds the logical layer for shielding, sharing and transparency from the physical information. There are several types of business items:
To get a list of objects contained within a business model, use the getObjects() method. For example, one can get the list of data items contained within a business model and any business models it is based upon by calling getObjects(true, DataItem.class)
See the package level javadoc for more on the business model.
Field Summary | |
---|---|
static java.lang.String |
EVENT_BUSINESS_ITEMS_CHANGED
The event indicating that the list of business items contained in this object has changed. |
static java.lang.String |
EVENT_BUSINESS_RULES_CHANGED
The event indicating that the list of business rules contained in this object has changed. |
static java.lang.String |
EVENT_CHILD_ADDED
This event indicates that a child data selection was added to this data selection |
static java.lang.String |
EVENT_CHILD_REMOVED
This event indicates that a child data selection was added to this data selection |
static java.lang.String |
EVENT_DATA_SOURCES_CHANGED
The event indicating that the list of data sources contained in this object has changed. |
static int |
GETOBJECTS_DEFAULT_SEARCH_CRITERIA
Use only the current model in the search and exclude hidden objects |
static int |
GETOBJECTS_INCLUDE_BASE_MODELS
To include base models in the search |
static int |
GETOBJECTS_INCLUDE_HIDDEN
To include hidden objects in the search |
static char[] |
INVALID_ID_CHARS
List of Characters NOT allowed in an id. |
static int |
SEARCH_NONRECURSIVELY
This "search-criteria" flag is used to ask for returning only the immediately referred to resources (of the specified type in the objects definition) by any object that implements the BusinessModelResourceReferencer.getResources() method. |
static int |
SEARCH_THRU_ALL
This "search-criteria" flag is used to request to recursively look through all parts of an object's definition for returning resources of the specified type by any object that implements the BusinessModelResourceReferencer.getResources() method. |
static int |
SEARCH_THRU_PROMPTS
This "search-criteria" flag is used to request "looking through prompt" for returning resources (of the specified type in the objects definition) by any object that implements the BusinessModelResourceReferencer.getResources() method. |
static int |
SEARCH_THRU_SUBDATAITEMS
This "search-criteria" flag is used to request "looking through data items" for returning resources (of the specified type in the objects definition) by any object that implements the BusinessModelResourceReferencer.getResources() method. |
static int |
SEARCH_THRU_SUBFILTERS
This "search-criteria" flag is used to request "looking through filters" for returning resources (of the specified type in the objects definition) by any object that implements the BusinessModelResourceReferencer.getResources() method. |
Fields inherited from interface com.sas.iquery.metadata.business.Model |
---|
EVENT_DESCRIPTION_CHANGED, EVENT_ID_CHANGED, EVENT_LABEL_CHANGED, INTERMODEL_ID_DELIMITER |
Fields inherited from interface com.sas.iquery.metadata.business.Base |
---|
EVENT_OBJECT_DEFINITION_CHANGED |
Method Summary | ||
---|---|---|
void |
addBusinessItem(BusinessItem businessItem)
Adds the specified BusinessItem to this business model. |
|
void |
addBusinessItem(int index,
BusinessItem businessItem)
Adds a business item at the specified index in the list of business items within this business model. |
|
boolean |
contains(boolean includeBaseModels,
BusinessModelObject businessModelObject)
Returns an indication of whether the given business model object is contained within the lists (of data sources, business rules, or business items) managed by this object or any base models. |
|
boolean |
contains(BusinessModelObject businessModelObject)
Returns an indication of whether the given business model object is contained within the lists (of data sources, business rules, or business items) managed by this object. |
|
java.lang.String |
generateIntraModelID(java.lang.String proposedID)
Returns a suggested ID to use within this business model based on the specified proposed ID. |
|
BusinessModel |
getBaseModel()
This returns the same as getParentBusinessModel() |
|
BusinessItem |
getBusinessItemByID(java.lang.String ID)
Returns the business item with the specified ID. |
|
java.util.List<BusinessItem> |
getBusinessItemsNotInMapFolders()
Returns a list of business items that are contained within this business model but that are not contained within an business model folder accessible via the root folder. |
|
java.util.List |
getChildren()
Returns a list of BusinessModel objects directly based upon this business model. |
|
java.util.Locale |
getComputationalLocale()
Returns the locale that is used to define such data comparison actions as "less than or equal to Red". |
|
java.util.Locale |
getDataLocale()
Deprecated. getDataLocale has been deprecated please use getComputationalLocale |
|
java.util.List |
getDescendents()
Returns a list of child BusinessModel objects that are descendents of this business model (a child of this business model or a descendant of a child). |
|
java.lang.String |
getFamilyStateDebugString()
Returns a string representative of the contents of the family of business models that this business model is related to and is not meant to be programmatically consumed, only visually for debugging purposes. |
|
java.util.List<BusinessGroup> |
getGroupsContaining(BusinessModelObject bmObject,
BusinessGroup.Type type)
Returns the list of (@code BusinessGroup} objects contained within this model with the specified BusinessGroup.Type and containing specified (@code BusinessModelObject}. |
|
MapFolder |
getMapFolderContaining(BusinessItem item)
Returns the folder off of the root business model folder that contains the specified business item |
|
IntelligentQueryMetadataServiceInterface |
getMetadataService()
Returns the metadata service associated with this model. |
|
|
getObjects(boolean includeBaseModels,
java.lang.Class<T> type)
Returns the list of BusinessModelObject objects contained
within this business model, and optionally within base business models,
of the specified type. |
|
|
getObjects(int flags,
java.lang.Class<T> type)
Returns the list of BusinessModelObject objects of a specific type using the provided search definition flags. |
|
BusinessModel |
getParentBusinessModel()
Returns the business model that this business model is directly based on, if any. |
|
java.util.List |
getResources(java.lang.Class c)
Returns the resources of the specified class used by this business model. |
|
MapFolder |
getRootMapFolder()
Returns the root folder of the user-organized business items within this model. |
|
ServerProperties |
getServerProperties()
Returns the ServerProperties object usable in defining business items contained within this model. |
|
com.sas.services.session.SessionContextInterface |
getSession()
Returns the session this model was created for use in |
|
StructureOfData |
getStructure()
Returns an indication as to the type or structure of the data being referenced by the busing model. |
|
java.util.List |
getUnresolvedResources()
Returns a list of unresolved resources that are referenced by objects in this business model. |
|
boolean |
isIntraModelIDInUse(java.lang.String ID)
Returns an indication of whether the given intra-model ID is used by an object contained within this business model. |
|
boolean |
isLegalID(java.lang.String ID)
Returns an indication of whether the given ID has a legal format. |
|
boolean |
isReadOnly()
Returns whether this object is read-only. |
|
boolean |
isValidLabel(java.lang.String label)
Checks if a label name is valid A null label or a label containing forward slash (/) or backward slash (\) is not valid |
|
BusinessGroup |
newBusinessGroup(BusinessGroup.Type type)
Creates a BusinessGroup object with the specified BusinessGroup.Type . |
|
CompoundFilter |
newCompoundFilter()
Creates a CompoundFilter object and returns it. |
|
com.sas.iquery.metadata.business.RootDataItem |
newDataItem()
Creates a DataItem object and returns it. |
|
DataItemReference |
newDataItemReference(DataItem baseDataItem)
Creates a new DataItemReference object and returns it. |
|
DrillThroughToDetail |
newDrillThroughToDetail()
Factory method for creating a DrillThroughToDetail business rule. |
|
FilterCascadeRule |
newFilterCascadeRule()
Creates a FilterCascadeRule object and returns it. |
|
FilterItem |
newFilterItem()
Creates a FilterItem object and returns it. |
|
Prompt |
newPrompt()
Creates a prompt and returns it. |
|
java.util.List |
removeBusinessItem(BusinessItem businessItem)
Removes the specified BusinessItem object and any BusinessItem objects dependent on the given object from this business model. |
|
void |
removeChild(BusinessModel child)
Deprecated. the Model.dispose() method is the preferred way to
indicate that a child model and its descendants are no longer needed
and should be removed from memory.
When migrating to the dispose method,
BE SURE to call the .dispose() method on the model previously
used as the parameter for this method.
See the dispose method for details.
|
|
void |
setBusinessItems(java.util.List<BusinessItem> businessItemsToSet)
Sets the list of business items contained within this business model. |
|
void |
setComputationalLocale(java.util.Locale locale)
Sets the locale that is used to define such data comparison actions as "less than or equal to Red". |
|
void |
setReadOnly()
Marks this business model and any objects it manages (contains) as read-only. |
|
java.lang.String |
toXML(int spacesPerIndentation)
Returns the XML persistence form for this business model. |
|
org.w3c.dom.Element |
write(org.w3c.dom.Element parentElement)
Serializes this model as a sub-element to the given DOM element and returns the subelement representing this model. |
Methods inherited from interface com.sas.iquery.metadata.business.Model |
---|
computeModelVersion, dispose, getDescription, getID, getLabel, getLastPersistedModelVersion, setDescription, setID, setLabel |
Methods inherited from interface com.sas.iquery.metadata.business.BusinessModelResource |
---|
isUnresolved |
Methods inherited from interface com.sas.iquery.metadata.NamedObjectInterface |
---|
getDescription, getLabel |
Methods inherited from interface com.sas.iquery.metadata.business.BusinessModelResourceReferencer |
---|
getResources |
Methods inherited from interface com.sas.iquery.metadata.business.UsabilityInterface |
---|
getReasonsUnusable, isUsableInQuery |
Field Detail |
---|
static final java.lang.String EVENT_DATA_SOURCES_CHANGED
static final java.lang.String EVENT_BUSINESS_RULES_CHANGED
static final java.lang.String EVENT_BUSINESS_ITEMS_CHANGED
static final java.lang.String EVENT_CHILD_ADDED
static final java.lang.String EVENT_CHILD_REMOVED
static final char[] INVALID_ID_CHARS
static final int GETOBJECTS_INCLUDE_BASE_MODELS
static final int GETOBJECTS_INCLUDE_HIDDEN
static final int GETOBJECTS_DEFAULT_SEARCH_CRITERIA
static final int SEARCH_NONRECURSIVELY
For example, in the following code segment the list of resources returned are cf1 and fi3.
CompoundFilter cf1 = businessModel.newCompoundFilter(); FilterItem fi1 = businessModel.newFilterItem(); FilterItem fi2 = businessModel.newFilterItem(); cf1.setLeftFilter(fi1); cf1.setRightFilter(fi2); CompoundFilter cfTop = businessModel.newCompoundFilter(); FilterItem fi3 = businessModel.newFilterItem(); cfTop.setLeftFilter(cf1); cfTop.setRightFilter(fi3); List immediateResources = cfTop.getResources(FilterItem.class, BusinessModel.SEARCH_NONRECURSIVELY); // The list returned contains only cf1 and fi3 since the non-recursive flag was used. // Both the left and right filters are returned since the CompoundFilter class extends FilterItem.
static final int SEARCH_THRU_SUBFILTERS
For example, see the following code segment.
CompoundFilter cf1 = businessModel.newCompoundFilter(); FilterItem fi1 = businessModel.newFilterItem(); FilterItem fi2 = businessModel.newFilterItem(); cf1.setLeftFilter(fi1); cf1.setRightFilter(fi2); CompoundFilter cfTop = businessModel.newCompoundFilter(); FilterItem fi3 = businessModel.newFilterItem(); cfTop.setLeftFilter(cf1); cfTop.setRightFilter(fi3); List immediateResources = cfTop.getResources(FilterItem.class, BusinessModel.SEARCH_THRU_SUBFILTERS); // The list returned contains cf1, fi1, fi2, and fi3 since the look-through-filters flag was used.
static final int SEARCH_THRU_SUBDATAITEMS
static final int SEARCH_THRU_PROMPTS
static final int SEARCH_THRU_ALL
Method Detail |
---|
boolean isValidLabel(java.lang.String label)
label
- the string to use as the label.
BusinessModel getBaseModel()
BusinessModel getParentBusinessModel()
It is not possible to set or change the base model for a business model after the business model has been created.
java.util.List getChildren()
No order of the children is implied or guaranteed in the list returned.
Support only exists for returning the in-memory references to the children ... that is, no support exists for reading-in separately persisted children as part of this method.
java.util.List getDescendents()
No order of the descendants is implied or guaranteed in the list returned.
Support only exists for returning the in-memory references to the business models ... that is, no support exists for reading-in separately persisted business models as part of this method.
void removeChild(BusinessModel child)
Model.dispose()
method is the preferred way to
indicate that a child model and its descendants are no longer needed
and should be removed from memory.
When migrating to the dispose method,
BE SURE to call the .dispose() method on the model previously
used as the parameter for this method.
See the dispose method for details.
The removed child and any of its descendants are not usable after removing.
Model.dispose()
,
DataSelection.removeChildAndCollapse(LookThroughDataSelection)
java.util.List getResources(java.lang.Class c)
boolean isReadOnly()
void setReadOnly()
java.util.Locale getDataLocale()
java.util.Locale getComputationalLocale()
void setComputationalLocale(java.util.Locale locale)
Locale
- the locale used for computational comparisons.ServerProperties getServerProperties() throws MetadataException
MetadataException
- if the server properties could not be determined.StructureOfData getStructure()
DrillThroughToDetail newDrillThroughToDetail() throws MetadataException
The new object is not considered part of this business model until it is added via the addBusinessRule() method ... as such, this is only a factory method.
The new object is created with a default, program-generated ID (intra-model ID) that is unique within this business model. Applications should allow the ID to be user-managed if it is ever surfaced to the user (for example, when a report references a data item but the data item has been deleted in its map, the ID is then surfaced indicating it got deleted).
MetadataNotChangeableException
- if this BusinessModel is read-only
MetadataException
- if the operation could not be performedFilterCascadeRule newFilterCascadeRule() throws MetadataException
MetadataNotChangeableException
- if this BusinessModel is read-only
MetadataException
- if the operation could not be performedBusinessGroup newBusinessGroup(BusinessGroup.Type type) throws MetadataException
BusinessGroup.Type
. The group is not considered part of the pool of
business objects contained within this business model until it is added via the add method ... as such, this is only a factory method.
MetadataNotChangeableException
- if this BusinessModel is read-only
MetadataException
- if the operation could not be performedcom.sas.iquery.metadata.business.RootDataItem newDataItem() throws MetadataException
MetadataNotChangeableException
- if this BusinessModel is read-only
MetadataException
- if the operation could not be performedDataItemReference newDataItemReference(DataItem baseDataItem) throws MetadataException
MetadataNotChangeableException
- if this BusinessModel is read-only
MetadataException
- if the operation could not be performedFilterItem newFilterItem() throws MetadataException
MetadataNotChangeableException
- if this BusinessModel is read-only
MetadataException
- if the operation could not be performedCompoundFilter newCompoundFilter() throws MetadataException
MetadataNotChangeableException
- if this BusinessModel is read-only
MetadataException
- if the operation could not be performedPrompt newPrompt() throws MetadataException
MetadataNotChangeableException
- if this BusinessModel is read-only
MetadataException
- if the operation could not be performedvoid addBusinessItem(BusinessItem businessItem) throws MetadataException
All business items referenced directly or indirectly by the specified business item are not added to the business model as part of this operation.
Property change events signaled:
businessItem
- the BusinessItem object to add to this model.
MetadataNotChangeableException
- if this BusinessModel is read-only
MetadataException
- if the operation could not be performedvoid addBusinessItem(int index, BusinessItem businessItem) throws MetadataException
All business items referenced directly or indirectly by the specified business item are not added to the business model as part of this operation.
Property change events signaled:
index
- the index where to put the business itembusinessItem
- the BusinessItem object to add to this model.
MetadataNotChangeableException
- if this BusinessModel is read-only
MetadataException
- if the operation could not be performedjava.util.List removeBusinessItem(BusinessItem businessItem) throws MetadataException
It is not possible to remove a business item contained in a base business model via an extended business model.
Property change events signaled:
businessItem
- the BusinessItem object to remove from this model.
MetadataException
- when this operation could not be performed (for example, if the business item
is involved in a recursive definition you cannot remove it until the recursively-defined loop is broken).
MetadataNotChangeableException
- if this BusinessModel is read-onlygetObjectsBasedOn(BusinessModelObject, Class)
boolean contains(BusinessModelObject businessModelObject)
businessModelObject
- the object to test
boolean contains(boolean includeBaseModels, BusinessModelObject businessModelObject)
businessModelObject
- the object to test
void setBusinessItems(java.util.List<BusinessItem> businessItemsToSet) throws MetadataException
Property change events signaled:
businessItemsToSet
- a List of BusinessItem objects that must have been created by this business model.
If null is specified it is as if an empty list were given.
MetadataException
- if the operation could not be performed.
Some reasons for not performing the operation are:
MetadataNotChangeableException
- if this BusinessModel is read-onlyBusinessItem getBusinessItemByID(java.lang.String ID) throws MetadataException
ID
- the inter-model or intra-model ID of the business item.
MetadataException
- if multiple business items within this business model have the given ID
java.lang.IllegalArgumentException
- if a null id is specifiedboolean isIntraModelIDInUse(java.lang.String ID)
ID
- an intra-model ID whose usage is checked for with the objects contained within this business model
java.lang.IllegalArgumentException
- if the given ID is nullboolean isLegalID(java.lang.String ID)
ID
- an ID string.
INVALID_ID_CHARS
java.lang.String generateIntraModelID(java.lang.String proposedID)
Successive calls to this method may return different IDs.
proposedID
- an ID proposed to be used (on a DataSource, BusinessRule, or BusinessItem object)
within this business model
java.lang.IllegalArgumentException
- if the proposed ID is null<T> java.util.List<T> getObjects(int flags, java.lang.Class<T> type)
To include non-hidden business model objects but use only this business model
List objects = businessModel.getObjects(BusinessModel.GETOBJECTS_INCLUDE_HIDDEN, BusinessModelObject.class);To include base models and only get non-hidden objects
List objects = businessModel.getObjects(BusinessModel.GETOBJECTS_INCLUDE_BASE_MODELS, BusinessModelObject.class);To include base models and hidden business model objects
List objects = businessModel.getObjects(BusinessModel.GETOBJECTS_INCLUDE_BASE_MODELS | GETOBJECTS_INCLUDE_HIDDEN, BusinessModelObject.class);To use default behavior in the search (all business models, exclude hidden objects)
List objects = businessModel.getObjects(BusinessModel.GETOBJECTS_DEFAULT_SEARCH_CRITERIA, BusinessModelObject.class);
flags
- integer flagstype
- a class parameter for filtering the returned objects.
BusinessModelObject.class
will return all contained
business model objects. Use of null
in place of
BusinessModelObject.class
will be disallowed
after version 9.3.
GETOBJECTS_DEFAULT_SEARCH_CRITERIA
,
GETOBJECTS_INCLUDE_BASE_MODELS
,
GETOBJECTS_INCLUDE_HIDDEN
<T> java.util.List<T> getObjects(boolean includeBaseModels, @Nonnull java.lang.Class<T> type)
BusinessModelObject
objects contained
within this business model, and optionally within base business models,
of the specified type.
includeBaseModels
- true
if base models should be
searched; false
if base models should be ignoredtype
- a class parameter for filtering the returned objects.
BusinessModelObject.class
will return all contained
business model objects. Use of null
in place of
BusinessModelObject.class
will be disallowed
after version 9.3.
java.util.List getUnresolvedResources()
The reason for an unresolved resource may vary. Some possibilities include:
org.w3c.dom.Element write(org.w3c.dom.Element parentElement) throws MetadataException
This persistence method intends to capture all of the model as XML. This XML is not necessarily the same XML that would be written as when the model is stored in a metadata server (where certain objects may be created for persistence instead of being captured in this XML). Prompts are one such type of object that differ on how they are persisted depending on where they are written (plain XML or XML intended to be stored in a metadata server).
parentElement
- element under which a new element should be created
which holds this model's XML form.
MetadataException
- if the write fails
java.lang.NullPointerException
- if given a null element argumentjava.lang.String toXML(int spacesPerIndentation) throws MetadataException
spacesPerIndentation
- the number of space chars to use for each indented XML element
MetadataException
- when model is not persistableIntelligentQueryMetadataServiceInterface getMetadataService()
com.sas.services.session.SessionContextInterface getSession()
java.lang.String getFamilyStateDebugString()
java.util.List<BusinessGroup> getGroupsContaining(BusinessModelObject bmObject, BusinessGroup.Type type)
BusinessGroup.Type
and containing specified (@code BusinessModelObject}.
bmObject
- the (@code BusinessModelObject} contained within the groups returnedtype
- the BusinessGroup.Type
that will be returned
MapFolder getRootMapFolder() throws MetadataException
MetadataException
MapFolder getMapFolderContaining(BusinessItem item) throws MetadataException
MetadataException
java.util.List<BusinessItem> getBusinessItemsNotInMapFolders() throws MetadataException
MetadataException
|
Query |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |