com.waveset.object
Class ResourceResult

java.lang.Object
  extended bycom.waveset.util.AbstractXmlObject
      extended bycom.waveset.object.ResourceResult
All Implemented Interfaces:
javax.naming.Referenceable, XmlObject

public class ResourceResult
extends AbstractXmlObject

A class used to represent information about an operation on a resource in a WavesetResult.


Nested Class Summary
static class ResourceResult.Operation
          An enumeration class Used for values of the _op field, indicating the type of operation that was atttempted on the resource.
 
Field Summary
static java.lang.String ATT_ACCOUNTID
           
static java.lang.String ATT_ERROR
           
static java.lang.String ATT_NAME
           
static java.lang.String ATT_OP
           
static java.lang.String ATT_PROTECTED
           
static java.lang.String code_id
           
static java.lang.String ELEMENT
          Our XML element name.
static java.lang.String ITEM_TYPE
          The ResultItem type name for these.
 
Fields inherited from class com.waveset.util.AbstractXmlObject
_trace
 
Constructor Summary
ResourceResult()
          Build an empty result object, which can be populated manually.
ResourceResult(org.w3c.dom.Element e)
          Build a result object from xml.
 
Method Summary
 void add(java.lang.Object result)
          Add an object to the result.
 void addException(java.lang.Throwable t)
          Add an exception.
 void addNamedResult(java.lang.String name, java.lang.Object value)
          Add a named result item.
 void addNamedResult(java.lang.String name, java.lang.String type, java.lang.Object value)
          Add a named result item.
 void addResult(java.lang.String type, java.lang.Object value)
          Add a result item.
 void assimilate(WavesetResult res)
          Add some result, we assume we can take ownership if the given result object if we don't already have one.
 java.lang.String getAccountId()
           
 java.lang.String getElementName()
          Return the XML element name, required by AbstractXmlObject.
 java.util.List getErrors()
          If the result contains errors, format them in a string suitable for presentation to the user.
 void getErrors(java.util.List errors)
           
 java.lang.String getName()
          Get the resource name.
 ResourceResult.Operation getOperation()
          Get the attempted operation.
 WavesetResult getResult()
          Get the nested result object containing messages and errors from the resource.
 ResultTable getResultTable()
          Return the ResultTable for this result containing information about the account attributes that were updated.
 WSUser getUser()
          Get the user that was fetched.
 boolean hasError()
           
 boolean isProtected()
          Tests to see if the resource account was marked protected.
 void setAccountId(java.lang.String s)
          Set the account id.
 void setName(java.lang.String s)
          Set the resource name.
 void setOperation(ResourceResult.Operation o)
          Set the resource operation.
 void setProtected(boolean b)
          Sets the protected flag.
 void setResult(WavesetResult res)
          Set the nested result object.
 void setUser(WSUser user)
          Set the fetched user.
 void toXml(java.lang.StringBuffer b, int indent)
          Serialize into a buffer with optional indentation.
 
Methods inherited from class com.waveset.util.AbstractXmlObject
addXmlHeader, cloneObject, dump, dumpFile, getReference, println, setTrace, toIdentityString, toVerboseString, toVerboseString, toXml, toXml, toXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

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

ELEMENT

public static final java.lang.String ELEMENT
Our XML element name.

See Also:
Constant Field Values

ITEM_TYPE

public static final java.lang.String ITEM_TYPE
The ResultItem type name for these. Should this go here or in ResultItem? !! Need to rename this, better yet no one should use this anymore, just get the ResultItem value and do instanceof.

See Also:
Constant Field Values

ATT_NAME

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

ATT_ACCOUNTID

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

ATT_OP

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

ATT_ERROR

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

ATT_PROTECTED

public static final java.lang.String ATT_PROTECTED
See Also:
Constant Field Values
Constructor Detail

ResourceResult

public ResourceResult()
Build an empty result object, which can be populated manually.


ResourceResult

public ResourceResult(org.w3c.dom.Element e)
               throws WavesetException
Build a result object from xml.

Method Detail

getElementName

public java.lang.String getElementName()
Return the XML element name, required by AbstractXmlObject.

Specified by:
getElementName in interface XmlObject
Specified by:
getElementName in class AbstractXmlObject

getName

public java.lang.String getName()
Get the resource name.


setName

public void setName(java.lang.String s)
Set the resource name.


setAccountId

public void setAccountId(java.lang.String s)
Set the account id. This isn't required, but the provisioner will do this to remember what account we tried to fetch if the WSUser was not returned.


getAccountId

public java.lang.String getAccountId()

getOperation

public ResourceResult.Operation getOperation()
Get the attempted operation. Wired to return "update" if we don't know otherwise so the application doesn't have to worry about null.


setOperation

public void setOperation(ResourceResult.Operation o)
Set the resource operation.


isProtected

public boolean isProtected()
Tests to see if the resource account was marked protected. This is only meaningful for CREATE operations, though I suppse we could set it for the others too.


setProtected

public void setProtected(boolean b)
Sets the protected flag.


getUser

public WSUser getUser()
Get the user that was fetched.


setUser

public void setUser(WSUser user)
Set the fetched user.


getResultTable

public ResultTable getResultTable()
Return the ResultTable for this result containing information about the account attributes that were updated. The provisining engine builds this for all resource operations.


getResult

public WavesetResult getResult()
Get the nested result object containing messages and errors from the resource.


setResult

public void setResult(WavesetResult res)
Set the nested result object.


add

public void add(java.lang.Object result)
Add an object to the result.


assimilate

public void assimilate(WavesetResult res)
Add some result, we assume we can take ownership if the given result object if we don't already have one.


addResult

public void addResult(java.lang.String type,
                      java.lang.Object value)
Add a result item.


addNamedResult

public void addNamedResult(java.lang.String name,
                           java.lang.String type,
                           java.lang.Object value)
Add a named result item.


addNamedResult

public void addNamedResult(java.lang.String name,
                           java.lang.Object value)
Add a named result item.


addException

public void addException(java.lang.Throwable t)
Add an exception. Deprecated, just use add()


getErrors

public java.util.List getErrors()
If the result contains errors, format them in a string suitable for presentation to the user. This is something that should be implemented on WavesetResult too.


getErrors

public void getErrors(java.util.List errors)

hasError

public boolean hasError()

toXml

public void toXml(java.lang.StringBuffer b,
                  int indent)
Description copied from class: AbstractXmlObject
Serialize into a buffer with optional indentation. This must be implemented by the subclass.

Specified by:
toXml in interface XmlObject
Specified by:
toXml in class AbstractXmlObject