***  This interface is subject to change.  ***

com.sas.iquery.metadata.business
Interface BusinessModel

All Superinterfaces:
Base, BusinessModelResource, BusinessModelResourceReferencer, java.util.EventListener, Model, NamedObjectInterface, PropertyChangeListenee, java.beans.PropertyChangeListener, UsabilityInterface
All Known Subinterfaces:
DataSelection, InformationMap

public interface BusinessModel
extends Model, BusinessModelResource, BusinessModelResourceReferencer

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:

See the individual business item classes for details on those particular 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.
<T> java.util.List<T>
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.
<T> java.util.List<T>
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

EVENT_DATA_SOURCES_CHANGED

static final java.lang.String EVENT_DATA_SOURCES_CHANGED
The event indicating that the list of data sources contained in this object has changed.

See Also:
Constant Field Values

EVENT_BUSINESS_RULES_CHANGED

static final java.lang.String EVENT_BUSINESS_RULES_CHANGED
The event indicating that the list of business rules contained in this object has changed.

See Also:
Constant Field Values

EVENT_BUSINESS_ITEMS_CHANGED

static final java.lang.String EVENT_BUSINESS_ITEMS_CHANGED
The event indicating that the list of business items contained in this object has changed.

See Also:
Constant Field Values

EVENT_CHILD_ADDED

static final java.lang.String EVENT_CHILD_ADDED
This event indicates that a child data selection was added to this data selection

See Also:
Constant Field Values

EVENT_CHILD_REMOVED

static final java.lang.String EVENT_CHILD_REMOVED
This event indicates that a child data selection was added to this data selection

See Also:
Constant Field Values

INVALID_ID_CHARS

static final char[] INVALID_ID_CHARS
List of Characters NOT allowed in an id.


GETOBJECTS_INCLUDE_BASE_MODELS

static final int GETOBJECTS_INCLUDE_BASE_MODELS
To include base models in the search

See Also:
Constant Field Values

GETOBJECTS_INCLUDE_HIDDEN

static final int GETOBJECTS_INCLUDE_HIDDEN
To include hidden objects in the search

See Also:
Constant Field Values

GETOBJECTS_DEFAULT_SEARCH_CRITERIA

static final int GETOBJECTS_DEFAULT_SEARCH_CRITERIA
Use only the current model in the search and exclude hidden objects

See Also:
Constant Field Values

SEARCH_NONRECURSIVELY

static final 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.

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.
     

See Also:
Constant Field Values

SEARCH_THRU_SUBFILTERS

static final 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.

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.
     

See Also:
Constant Field Values

SEARCH_THRU_SUBDATAITEMS

static final 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. So for example, if one is interested in what data items are being used by an expression, one can use this flag and it will recursively look through the expression and through data items within the expression to see what data items are being used.

See Also:
Constant Field Values

SEARCH_THRU_PROMPTS

static final 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. For example, if one is interested in data items being used by a filter containing dynamic prompt, one can use this flag and it will recursively look through the filter expression and through prompts within the expression to see what data items are being used.

See Also:
Constant Field Values

SEARCH_THRU_ALL

static final 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.

See Also:
Constant Field Values
Method Detail

isValidLabel

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

Parameters:
label - the string to use as the label.
Returns:
true if this is a valid label false otherwise

getBaseModel

BusinessModel getBaseModel()
This returns the same as getParentBusinessModel()


getParentBusinessModel

BusinessModel getParentBusinessModel()
Returns the business model that this business model is directly based on, if any. BusinessItems contained in this model can reference business items and data source objects from their base model or any previous parent model in the ancestoral chain of business models. Each business model can only have at most one parent business model.

It is not possible to set or change the base model for a business model after the business model has been created.

Returns:
this object's parent BusinessModel object or null if this business model is not based on another.

getChildren

java.util.List getChildren()
Returns a list of BusinessModel objects directly based upon this business model.

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.

Returns:
a List of BusinessModel objects that are based upon this model and are in memory.

getDescendents

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).

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.

Returns:
a List of BusinessModel objects

removeChild

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.

Removes a child business model from the list of children of this business model.

The removed child and any of its descendants are not usable after removing.

See Also:
Model.dispose(), DataSelection.removeChildAndCollapse(LookThroughDataSelection)

getResources

java.util.List getResources(java.lang.Class c)
Returns the resources of the specified class used by this business model.

Returns:
a List of BusinessModelResource objects externally defined to this business model that it refers to (uses as a resource).

isReadOnly

boolean isReadOnly()
Returns whether this object is read-only. If this object is read-only, calling setter methods or any other methods that result in changes to this object results in a MetadataNotChangeableException. This object can be read-only when it is read in from storage when it is required as part of a chain of business models. For example, when BusinessModelB (for example, a report) is read in but it requires BusinessModelA as its base model, BusinessModelA must be read in first ... and when BusinessModelA is read-in because of a chained-read it is marked read-only.

Returns:
true if this object is read-only, false otherwise

setReadOnly

void setReadOnly()
Marks this business model and any objects it manages (contains) as read-only. This attribute is not persisted with the business model and is only valid while the object is in memory.


getDataLocale

java.util.Locale getDataLocale()
Deprecated. getDataLocale has been deprecated please use getComputationalLocale

Returns the locale used by all business items associated with this business model. If null is returned this model is not persistable.

Returns:
Locale associated with this model. Otherwise null.

getComputationalLocale

java.util.Locale getComputationalLocale()
Returns the locale that is used to define such data comparison actions as "less than or equal to Red". If null is returned this model is not persistable.

Returns:
Locale associated with this model. Otherwise null.

setComputationalLocale

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". NOTE: Modifying the computational locale can invalidate filters used by model. Great care should be taken when changing this locale.

Parameters:
Locale - the locale used for computational comparisons.

getServerProperties

ServerProperties getServerProperties()
                                     throws MetadataException
Returns the ServerProperties object usable in defining business items contained within this model. Server properties are usually determined by the data sources that are in a business model and the server properties file provided by an IntelligentQueryServiceInterface the business model was created with.

Returns:
the server properties useful in defining business items or null if no properties are defined for this business model.
Throws:
MetadataException - if the server properties could not be determined.

getStructure

StructureOfData getStructure()
Returns an indication as to the type or structure of the data being referenced by the busing model. The returned object gives information like whether the input data is OLAP, relational, both, etc.

Returns:
an StructureOfData object describing the type of data *referenced* by the business model.

newDrillThroughToDetail

DrillThroughToDetail newDrillThroughToDetail()
                                             throws MetadataException
Factory method for creating a DrillThroughToDetail business rule. This type of business rule allows for specifying whether a user is allowed to drill through to detail data.

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).

Returns:
a DrillThroughToDetail object
Throws:
MetadataNotChangeableException - if this BusinessModel is read-only
MetadataException - if the operation could not be performed

newFilterCascadeRule

FilterCascadeRule newFilterCascadeRule()
                                       throws MetadataException
Creates a FilterCascadeRule object and returns it. The filter cascade is not considered part of the pool of business rules contained within this business model until it is added via the addBusinessRule(BusinessRule) method ... as such, this is only a factory method.

Returns:
the new FilterCascadeRule object
Throws:
MetadataNotChangeableException - if this BusinessModel is read-only
MetadataException - if the operation could not be performed

newBusinessGroup

BusinessGroup newBusinessGroup(BusinessGroup.Type type)
                               throws MetadataException
Creates a BusinessGroup object with the specified 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.

Returns:
the new BusinessGroup object
Throws:
MetadataNotChangeableException - if this BusinessModel is read-only
MetadataException - if the operation could not be performed

newDataItem

com.sas.iquery.metadata.business.RootDataItem newDataItem()
                                                          throws MetadataException
Creates a DataItem object and returns it. The data item is not considered part of the pool of business items contained within this business model until it is added via the add(BusinessItem) method ... as such, this is only a factory method. Meaningful defaults as described in the DataItem class are set on the new item.

Returns:
the new DataItem object
Throws:
MetadataNotChangeableException - if this BusinessModel is read-only
MetadataException - if the operation could not be performed

newDataItemReference

DataItemReference newDataItemReference(DataItem baseDataItem)
                                       throws MetadataException
Creates a new DataItemReference object and returns it. The data item is not considered part of the pool of business items contained within this business model until it is added via the add(BusinessItem) method ... as such, this is only a factory method. Meaningful defaults as described in the DataItemReference class are set on the new item.

Returns:
the new DataItemReference object
Throws:
MetadataNotChangeableException - if this BusinessModel is read-only
MetadataException - if the operation could not be performed

newFilterItem

FilterItem newFilterItem()
                         throws MetadataException
Creates a FilterItem object and returns it. The filter is not considered part of the pool of business items contained within this business model until it is added via the add(BusinessItem) method ... as such, this is only a factory method. Meaningful defaults as described in the FilterItem class are set on the new item.

Returns:
the new FilterItem object
Throws:
MetadataNotChangeableException - if this BusinessModel is read-only
MetadataException - if the operation could not be performed

newCompoundFilter

CompoundFilter newCompoundFilter()
                                 throws MetadataException
Creates a CompoundFilter object and returns it. The filter is not considered part to the pool of business items contained within this business model until it is added via the add(BusinessItem) method ... as such, this is only a factory method. Meaningful defaults as described in the CompoundFilter class are set on the new item.

Returns:
the new CompoundFilter object
Throws:
MetadataNotChangeableException - if this BusinessModel is read-only
MetadataException - if the operation could not be performed

newPrompt

Prompt newPrompt()
                 throws MetadataException
Creates a prompt and returns it. The prompt is not considered part to the pool of business items contained within this business model until it is added via the add(BusinessItem) method ... as such, this is only a factory method. Meaningful defaults as described in the Prompt class are set on the new item.

Returns:
the new prompt
Throws:
MetadataNotChangeableException - if this BusinessModel is read-only
MetadataException - if the operation could not be performed

addBusinessItem

void addBusinessItem(BusinessItem businessItem)
                     throws MetadataException
Adds the specified BusinessItem to this business model. If the business item is already in this business model no action is taken. An exception is thrown if the specified business item was not created by this business model.

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:

Parameters:
businessItem - the BusinessItem object to add to this model.
Throws:
MetadataNotChangeableException - if this BusinessModel is read-only
MetadataException - if the operation could not be performed

addBusinessItem

void addBusinessItem(int index,
                     BusinessItem businessItem)
                     throws MetadataException
Adds a business item at the specified index in the list of business items within this business model. All business items in the list at that index or after are moved to the right by 1 position. If the given business item is already in the list of business items within this business model, it is removed from its present position and inserted at the given position. An exception is thrown if the specified business item was not created by this business model.

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:

Parameters:
index - the index where to put the business item
businessItem - the BusinessItem object to add to this model.
Throws:
MetadataNotChangeableException - if this BusinessModel is read-only
MetadataException - if the operation could not be performed

removeBusinessItem

java.util.List removeBusinessItem(BusinessItem businessItem)
                                  throws MetadataException
Removes the specified BusinessItem object and any BusinessItem objects dependent on the given object from this business model. One can use the getObjectsBasedOn(BusinessModelObject, Class) method to pre-determine what business items are dependent on the specified business item prior to removing it. This methods just returns if the given BusinessItem is not in this business model.

It is not possible to remove a business item contained in a base business model via an extended business model.

Property change events signaled:

Parameters:
businessItem - the BusinessItem object to remove from this model.
Returns:
a list of business items (other than the specified business item) removed as part of this operation.
Throws:
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-only
See Also:
getObjectsBasedOn(BusinessModelObject, Class)

contains

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. If it is not contained within one of those lists, the object is not persistable or usable in business queries.

Parameters:
businessModelObject - the object to test
Returns:
a boolean indication of whether the given object is contained within one of the lists managed by this business model.

contains

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. If it is not contained within one of those lists, the object is not persistable or usable in business queries.

Parameters:
businessModelObject - the object to test
Returns:
a boolean indication of whether the given object is contained within one of the lists managed by this business model.

setBusinessItems

void setBusinessItems(java.util.List<BusinessItem> businessItemsToSet)
                      throws MetadataException
Sets the list of business items contained within this business model. This essentially removes all business items from this model and adds the specified list of items. All specified business items must have been created by this business model or an exception is thrown.

Property change events signaled:

Parameters:
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.
Throws:
MetadataException - if the operation could not be performed. Some reasons for not performing the operation are:
  • A business item was given that was not created by this business model
  • An object not extending the BusinessItem interface was given in the list
MetadataNotChangeableException - if this BusinessModel is read-only

getBusinessItemByID

BusinessItem getBusinessItemByID(java.lang.String ID)
                                 throws MetadataException
Returns the business item with the specified ID. The ID may be either an inter-model ID or an intra-model ID. If the ID specified is an intra-model ID this business model is checked for the object with the specified ID. If the ID specified is an inter-model ID the chain of business models is inspected for the object with the specified ID. One can tell whether the id is an inter-model ID or not depending on whether it contains the INTERMODEL_ID_DELIMITER character.

Parameters:
ID - the inter-model or intra-model ID of the business item.
Returns:
a business item with the specified ID or null if no business item with the specified ID exists
Throws:
MetadataException - if multiple business items within this business model have the given ID
java.lang.IllegalArgumentException - if a null id is specified

isIntraModelIDInUse

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.

Parameters:
ID - an intra-model ID whose usage is checked for with the objects contained within this business model
Returns:
a boolean indication of whether the given ID is used by any object (business item, data source or business rule) contained within this business model
Throws:
java.lang.IllegalArgumentException - if the given ID is null

isLegalID

boolean isLegalID(java.lang.String ID)
Returns an indication of whether the given ID has a legal format. Both BusinessModel IDs and intra-model IDs set on BusinessModelObjects have the same format restrictions.

Parameters:
ID - an ID string.
Returns:
a boolean indication of whether the given ID has a legal format.
See Also:
INVALID_ID_CHARS

generateIntraModelID

java.lang.String generateIntraModelID(java.lang.String proposedID)
Returns a suggested ID to use within this business model based on the specified proposed ID. The ID returned is guaranteed to be a unique intra-model ID within this business model at the time this method returns. This method returns the proposedID if it is unique within this business model. It returns a new ID made up of the proposedID with an appended suffix making it unique if the proposed ID is not already unique within this business model.

Successive calls to this method may return different IDs.

Parameters:
proposedID - an ID proposed to be used (on a DataSource, BusinessRule, or BusinessItem object) within this business model
Returns:
the suggested ID
Throws:
java.lang.IllegalArgumentException - if the proposed ID is null

getObjects

<T> java.util.List<T> getObjects(int flags,
                                 java.lang.Class<T> type)
Returns the list of BusinessModelObject objects of a specific type using the provided search definition flags. Examples:

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);
 

Parameters:
flags - integer flags
type - 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.
Returns:
a list of BusinessModelObject objects that are instances of the specified class. The list may be empty, but never null.
See Also:
GETOBJECTS_DEFAULT_SEARCH_CRITERIA, GETOBJECTS_INCLUDE_BASE_MODELS, GETOBJECTS_INCLUDE_HIDDEN

getObjects

<T> java.util.List<T> getObjects(boolean includeBaseModels,
                                 @Nonnull
                                 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.

Parameters:
includeBaseModels - true if base models should be searched; false if base models should be ignored
type - 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.
Returns:
a list of BusinessModelObject objects that are instances of the specified class. Note: Hidden objects of the specified type will also be returned.

getUnresolvedResources

java.util.List getUnresolvedResources()
Returns a list of unresolved resources that are referenced by objects in this business model. Unresolved resources from any base models are not returned. Unresolved resources cause business items, business rules, and data sources defined using those resources to be unusable in queries.

The reason for an unresolved resource may vary. Some possibilities include:

Returns:
a list of BusinessModelObject and PhysicalResource types referenced by (not contained within) this business model that are unresolved (return isUnresolved()=true).

write

org.w3c.dom.Element write(org.w3c.dom.Element parentElement)
                          throws MetadataException
Serializes this model as a sub-element to the given DOM element and returns the subelement representing this model.

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).

Parameters:
parentElement - element under which a new element should be created which holds this model's XML form.
Returns:
the subelement representing this model
Throws:
MetadataException - if the write fails
java.lang.NullPointerException - if given a null element argument

toXML

java.lang.String toXML(int spacesPerIndentation)
                       throws MetadataException
Returns the XML persistence form for this business model.

Parameters:
spacesPerIndentation - the number of space chars to use for each indented XML element
Returns:
the XML persistence form for this business model.
Throws:
MetadataException - when model is not persistable

getMetadataService

IntelligentQueryMetadataServiceInterface getMetadataService()
Returns the metadata service associated with this model. The service, among other things, provides the server properties usable in defining the set of allowed functions & operators used by the business items.

Returns:
the metadata service used on this business model

getSession

com.sas.services.session.SessionContextInterface getSession()
Returns the session this model was created for use in

Returns:
the session this model was created for use in

getFamilyStateDebugString

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. None of the string is guaranteed to be NLS-enabled.

Returns:
a String object representative of the contents of the family of business models that this business model is related to

getGroupsContaining

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}.

Parameters:
bmObject - the (@code BusinessModelObject} contained within the groups returned
type - the BusinessGroup.Type that will be returned
Returns:
a (@ List} of (@code BusinessGroup} objects or empty.

getRootMapFolder

MapFolder getRootMapFolder()
                           throws MetadataException
Returns the root folder of the user-organized business items within this model.

Returns:
the root folder of the user-organized business items (never null)
Throws:
MetadataException

getMapFolderContaining

MapFolder getMapFolderContaining(BusinessItem item)
                                 throws MetadataException
Returns the folder off of the root business model folder that contains the specified business item

Returns:
the folder off of the root folder that contains the specified business item or null if the business item is not contained in a business model folder.
Throws:
MetadataException

getBusinessItemsNotInMapFolders

java.util.List<BusinessItem> getBusinessItemsNotInMapFolders()
                                                             throws MetadataException
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.

Returns:
a list of BusinessItem objects (may be empty)
Throws:
MetadataException

***  This interface is subject to change.  ***




Copyright © 2009 SAS Institute Inc. All Rights Reserved.