Package com.appiancorp.suiteapi.common
Class LocalObject
java.lang.Object
com.appiancorp.suiteapi.common.LocalObject
- All Implemented Interfaces:
com.appiancorp.core.expr.portable.PortableLocalObject
,DeepCloneable
,LocalId
,LocalStringId
,Serializable
,Cloneable
,Comparable<LocalObject>
- Direct Known Subclasses:
Contribution
public class LocalObject
extends Object
implements LocalId, LocalStringId, Serializable, DeepCloneable, Comparable<LocalObject>, com.appiancorp.core.expr.portable.PortableLocalObject
This class represents the base class for all first-class Appian Objects. It
is used to represent objects with both Long and String ID's. At all times
either the Long ID or the String ID is valid. LocalObject cannot have valid
Id and StringId at the same time.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructor that constructs an empty local object.LocalObject
(LocalId o_) Constructor that constructs from a givenLocalId
object.Constructor that constructs from a givenLocalStringId
object.LocalObject
(Integer type_, Long id_) Constructor that constructs from a given type and id.LocalObject
(Integer type_, String id_) Constructor that constructs from a type and String id. -
Method Summary
Modifier and TypeMethodDescriptionstatic LocalObject[]
buildUserContext
(String userId) Builds the user context for a report.clone()
Creates and returns a copy of this object.int
Compares the specifiedLocalObject
with thisLocalObject
for ordering.boolean
Returns whether theLocalObject
been passed is equal to thisLocalObject
.getId()
Returns the ID of thisLocalObject
.static LocalObjectTypeMapping
Get the mapping object used to determine a first-class object's type.Returns the String Id of thisLocalObject
.getType()
Gets the type of thisLocalObject
.int
hashCode()
Returns a hash code value for the object.boolean
isNull()
A LocalObject may be null by containing a null type, or null object within the type.void
Sets the ID of thisLocalObject
.static void
Set the mapper used to determine an first-class object's type.void
setStringId
(String stringId_) Sets the String ID of thisLocalObject
.void
Set the type of thisLocalObject
.toString()
Returns a string representation of theLocalObject
.In general, the toString method returns a string that "textually represents" this object.
-
Field Details
-
LOG
protected static final org.apache.log4j.Logger LOG
-
-
Constructor Details
-
LocalObject
public LocalObject()Constructor that constructs an empty local object. -
LocalObject
Constructor that constructs from a givenLocalId
object.- Parameters:
o_
- LocalId to construct the object from
-
LocalObject
Constructor that constructs from a givenLocalStringId
object.- Parameters:
o_
- LocalStringId to construct the object from
-
LocalObject
Constructor that constructs from a given type and id.- Parameters:
type_
- Use a constant from anObjectTypeMapping
.id_
- ID of type Long for object to constructor
-
LocalObject
Constructor that constructs from a type and String id.- Parameters:
type_
- Use a constant from anObjectTypeMapping
.id_
- String ID of the object to construct
-
-
Method Details
-
getId
Returns the ID of thisLocalObject
. -
setId
Sets the ID of thisLocalObject
. -
getType
Gets the type of thisLocalObject
. Should return a constant fromObjectTypeMapping
.- Specified by:
getType
in interfacecom.appiancorp.core.expr.portable.PortableLocalObject
- Returns:
- Type of this object
- See Also:
-
setType
Set the type of thisLocalObject
. Use a constant fromObjectTypeMapping
.- Parameters:
p_
- Type of this object to set- See Also:
-
getObjectTypeMapping
Get the mapping object used to determine a first-class object's type.- Returns:
- Mapping class for determining object's type
- See Also:
-
setObjectTypeMapping
Set the mapper used to determine an first-class object's type.- Parameters:
p_
- Sets the mapping class used to determine object's type- See Also:
-
getStringId
Returns the String Id of thisLocalObject
.- Specified by:
getStringId
in interfaceLocalStringId
- Specified by:
getStringId
in interfacecom.appiancorp.core.expr.portable.PortableLocalObject
- Returns:
- Returns the string Id.
- See Also:
-
setStringId
Sets the String ID of thisLocalObject
.- Specified by:
setStringId
in interfaceLocalStringId
- Parameters:
stringId_
- The string Id to set.- See Also:
-
equals
Returns whether theLocalObject
been passed is equal to thisLocalObject
. -
hashCode
public int hashCode()Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided byHashtable
. -
toString
Returns a string representation of theLocalObject
.In general, the toString method returns a string that "textually represents" this object. -
isNull
public boolean isNull()A LocalObject may be null by containing a null type, or null object within the type.- Returns:
- true if type or id/stringId is null
-
clone
Creates and returns a copy of this object.- Specified by:
clone
in interfaceDeepCloneable
- Overrides:
clone
in classObject
- Returns:
-
compareTo
Compares the specifiedLocalObject
with thisLocalObject
for ordering. Compares bothtypes
and then bothids
orstringIds
according to thetypes
.- Specified by:
compareTo
in interfaceComparable<LocalObject>
- Parameters:
o
- theLocalObject
to be compared.- Returns:
- the value
0
if the argument LocalObject is equal to this LocalObject; a value less than0
if this LocalObject is before the LocalObject argument; and a value greater than0
if this LocalObject is after the LocalObject argument.
-
buildUserContext
Builds the user context for a report.- Parameters:
userId
- the user ID; cannot be null- Returns:
- the user context for a report
-