com.apelon.modules.dts.editor.tql.beans
Class QualifiedObject

java.lang.Object
  extended by com.apelon.modules.dts.editor.tql.beans.QualifiedObject
All Implemented Interfaces:
java.lang.Comparable

public class QualifiedObject
extends java.lang.Object
implements java.lang.Comparable

Wrapper class for a general DTS object. Contains methods for converting between namespace-qualified names and DTS objects. Desired object types can specified by providing type codes. Type codes are bit-valued so they can be combined:

CONCEPT_ASSOCIATION | ROLE

Copyright (c) 2013 Apelon, Inc. All rights reserved.


Nested Class Summary
static class QualifiedObject.AttributeType
           
 
Field Summary
static int ALL
           
static int ASSOCIATION
           
static int AUTHORITY_PROPERTY
           
static int AUTHORITY_PROPERTY_QUALIFIER
           
static int BASE_ATTRIBUTE
           
static int CONCEPT
           
static int CONCEPT_ASSOCIATION
           
static int CONCEPT_ASSOCIATION_QUALIFIER
           
static int CONCEPT_PROPERTY
           
static int CONCEPT_PROPERTY_QUALIFIER
           
static java.lang.String DEFINING_PREFIX
           
static java.lang.String INVERSE_PREFIX
           
static int NAMESPACE_PROPERTY
           
static int NAMESPACE_PROPERTY_QUALIFIER
           
static int NAMESPACE_VERSION_PROPERTY
           
static int NAMESPACE_VERSION_PROPERTY_QUALIFIER
           
static int PROPERTY
           
static int QUALIFIER
           
static int ROLE
           
static int SUBSET_PROPERTY
           
static int SUBSET_PROPERTY_QUALIFIER
           
static int SUBSET_VERSION_PROPERTY
           
static int SUBSET_VERSION_PROPERTY_QUALIFIER
           
static int SYNONYM_ASSOCIATION
           
static int TERM
           
static int TERM_ASSOCIATION
           
static int TERM_ASSOCIATION_QUALIFIER
           
static int TERM_PROPERTY
           
static int TERM_PROPERTY_QUALIFIER
           
 
Constructor Summary
QualifiedObject(DTSObject obj)
          Create a QualifiedObject instance from a DTSObject.
QualifiedObject(DTSObject obj, boolean inv)
          Create a QualifiedObject instance from an inverse of a DTSObject.
QualifiedObject(java.lang.String name, int type)
          Create a QualifiedObject instance from a namespace-qualified name and attribute type code(s).
 
Method Summary
 int compareTo(java.lang.Object o)
          Implements Comparable for this class.
 boolean equals(java.lang.Object o)
          Return whether the object argument represents the same QualifiedObject as this object.
static int getCodeForTypeName(java.lang.String name)
          Return the QualifiedObject type code for a QualifiedObject.AttributeType type name.
 java.lang.String getName()
          Return the fully-qualified name of this object.
static java.lang.String getNameForObject(DTSObjectRef obj)
          Return the fully-qualified name for a DTSObjectRef.
 DTSObject getObject()
          Return the DTSObject represented by this object.
static DTSObject getObjectForName(java.lang.String objname, ConceptAttributeSetDescriptor casd)
          Return the DTSConcept represented by a namespace-qualified object name.
static DTSObject getObjectForName(java.lang.String objname, ConceptAttributeSetDescriptor casd, TermAttributeSetDescriptor tasd)
          Return the DTSConcept or Term represented by a namespace-qualified object name.
static DTSObject getObjectForName(java.lang.String objname, int types)
          Return the DTSObject represented by a namespace-qualified object name.
static DTSObject getObjectForName(java.lang.String objname, TermAttributeSetDescriptor tasd)
          Return the Term represented by a namespace-qualified object name.
 int hashCode()
          Return a hashcode on the fully-qualified name for this object.
 boolean isDefining()
          Return whether this object is a defining object.
 boolean isInverse()
          Return whether this object is an inverse object.
 void setDefining(boolean b)
          Set the value of the defining aspect of this object.
 void setInverse(boolean b)
          Set the value of the inverse aspect of this object.
 java.lang.String toString()
          Return a string representation of this QualifiedObject.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

INVERSE_PREFIX

public static final java.lang.String INVERSE_PREFIX
See Also:
Constant Field Values

DEFINING_PREFIX

public static final java.lang.String DEFINING_PREFIX
See Also:
Constant Field Values

CONCEPT

public static final int CONCEPT
See Also:
Constant Field Values

TERM

public static final int TERM
See Also:
Constant Field Values

CONCEPT_PROPERTY

public static final int CONCEPT_PROPERTY
See Also:
Constant Field Values

TERM_PROPERTY

public static final int TERM_PROPERTY
See Also:
Constant Field Values

NAMESPACE_PROPERTY

public static final int NAMESPACE_PROPERTY
See Also:
Constant Field Values

NAMESPACE_VERSION_PROPERTY

public static final int NAMESPACE_VERSION_PROPERTY
See Also:
Constant Field Values

SUBSET_PROPERTY

public static final int SUBSET_PROPERTY
See Also:
Constant Field Values

SUBSET_VERSION_PROPERTY

public static final int SUBSET_VERSION_PROPERTY
See Also:
Constant Field Values

AUTHORITY_PROPERTY

public static final int AUTHORITY_PROPERTY
See Also:
Constant Field Values

CONCEPT_ASSOCIATION

public static final int CONCEPT_ASSOCIATION
See Also:
Constant Field Values

TERM_ASSOCIATION

public static final int TERM_ASSOCIATION
See Also:
Constant Field Values

SYNONYM_ASSOCIATION

public static final int SYNONYM_ASSOCIATION
See Also:
Constant Field Values

ROLE

public static final int ROLE
See Also:
Constant Field Values

CONCEPT_PROPERTY_QUALIFIER

public static final int CONCEPT_PROPERTY_QUALIFIER
See Also:
Constant Field Values

CONCEPT_ASSOCIATION_QUALIFIER

public static final int CONCEPT_ASSOCIATION_QUALIFIER
See Also:
Constant Field Values

TERM_PROPERTY_QUALIFIER

public static final int TERM_PROPERTY_QUALIFIER
See Also:
Constant Field Values

TERM_ASSOCIATION_QUALIFIER

public static final int TERM_ASSOCIATION_QUALIFIER
See Also:
Constant Field Values

NAMESPACE_PROPERTY_QUALIFIER

public static final int NAMESPACE_PROPERTY_QUALIFIER
See Also:
Constant Field Values

NAMESPACE_VERSION_PROPERTY_QUALIFIER

public static final int NAMESPACE_VERSION_PROPERTY_QUALIFIER
See Also:
Constant Field Values

SUBSET_PROPERTY_QUALIFIER

public static final int SUBSET_PROPERTY_QUALIFIER
See Also:
Constant Field Values

SUBSET_VERSION_PROPERTY_QUALIFIER

public static final int SUBSET_VERSION_PROPERTY_QUALIFIER
See Also:
Constant Field Values

AUTHORITY_PROPERTY_QUALIFIER

public static final int AUTHORITY_PROPERTY_QUALIFIER
See Also:
Constant Field Values

ALL

public static final int ALL
See Also:
Constant Field Values

PROPERTY

public static final int PROPERTY
See Also:
Constant Field Values

ASSOCIATION

public static final int ASSOCIATION
See Also:
Constant Field Values

QUALIFIER

public static final int QUALIFIER
See Also:
Constant Field Values

BASE_ATTRIBUTE

public static final int BASE_ATTRIBUTE
See Also:
Constant Field Values
Constructor Detail

QualifiedObject

public QualifiedObject(DTSObject obj)
Create a QualifiedObject instance from a DTSObject.

Parameters:
obj - base DTSObject

QualifiedObject

public QualifiedObject(DTSObject obj,
                       boolean inv)
Create a QualifiedObject instance from an inverse of a DTSObject.

Parameters:
obj - base DTSObject
inv - whether the QualifiedObject should be the inverse of the object

QualifiedObject

public QualifiedObject(java.lang.String name,
                       int type)
Create a QualifiedObject instance from a namespace-qualified name and attribute type code(s).

Parameters:
name - the namespace-qualified object name (can begin with INVERSE_PREFIX or DEFINING_PREFIX)
type - the type code for the DTSObject. Can be bit-coded.
Method Detail

getObject

public DTSObject getObject()
Return the DTSObject represented by this object.

Returns:
the object's DTSObject

getName

public java.lang.String getName()
Return the fully-qualified name of this object.

Returns:
the object's fully-qualified name

setInverse

public void setInverse(boolean b)
Set the value of the inverse aspect of this object.

Parameters:
b - whether the object should be an inverse

isInverse

public boolean isInverse()
Return whether this object is an inverse object.

Returns:
whether the object is an inverse

setDefining

public void setDefining(boolean b)
Set the value of the defining aspect of this object.

Parameters:
b - whether the object should be defining

isDefining

public boolean isDefining()
Return whether this object is a defining object.

Returns:
whether the object is defining

toString

public java.lang.String toString()
Return a string representation of this QualifiedObject. Returns the fully-qualified name.

Overrides:
toString in class java.lang.Object
Returns:
the string representation

equals

public boolean equals(java.lang.Object o)
Return whether the object argument represents the same QualifiedObject as this object. Performs a comparison on fully-qualified name.

Overrides:
equals in class java.lang.Object
Returns:
whether the objects are the same

hashCode

public int hashCode()
Return a hashcode on the fully-qualified name for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode for this object

compareTo

public int compareTo(java.lang.Object o)
Implements Comparable for this class. Performs a namespace-first comparison on the fully-qualified name.

Specified by:
compareTo in interface java.lang.Comparable

getNameForObject

public static java.lang.String getNameForObject(DTSObjectRef obj)
Return the fully-qualified name for a DTSObjectRef.

Parameters:
obj - a DTSObjectRef
Returns:
the fully-qualified name

getObjectForName

public static DTSObject getObjectForName(java.lang.String objname,
                                         int types)
Return the DTSObject represented by a namespace-qualified object name. The object must be of a type(s) given in the argument.

Parameters:
objname - the name of the object
types - the allowed type code(s) for the object
Returns:
the named object

getObjectForName

public static DTSObject getObjectForName(java.lang.String objname,
                                         ConceptAttributeSetDescriptor casd)
Return the DTSConcept represented by a namespace-qualified object name. The DTSConcept will be populated with the attributes given in the ConceptAttributeSetDescriptor.

Parameters:
objname - the name of the DTSConcept
casd - the ConceptAttributeSetDescriptor to be used
Returns:
the named DTSConcept

getObjectForName

public static DTSObject getObjectForName(java.lang.String objname,
                                         TermAttributeSetDescriptor tasd)
Return the Term represented by a namespace-qualified object name. The Term will be populated with the attributes given in the TermAttributeSetDescriptor.

Parameters:
objname - the name of the Term
tasd - the TermAttributeSetDescriptor to be used
Returns:
the named Term

getObjectForName

public static DTSObject getObjectForName(java.lang.String objname,
                                         ConceptAttributeSetDescriptor casd,
                                         TermAttributeSetDescriptor tasd)
Return the DTSConcept or Term represented by a namespace-qualified object name. The return object will be populated with the attributes given in the ConceptAttributeSetDescriptor or TermAttributeSetDescriptor as appropriate.

Parameters:
objname - the name of the DTSConcept or Term
casd - the ConceptAttributeSetDescriptor to be used
tasd - the TermAttributeSetDescriptor to be used
Returns:
the named DTSConcept or Term

getCodeForTypeName

public static int getCodeForTypeName(java.lang.String name)
Return the QualifiedObject type code for a QualifiedObject.AttributeType type name.

Parameters:
name - the name of the attribute
Returns:
the type code