public final class CloudObject extends Object implements Externalizable
Modifier and Type | Field and Description |
---|---|
static int |
ACCESS_APPLICATION
An application visible/modifiable object!
|
static int |
ACCESS_APPLICATION_READ_ONLY
An application scope readable object! Can only be modified by its creator
|
static int |
ACCESS_PRIVATE
An object that can only be viewed or modified by its creator
|
static int |
ACCESS_PUBLIC
A world visible/modifiable object!
|
static int |
ACCESS_PUBLIC_READ_ONLY
A world visible object! Can only be modified by its creator.
|
static int |
BINDING_AUTO_SAVE
Changes to the bound property will be reflected instantly into the cloud object and the object would
be saved immediately (not committed!).
|
static int |
BINDING_DEFERRED
Changes to the bound property won't be reflected into the bound cloud object until commit binding is invoked
|
static int |
BINDING_IMMEDIATE
Changes to the bound property will be reflected instantly into the cloud object
|
static int |
STATUS_COMMIT_IN_PROGRESS
Indicates the state of the current object, an object in the process of committing
|
static int |
STATUS_COMMITTED
Indicates the state of the current object, an object that is in sync with the database as far as
the client code is aware (the client code doesn't check!)
|
static int |
STATUS_DELETE_IN_PROGRESS
Indicates the state of the current object, an object that is in the process of deletion
|
static int |
STATUS_DELETED
Indicates the state of the current object, a deleted object
|
static int |
STATUS_MODIFIED
Indicates the state of the current object, a locally modified object that wasn't committed yet
|
static int |
STATUS_NEW
Indicates the state of the current object, a new object never persisted
|
static int |
STATUS_REFRESH_IN_PROGRESS
Indicates the state of the current object, an object in the process of refresh
|
Constructor and Description |
---|
CloudObject()
Default constructor for externalization purposes only!
|
CloudObject(String type)
Constructor
|
CloudObject(String type,
int permissions)
Create an object with different permissions settings
|
Modifier and Type | Method and Description |
---|---|
void |
bindProperty(Component cmp,
String propertyName,
String attributeName,
int defer,
boolean objectLead)
Binds a property value within the given component to this cloud object, this means that
when the component changes the cloud object changes unless deferred.
|
void |
bindTree(Container ui,
int defer,
boolean objectLead)
Binds a UI tree to the cloud object so its values automatically update in the cloud object
|
void |
cancelBinding()
If deferred changes exist this method discards such values
|
void |
commitBinding()
If deferred changes exist this method applies these changes to the data
|
boolean |
equals(Object o)
Indicates whether some other object is "equal to" this one.
|
void |
externalize(DataOutputStream out)
Allows us to store an object state, this method must be implemented
in order to save the state of an object
|
int |
getAccessPermissions()
The access permissions for an object can only be changed for an object in which
the current user is the owner
|
Boolean |
getBoolean(String key)
Returns the value for the given key
|
String |
getCloudId()
The object id is a unique key that allows you to find an object that was persisted in the
store (a primary key).
|
Double |
getDouble(String key)
Returns the value for the given key
|
Float |
getFloat(String key)
Returns the value for the given key
|
Double |
getIndexDouble(int index)
Returns the index value for the given index number
|
Long |
getIndexLong(int index)
Returns the index value for the given index number
|
String |
getIndexString(int index)
Returns the index value for the given index number
|
Integer |
getInteger(String key)
Returns the value for the given key
|
long |
getLastModified()
Indicates the last modification date for the object
|
Long |
getLong(String key)
Returns the value for the given key
|
Object |
getObject(String key)
Allows us to extract an object from the cloud object without knowing its type in advance
or whether it exists
|
String |
getObjectId()
The object id must be unique, it is used to identify the object when loaded
even when it is obfuscated.
|
int |
getStatus()
Returns one of the status constants in this class
|
String |
getString(String key)
Returns the value for the given key
|
String |
getType()
Returns the type of the object
|
int |
getVersion()
Returns the version for the current persistance code, the version will be
pased to internalized thus allowing the internalize method to recognize
classes persisted in older revisions
|
int |
hashCode()
Returns a hash code value for the object.
|
void |
internalize(int version,
DataInputStream in)
Loads the object from the input stream and allows deserialization
|
boolean |
isOwner()
Returns true if this object is owned by me or is world writeable
|
void |
remove(String key)
Delete an entry within the object
|
void |
setBoolean(String key,
boolean value)
Sets a value
|
void |
setBoolean(String key,
Boolean value)
Sets a value
|
static void |
setCustomProperty(String key,
CustomProperty cp)
Install a custom property on the given property name
|
void |
setDouble(String key,
double value)
Sets a value
|
void |
setDouble(String key,
Double value)
Sets a value
|
void |
setFloat(String key,
float value)
Sets a value
|
void |
setFloat(String key,
Float value)
Sets a value
|
void |
setIndexDouble(int index,
double value)
Only indexed values can be queried and sorted
|
void |
setIndexLong(int index,
long value)
Only indexed values can be queried and sorted
|
void |
setIndexString(int index,
String value)
Only indexed values can be queried and sorted
|
void |
setInteger(String key,
int value)
Sets a value
|
void |
setInteger(String key,
Integer value)
Sets a value
|
void |
setLong(String key,
long value)
Sets a value
|
void |
setLong(String key,
Long value)
Sets a value
|
void |
setString(String key,
String value)
Sets a value that can be no more than 512 characters
|
void |
setType(String type)
Set the type of the object
|
void |
unbindProperty(Component cmp,
String propertyName)
Releases the binding for the specific property name
|
void |
unbindTree(Container ui)
Clears the binding to this component tree
|
public static final int STATUS_NEW
public static final int STATUS_COMMITTED
public static final int STATUS_MODIFIED
public static final int STATUS_COMMIT_IN_PROGRESS
public static final int STATUS_DELETE_IN_PROGRESS
public static final int STATUS_DELETED
public static final int STATUS_REFRESH_IN_PROGRESS
public static final int ACCESS_PUBLIC
public static final int ACCESS_PUBLIC_READ_ONLY
public static final int ACCESS_APPLICATION
public static final int ACCESS_APPLICATION_READ_ONLY
public static final int ACCESS_PRIVATE
public static final int BINDING_DEFERRED
public static final int BINDING_IMMEDIATE
public static final int BINDING_AUTO_SAVE
public CloudObject()
public CloudObject(String type)
type
- the type of the objectpublic CloudObject(String type, int permissions)
type
- the type of the objectpermissions
- one of the ACCESS_* valuespublic int getStatus()
public void setType(String type)
type
- the type of the fieldpublic String getType()
public void setIndexString(int index, String value)
index
- the index which must be a value between 1 and 10.value
- the value for the given indexpublic String getIndexString(int index)
index
- the index numberpublic void setIndexLong(int index, long value)
index
- the index which must be a value between 1 and 10.value
- the value for the given indexpublic Long getIndexLong(int index)
index
- the index numberpublic void setIndexDouble(int index, double value)
index
- the index which must be a value between 1 and 10.value
- the value for the given indexpublic Double getIndexDouble(int index)
index
- the index numberpublic boolean isOwner()
public String getCloudId()
public long getLastModified()
public Object getObject(String key)
key
- the key for the objectpublic static void setCustomProperty(String key, CustomProperty cp)
key
- the key on which to install the custom propertycp
- the custom property implementationpublic void setString(String key, String value)
key
- the key for the given valuevalue
- the valuepublic String getString(String key)
key
- the keypublic void remove(String key)
key
- the key to remove from the objectpublic void setLong(String key, long value)
key
- the key for the given valuevalue
- the valuepublic void setLong(String key, Long value)
key
- the key for the given valuevalue
- the valuepublic Long getLong(String key)
key
- the keypublic void setInteger(String key, int value)
key
- the key for the given valuevalue
- the valuepublic void setInteger(String key, Integer value)
key
- the key for the given valuevalue
- the valuepublic Integer getInteger(String key)
key
- the keypublic void setDouble(String key, double value)
key
- the key for the given valuevalue
- the valuepublic void setDouble(String key, Double value)
key
- the key for the given valuevalue
- the valuepublic Double getDouble(String key)
key
- the keypublic void setFloat(String key, float value)
key
- the key for the given valuevalue
- the valuepublic void setFloat(String key, Float value)
key
- the key for the given valuevalue
- the valuepublic Float getFloat(String key)
key
- the keypublic void setBoolean(String key, boolean value)
key
- the key for the given valuevalue
- the valuepublic void setBoolean(String key, Boolean value)
key
- the key for the given valuevalue
- the valuepublic Boolean getBoolean(String key)
key
- the keypublic int getVersion()
Externalizable
getVersion
in interface Externalizable
public void externalize(DataOutputStream out) throws IOException
Externalizable
externalize
in interface Externalizable
out
- the stream into which the object must be serializedIOException
- the method may throw an exceptionpublic String getObjectId()
Externalizable
getObjectId
in interface Externalizable
public void internalize(int version, DataInputStream in) throws IOException
Externalizable
internalize
in interface Externalizable
version
- the version the class returned during the externalization processsin
- the input stream used to load the classIOException
- the method may throw an exceptionpublic int getAccessPermissions()
public boolean equals(Object o)
Object
public int hashCode()
Object
public void bindTree(Container ui, int defer, boolean objectLead)
ui
- the component tree to binddefer
- bind settings whether to defer the binding which requires developers to explicitly commit
the binding to perform the changesobjectLead
- if set to true the UI property is initialized from values in the CloudObject, if false
the cloud object property is initialized from the UIpublic void unbindTree(Container ui)
ui
- the container whose children might be boundpublic void bindProperty(Component cmp, String propertyName, String attributeName, int defer, boolean objectLead)
cmp
- the component to bindpropertyName
- the name of the property in the bound componentattributeName
- the key within the cloud objectdefer
- bind settings whether to defer the binding which requires developers to explicitly commit
the binding to perform the changesobjectLead
- if set to true the UI property is initialized from values in the CloudObject, if false
the cloud object property is initialized from the UIpublic void unbindProperty(Component cmp, String propertyName)
cmp
- the componentpropertyName
- the name of the propertypublic void commitBinding()
public void cancelBinding()