wt.iba.definition.service
Class IBADefinitionDBService

java.lang.Object
  extended bywt.iba.definition.service.IBADefinitionDBService
All Implemented Interfaces:
Externalizable, Serializable

public class IBADefinitionDBService
extends Object
implements Externalizable

Database level serverside service used by the remote IBAService. Serverside use only.

Supported API: false

Extendable: false

See Also:
Serialized Form

Nested Class Summary
(package private) static class IBADefinitionDBService.CachedDefaultViewReset
           
static class IBADefinitionDBService.DefaultViewbyPathCache
           
 
Field Summary
private static boolean CACHE_VERBOSE
           
private static String CLASSNAME
           
static String COPY_ATTRIBUTE_DEFINITION_UNDER_DEF
           
static String COPY_ATTRIBUTE_DEFINITION_UNDER_ORG
           
static String COPY_ATTRIBUTE_ORGANIZER
           
private  CRC32 crc
           
static String CREATE_ATTRIBUTE_DEFINITION
           
static String CREATE_ATTRIBUTE_ORGANIZER
           
static String DELETE_ATTRIBUTE
           
static long EXTERNALIZATION_VERSION_UID
           
private  IBADefinitionCache ibaDefinitionCache
           
private static boolean IS_HIERARCHICAL_DEFINITION_ALLOWED
           
protected static long OLD_FORMAT_VERSION_UID
           
private static ArrayList providers
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
private  StandardIBADefinitionService service
           
private  UnitCache unitCache
           
static String UPDATE_ATTRIBUTE_DEFINITION
           
static String UPDATE_ATTRIBUTE_HIERARCHY
           
static String UPDATE_ATTRIBUTE_ORGANIZER
           
private static IBADefinitionDBService.DefaultViewbyPathCache viewCache
           
 
Constructor Summary
IBADefinitionDBService()
           
 
Method Summary
private  void addListenersToTransaction(Transaction trx, String name)
           
static void addTransactionListenerProvider(TransactionListenerProvider provider)
           
private  void checkUniqueRootAttributeDefinition(String sourceName, AttributeHierarchyChild org, boolean isCreate)
           
private  void clearIBADefinitionCache()
           
 AttributeHierarchyChild copyAttributeDefinition(AttributeDefNodeView sourceNode, AttributeDefNodeView targetParentNode)
          Copies the current Attribute Definition node and its children and attached them to the new parent node.
 AttributeHierarchyChild copyAttributeDefinition(AttributeDefNodeView sourceNode, AttributeOrgNodeView targetParentNode)
          Copies the current Attribute Definition node and its children and attached them to the new Attribute Organizer parent node.
 AttributeHierarchyChild copyAttributeOrganizer(AttributeOrgNodeView sourceNode, AttributeOrgNodeView targetParentNode)
          Copies the current Attribute Organizer node and its children and attached them to the new parent node.
 AttributeHierarchyChild createAttributeDefinition(AttributeDefDefaultView attributeDef)
          Creates the given attribute definition.
 AttributeHierarchyChild createAttributeOrganizer(AttributeOrgDefaultView attributeOrg)
          Creates the given attribute organizer.
 void deleteAttributeDefinition(AttributeDefDefaultView attributeDef)
          Deletes the given attribute definition.
 void deleteAttributeDefinition(AttributeDefNodeView node)
          Deletes the given attribute definitionr.
 void deleteAttributeOrganizer(AttributeOrgDefaultView attributeOrg)
          Deletes the given attribute organizer.
 void deleteAttributeOrganizer(AttributeOrgNodeView node)
          Deletes the given attribute organizer.
protected  void getAllAttributeChildren(AttributeHierarchyChild[] children, Vector target)
           
private  AttributeHierarchyChild[] getAttributeChildren(AbstractAttributeDefinizerDefaultView node)
           
 AttributeHierarchyChild[] getAttributeChildren(AbstractAttributeDefinizerNodeView node)
          Returns all the direct children of the given attribute node.
 AttributeHierarchyChild getAttributeDefDefaultView(AttributeDefNodeView attributeDef)
          Gets the attribute definition given the attribute node.
 AttributeHierarchyChild getAttributeDefDefaultViewByPath(String path)
          Gets the attribute definition given the attribute node.
 AttributeDefinition getAttributeDefinitionByObjectId(ObjectIdentifier oi)
           
 AttributeOrganizer[] getAttributeOrganizerRoots()
          Returns the root (first) level of all the Attribute Organizer.
 AttributeHierarchyChild getAttributeOrgDefaultView(AttributeOrgNodeView attributeOrg)
          Returns the lite attribute organizer given the node.
protected  AttributeHierarchyChild[] getHeavyAttributeChildren(AttributeHierarchyChild node)
           
private  MeasurementSystem getMeasurementSystem(String name)
           
private  StandardIBADefinitionService getStandardIBADefinitionService()
           
private  boolean hasValidLineage(ObjectIdentifier nodeID, Persistable parent)
           
private  boolean hasValidName(String sourceName, AttributeHierarchyChild[] siblings)
           
private  void initIBADefinitionCache()
           
protected  boolean isInUse(AbstractAttributeDefinition aad)
           
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(IBADefinitionDBService thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
protected  void recurseCopyAttribute(AttributeHierarchyChild parent, ObjectIdentifier targetParentID, AttributeHierarchyChild[] children)
           
protected  void recurseDeleteAttribute(AttributeHierarchyChild[] children)
           
protected  void recurseUpdateAttributeDefinition(AttributeHierarchyChild parent, AttributeHierarchyChild[] children)
           
 AttributeHierarchyChild refreshAttributeDefDefaultView(AttributeDefDefaultView attributeDef)
          Refreshes the given attribute definition by reloading its state from the DB.
 AttributeHierarchyChild refreshAttributeDefNodeView(AttributeDefNodeView attributeDefNode)
          Refreshes the given attribute definition by reloading its state from the DB.
 AttributeHierarchyChild refreshAttributeOrgDefaultView(AttributeOrgDefaultView attributeOrg)
          Refreshes the given attribute organize by reloading its state from the DB.
 AttributeHierarchyChild refreshAttributeOrgNodeView(AttributeOrgNodeView attributeOrgNode)
          Refreshes the given attribute organizer by reloading its state from the DB.
static void removeTransactionListenerProvider(TransactionListenerProvider provider)
           
 void setStarndardIBADefinitionService(StandardIBADefinitionService a_service)
           
 AttributeHierarchyChild updateAttributeDefinition(AttributeDefDefaultView node)
          Updates the current Attribute Definition by saving its state to the DB.
 AttributeHierarchyChild updateAttributeDefinition(AttributeDefNodeView node)
          Updates the current Attribute Definition by saving its state to the DB.
 AttributeHierarchyChild updateAttributeOrganizer(AttributeOrgDefaultView node)
          Updates the current Attribute Organizer by saving its state to the DB.
 AttributeHierarchyChild updateAttributeOrganizer(AttributeOrgNodeView node)
          Updates the current Attribute Organizer by saving its state to the DB.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

COPY_ATTRIBUTE_DEFINITION_UNDER_DEF

public static final String COPY_ATTRIBUTE_DEFINITION_UNDER_DEF
See Also:
Constant Field Values

COPY_ATTRIBUTE_DEFINITION_UNDER_ORG

public static final String COPY_ATTRIBUTE_DEFINITION_UNDER_ORG
See Also:
Constant Field Values

COPY_ATTRIBUTE_ORGANIZER

public static final String COPY_ATTRIBUTE_ORGANIZER
See Also:
Constant Field Values

CREATE_ATTRIBUTE_DEFINITION

public static final String CREATE_ATTRIBUTE_DEFINITION
See Also:
Constant Field Values

CREATE_ATTRIBUTE_ORGANIZER

public static final String CREATE_ATTRIBUTE_ORGANIZER
See Also:
Constant Field Values

UPDATE_ATTRIBUTE_HIERARCHY

public static final String UPDATE_ATTRIBUTE_HIERARCHY
See Also:
Constant Field Values

UPDATE_ATTRIBUTE_DEFINITION

public static final String UPDATE_ATTRIBUTE_DEFINITION
See Also:
Constant Field Values

UPDATE_ATTRIBUTE_ORGANIZER

public static final String UPDATE_ATTRIBUTE_ORGANIZER
See Also:
Constant Field Values

DELETE_ATTRIBUTE

public static final String DELETE_ATTRIBUTE
See Also:
Constant Field Values

crc

private CRC32 crc

viewCache

private static IBADefinitionDBService.DefaultViewbyPathCache viewCache

CACHE_VERBOSE

private static boolean CACHE_VERBOSE

IS_HIERARCHICAL_DEFINITION_ALLOWED

private static boolean IS_HIERARCHICAL_DEFINITION_ALLOWED

providers

private static ArrayList providers

ibaDefinitionCache

private IBADefinitionCache ibaDefinitionCache

unitCache

private UnitCache unitCache

service

private StandardIBADefinitionService service
Constructor Detail

IBADefinitionDBService

public IBADefinitionDBService()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(IBADefinitionDBService thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

copyAttributeDefinition

public AttributeHierarchyChild copyAttributeDefinition(AttributeDefNodeView sourceNode,
                                                       AttributeOrgNodeView targetParentNode)
                                                throws IBADefinitionException,
                                                       NotAuthorizedException,
                                                       WTException
Copies the current Attribute Definition node and its children and attached them to the new Attribute Organizer parent node. This operation actually involve creation of new instances of the nodes being copied.

Supported API: false

Parameters:
sourceNode -
targetParentNode -
Returns:
AttributeHierarchyChild
Throws:
IBADefinitionException
NotAuthorizedException
WTException

copyAttributeOrganizer

public AttributeHierarchyChild copyAttributeOrganizer(AttributeOrgNodeView sourceNode,
                                                      AttributeOrgNodeView targetParentNode)
                                               throws IBADefinitionException,
                                                      NotAuthorizedException,
                                                      WTException
Copies the current Attribute Organizer node and its children and attached them to the new parent node. This operation actually involve creation of new instances of the nodes being copied.

Supported API: false

Parameters:
sourceNode -
targetParentNode -
Returns:
AttributeHierarchyChild
Throws:
IBADefinitionException
NotAuthorizedException
WTException

copyAttributeDefinition

public AttributeHierarchyChild copyAttributeDefinition(AttributeDefNodeView sourceNode,
                                                       AttributeDefNodeView targetParentNode)
                                                throws IBADefinitionException,
                                                       NotAuthorizedException,
                                                       WTException
Copies the current Attribute Definition node and its children and attached them to the new parent node. On the serverside, this operation actually involve creation of new instances of the nodes being copied.

Supported API: false

Parameters:
sourceNode -
targetParentNode -
Returns:
AttributeHierarchyChild
Throws:
IBADefinitionException
NotAuthorizedException
WTException

createAttributeDefinition

public AttributeHierarchyChild createAttributeDefinition(AttributeDefDefaultView attributeDef)
                                                  throws IBADefinitionException,
                                                         NotAuthorizedException,
                                                         WTException
Creates the given attribute definition.

Supported API: false

Parameters:
attributeDef -
Returns:
AttributeHierarchyChild
Throws:
IBADefinitionException
NotAuthorizedException
WTException

createAttributeOrganizer

public AttributeHierarchyChild createAttributeOrganizer(AttributeOrgDefaultView attributeOrg)
                                                 throws IBADefinitionException,
                                                        NotAuthorizedException,
                                                        WTException
Creates the given attribute organizer.

Supported API: false

Parameters:
attributeOrg -
Returns:
AttributeHierarchyChild
Throws:
IBADefinitionException
NotAuthorizedException
WTException

deleteAttributeDefinition

public void deleteAttributeDefinition(AttributeDefDefaultView attributeDef)
                               throws IBADefinitionException,
                                      NotAuthorizedException,
                                      WTException
Deletes the given attribute definition.

Supported API: false

Parameters:
attributeDef -
Throws:
IBADefinitionException
NotAuthorizedException
WTException

deleteAttributeOrganizer

public void deleteAttributeOrganizer(AttributeOrgDefaultView attributeOrg)
                              throws IBADefinitionException,
                                     NotAuthorizedException,
                                     WTException
Deletes the given attribute organizer.

Supported API: false

Parameters:
attributeOrg -
Throws:
IBADefinitionException
NotAuthorizedException
WTException

deleteAttributeDefinition

public void deleteAttributeDefinition(AttributeDefNodeView node)
                               throws IBADefinitionException,
                                      NotAuthorizedException,
                                      WTException
Deletes the given attribute definitionr.

Supported API: false

Parameters:
node -
Throws:
IBADefinitionException
NotAuthorizedException
WTException

deleteAttributeOrganizer

public void deleteAttributeOrganizer(AttributeOrgNodeView node)
                              throws IBADefinitionException,
                                     NotAuthorizedException,
                                     WTException
Deletes the given attribute organizer.

Supported API: false

Parameters:
node -
Throws:
IBADefinitionException
NotAuthorizedException
WTException

getAttributeChildren

public AttributeHierarchyChild[] getAttributeChildren(AbstractAttributeDefinizerNodeView node)
                                               throws WTException
Returns all the direct children of the given attribute node.

Supported API: false

Parameters:
node -
Returns:
AttributeHierarchyChild[]
Throws:
WTException

getAttributeDefDefaultView

public AttributeHierarchyChild getAttributeDefDefaultView(AttributeDefNodeView attributeDef)
                                                   throws WTException
Gets the attribute definition given the attribute node.

Supported API: false

Parameters:
attributeDef -
Returns:
AttributeHierarchyChild
Throws:
WTException

getAttributeDefDefaultViewByPath

public AttributeHierarchyChild getAttributeDefDefaultViewByPath(String path)
                                                         throws WTException
Gets the attribute definition given the attribute node.

Supported API: false

Parameters:
path -
Returns:
AttributeHierarchyChild
Throws:
WTException

getAttributeOrganizerRoots

public AttributeOrganizer[] getAttributeOrganizerRoots()
                                                throws WTException
Returns the root (first) level of all the Attribute Organizer.

Supported API: false

Returns:
AttributeOrganizer[]
Throws:
WTException

getAttributeOrgDefaultView

public AttributeHierarchyChild getAttributeOrgDefaultView(AttributeOrgNodeView attributeOrg)
                                                   throws WTException
Returns the lite attribute organizer given the node.

Supported API: false

Parameters:
attributeOrg -
Returns:
AttributeHierarchyChild
Throws:
WTException

refreshAttributeOrgDefaultView

public AttributeHierarchyChild refreshAttributeOrgDefaultView(AttributeOrgDefaultView attributeOrg)
                                                       throws WTException
Refreshes the given attribute organize by reloading its state from the DB.

Supported API: false

Parameters:
attributeOrg -
Returns:
AttributeHierarchyChild
Throws:
WTException

refreshAttributeDefDefaultView

public AttributeHierarchyChild refreshAttributeDefDefaultView(AttributeDefDefaultView attributeDef)
                                                       throws WTException
Refreshes the given attribute definition by reloading its state from the DB.

Supported API: false

Parameters:
attributeDef -
Returns:
AttributeHierarchyChild
Throws:
WTException

refreshAttributeDefNodeView

public AttributeHierarchyChild refreshAttributeDefNodeView(AttributeDefNodeView attributeDefNode)
                                                    throws WTException
Refreshes the given attribute definition by reloading its state from the DB.

Supported API: false

Parameters:
attributeDefNode -
Returns:
AttributeHierarchyChild
Throws:
WTException

refreshAttributeOrgNodeView

public AttributeHierarchyChild refreshAttributeOrgNodeView(AttributeOrgNodeView attributeOrgNode)
                                                    throws WTException
Refreshes the given attribute organizer by reloading its state from the DB.

Supported API: false

Parameters:
attributeOrgNode -
Returns:
AttributeHierarchyChild
Throws:
WTException

updateAttributeDefinition

public AttributeHierarchyChild updateAttributeDefinition(AttributeDefDefaultView node)
                                                  throws IBADefinitionException,
                                                         NotAuthorizedException,
                                                         WTException
Updates the current Attribute Definition by saving its state to the DB.

Supported API: false

Parameters:
node -
Returns:
AttributeHierarchyChild
Throws:
IBADefinitionException
NotAuthorizedException
WTException

updateAttributeOrganizer

public AttributeHierarchyChild updateAttributeOrganizer(AttributeOrgDefaultView node)
                                                 throws IBADefinitionException,
                                                        NotAuthorizedException,
                                                        WTException
Updates the current Attribute Organizer by saving its state to the DB.

Supported API: false

Parameters:
node -
Returns:
AttributeHierarchyChild
Throws:
IBADefinitionException
NotAuthorizedException
WTException

updateAttributeOrganizer

public AttributeHierarchyChild updateAttributeOrganizer(AttributeOrgNodeView node)
                                                 throws IBADefinitionException,
                                                        NotAuthorizedException,
                                                        WTException
Updates the current Attribute Organizer by saving its state to the DB.

Supported API: false

Parameters:
node -
Returns:
AttributeHierarchyChild
Throws:
IBADefinitionException
NotAuthorizedException
WTException

updateAttributeDefinition

public AttributeHierarchyChild updateAttributeDefinition(AttributeDefNodeView node)
                                                  throws IBADefinitionException,
                                                         NotAuthorizedException,
                                                         WTException
Updates the current Attribute Definition by saving its state to the DB.

Supported API: false

Parameters:
node -
Returns:
AttributeHierarchyChild
Throws:
IBADefinitionException
NotAuthorizedException
WTException

addTransactionListenerProvider

public static void addTransactionListenerProvider(TransactionListenerProvider provider)

removeTransactionListenerProvider

public static void removeTransactionListenerProvider(TransactionListenerProvider provider)

addListenersToTransaction

private void addListenersToTransaction(Transaction trx,
                                       String name)

getHeavyAttributeChildren

protected AttributeHierarchyChild[] getHeavyAttributeChildren(AttributeHierarchyChild node)
                                                       throws IBAException,
                                                              WTException
Throws:
IBAException
WTException

recurseDeleteAttribute

protected void recurseDeleteAttribute(AttributeHierarchyChild[] children)
                               throws IBADefinitionException,
                                      IBAException,
                                      WTException
Throws:
IBADefinitionException
IBAException
WTException

recurseCopyAttribute

protected void recurseCopyAttribute(AttributeHierarchyChild parent,
                                    ObjectIdentifier targetParentID,
                                    AttributeHierarchyChild[] children)
                             throws IBAException,
                                    WTException
Throws:
IBAException
WTException

recurseUpdateAttributeDefinition

protected void recurseUpdateAttributeDefinition(AttributeHierarchyChild parent,
                                                AttributeHierarchyChild[] children)
                                         throws IBAException,
                                                WTException
Throws:
IBAException
WTException

getAllAttributeChildren

protected void getAllAttributeChildren(AttributeHierarchyChild[] children,
                                       Vector target)
                                throws IBAException,
                                       WTException
Throws:
IBAException
WTException

getAttributeChildren

private AttributeHierarchyChild[] getAttributeChildren(AbstractAttributeDefinizerDefaultView node)
                                                throws IBAException,
                                                       WTException
Throws:
IBAException
WTException

hasValidLineage

private boolean hasValidLineage(ObjectIdentifier nodeID,
                                Persistable parent)
                         throws WTException
Throws:
WTException

hasValidName

private boolean hasValidName(String sourceName,
                             AttributeHierarchyChild[] siblings)

checkUniqueRootAttributeDefinition

private void checkUniqueRootAttributeDefinition(String sourceName,
                                                AttributeHierarchyChild org,
                                                boolean isCreate)
                                         throws IBAException,
                                                IBADefinitionException,
                                                WTException
Throws:
IBAException
IBADefinitionException
WTException

getMeasurementSystem

private MeasurementSystem getMeasurementSystem(String name)
                                        throws WTException
Throws:
WTException

isInUse

protected boolean isInUse(AbstractAttributeDefinition aad)
                   throws WTException,
                          IBADefinitionException
Throws:
WTException
IBADefinitionException

setStarndardIBADefinitionService

public void setStarndardIBADefinitionService(StandardIBADefinitionService a_service)

clearIBADefinitionCache

private void clearIBADefinitionCache()

initIBADefinitionCache

private void initIBADefinitionCache()

getAttributeDefinitionByObjectId

public AttributeDefinition getAttributeDefinitionByObjectId(ObjectIdentifier oi)
                                                     throws WTException
Throws:
WTException

getStandardIBADefinitionService

private StandardIBADefinitionService getStandardIBADefinitionService()