Java Doc for GenericEntity.java in  » ERP-CRM-Financial » SourceTap-CRM » org » ofbiz » entity » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » SourceTap CRM » org.ofbiz.entity 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.Observable
      org.ofbiz.entity.GenericEntity

All known Subclasses:   org.ofbiz.entity.GenericPK,  org.ofbiz.entity.GenericValue,
GenericEntity
public class GenericEntity extends Observable implements Map,LocalizedMap,Serializable,Comparable,Cloneable(Code)
Generic Entity Value Object - Handles persisntence for any defined entity.

Note that this class extends Observable to achieve change notification for Observers. Whenever a field changes the name of the field will be passed to the notifyObservers() method, and through that to the update() method of each Observer.
author:
   David E. Jones
author:
   Andy Zeneski
version:
   $Revision: 1.20 $
since:
   2.0



Field Summary
protected  StringdelegatorName
    
protected  StringentityName
    
protected  Mapfields
     Contains the fields for this entity.
protected transient  GenericDelegatorinternalDelegator
     Reference to an instance of GenericDelegator used to do some basic operations on this entity value.
protected  booleanisFromEntitySync
    
protected transient  ModelEntitymodelEntity
    
protected  booleanmodified
    
final public static  Stringmodule
    
protected  booleanmutable
    

Constructor Summary
public  GenericEntity()
    
public  GenericEntity(ModelEntity modelEntity)
    
public  GenericEntity(ModelEntity modelEntity, Map fields)
    
public  GenericEntity(GenericEntity value)
    

Method Summary
public static  intaddToXmlDocument(Collection values, Document document)
    
public  voidclear()
    
public  Objectclone()
    
public  intcompareTo(Object obj)
    
public  booleancontainsKey(Object key)
    
public  booleancontainsPrimaryKey()
     Returns true if the entity contains all of the primary key fields.
public  booleancontainsValue(Object value)
    
public  ObjectdangerousGetNoCheckButFast(ModelField modelField)
    
public  voiddangerousSetNoCheckButFast(ModelField modelField, Object value)
    
public  java.util.SetentrySet()
    
public  booleanequals(Object obj)
    
public  Objectget(String name)
    
public  Objectget(String name, Locale locale)
     Checks a resource bundle for a value for this field using the entity name, the field name and a composite of the Primary Key field values as a key.
public  Objectget(String name, String resource, Locale locale)
     Same as the getResource method that does not take resource name, but instead allows manually specifying the resource name.
public  Objectget(Object key)
    
public  MapgetAllFields()
    
public  CollectiongetAllKeys()
    
public  BooleangetBoolean(String name)
    
public  byte[]getBytes(String name)
    
public  java.sql.DategetDate(String name)
    
public  GenericDelegatorgetDelegator()
     Get the GenericDelegator instance that created this value object and that is repsonsible for it.
public  DoublegetDouble(String name)
    
public  StringgetEntityName()
    
public  MapgetFields(Collection keysofFields)
    
public  FloatgetFloat(String name)
    
public  IntegergetInteger(String name)
    
public  booleangetIsFromEntitySync()
    
public  LonggetLong(String name)
    
public  ModelEntitygetModelEntity()
    
public  GenericPKgetPrimaryKey()
    
public  StringgetString(String name)
    
public  java.sql.TimegetTime(String name)
    
public  java.sql.TimestampgetTimestamp(String name)
    
public  inthashCode()
    
public  booleanisEmpty()
    
public  booleanisModified()
    
public  booleanisMutable()
    
public  booleanisPrimaryKey()
     Returns true if the entity contains all of the primary key fields, but NO others.
public  java.util.SetkeySet()
    
public  booleanlockEnabled()
    
public static  DocumentmakeXmlDocument(Collection values)
    
public  ElementmakeXmlElement(Document document)
    
public  ElementmakeXmlElement(Document document, String prefix)
    
public  booleanmatchesFields(Map keyValuePairs)
    
public  Objectput(Object key, Object value)
    
public  voidputAll(java.util.Map map)
    
public  voidrefreshFromValue(GenericEntity newValue)
    
public  Objectremove(Object key)
    
public  voidremovedFromDatasource()
    
public  voidset(String name, Object value)
    
public synchronized  Objectset(String name, Object value, boolean setIfNull)
     Sets the named field to the passed value.
public  voidsetAllFields(Map fields, boolean setIfEmpty, String namePrefix, Boolean pks)
    
public  voidsetBytes(String name, byte[] bytes)
     Sets a field with an array of bytes, wrapping them automatically for easy use.
public  voidsetDelegator(GenericDelegator internalDelegator)
     Set the GenericDelegator instance that created this value object and that is repsonsible for it.
public synchronized  voidsetFields(Map keyValuePairs)
    
public  voidsetImmutable()
    
public  voidsetIsFromEntitySync(boolean isFromEntitySync)
    
public  voidsetNonPKFields(Map fields)
    
public  voidsetNonPKFields(Map fields, boolean setIfEmpty)
    
public  voidsetPKFields(Map fields)
    
public  voidsetPKFields(Map fields, boolean setIfEmpty)
    
public  voidsetString(String name, String value)
    
public  intsize()
    
public  voidsynchronizedWithDatasource()
    
public  StringtoString()
    
public  java.util.Collectionvalues()
    
public  voidwriteXmlText(PrintWriter writer, String prefix)
    

Field Detail
delegatorName
protected String delegatorName(Code)
Name of the GenericDelegator, used to reget the GenericDelegator when deserialized



entityName
protected String entityName(Code)
Contains the entityName of this entity, necessary for efficiency when creating EJBs



fields
protected Map fields(Code)
Contains the fields for this entity. Note that this should always be a HashMap to allow for two things: non-synchronized reads (synchronized writes are done through synchronized setters) and being able to store null values. Null values are important because with them we can distinguish between desiring to set a value to null and desiring to not modify the current value on an update.



internalDelegator
protected transient GenericDelegator internalDelegator(Code)
Reference to an instance of GenericDelegator used to do some basic operations on this entity value. If null various methods in this class will fail. This is automatically set by the GenericDelegator for all GenericValue objects instantiated through it. You may set this manually for objects you instantiate manually, but it is optional.



isFromEntitySync
protected boolean isFromEntitySync(Code)
This is an internal field used to specify that a value has come from a sync process and that the auto-stamps should not be over-written



modelEntity
protected transient ModelEntity modelEntity(Code)
Contains the ModelEntity instance that represents the definition of this entity, not to be serialized



modified
protected boolean modified(Code)
Denotes whether or not this entity has been modified, or is known to be out of sync with the persistent record



module
final public static String module(Code)



mutable
protected boolean mutable(Code)
Used to specify whether or not this representation of the entity can be changed; generally cleared when this object comes from a cache




Constructor Detail
GenericEntity
public GenericEntity()(Code)
Creates new GenericEntity



GenericEntity
public GenericEntity(ModelEntity modelEntity)(Code)
Creates new GenericEntity



GenericEntity
public GenericEntity(ModelEntity modelEntity, Map fields)(Code)
Creates new GenericEntity from existing Map



GenericEntity
public GenericEntity(GenericEntity value)(Code)
Copy Constructor: Creates new GenericEntity from existing GenericEntity




Method Detail
addToXmlDocument
public static int addToXmlDocument(Collection values, Document document)(Code)



clear
public void clear()(Code)



clone
public Object clone()(Code)
Clones this GenericEntity, this is a shallow clone & uses the default shallow HashMap clone Object that is a clone of this GenericEntity



compareTo
public int compareTo(Object obj)(Code)
Compares this GenericEntity to the passed object
Parameters:
  obj - Object to compare this to int representing the result of the comparison (-1,0, or 1)



containsKey
public boolean containsKey(Object key)(Code)



containsPrimaryKey
public boolean containsPrimaryKey()(Code)
Returns true if the entity contains all of the primary key fields.



containsValue
public boolean containsValue(Object value)(Code)



dangerousGetNoCheckButFast
public Object dangerousGetNoCheckButFast(ModelField modelField)(Code)



dangerousSetNoCheckButFast
public void dangerousSetNoCheckButFast(ModelField modelField, Object value)(Code)



entrySet
public java.util.Set entrySet()(Code)



equals
public boolean equals(Object obj)(Code)
Determines the equality of two GenericEntity objects, overrides the default equals
Parameters:
  obj - The object (GenericEntity) to compare this two boolean stating if the two objects are equal



get
public Object get(String name)(Code)



get
public Object get(String name, Locale locale)(Code)
Checks a resource bundle for a value for this field using the entity name, the field name and a composite of the Primary Key field values as a key. If no value is found in the resource then the field value is returned. Uses the default-resource-name from the entity definition as the resource name. To specify a resource name manually, use the other getResource method. So, the key in the resource bundle (properties file) should be as follows: ...... For example: ProductType.description.FINISHED_GOOD
Parameters:
  name - The name of the field on the entity
Parameters:
  locale - The locale to use when finding the ResourceBundle, if null uses the defaultlocale for the current instance of Java If the corresponding resource is found and contains a key as described above, then thatproperty value is returned; otherwise returns the field value



get
public Object get(String name, String resource, Locale locale)(Code)
Same as the getResource method that does not take resource name, but instead allows manually specifying the resource name. In general you should use the other method for more consistent naming and use of the corresponding properties files.
Parameters:
  name - The name of the field on the entity
Parameters:
  resource - The name of the resource to get the value from; if null defaults to thedefault-resource-name on the entity definition, if specified there
Parameters:
  locale - The locale to use when finding the ResourceBundle, if null uses the defaultlocale for the current instance of Java If the specified resource is found and contains a key as described above, then thatproperty value is returned; otherwise returns the field value



get
public Object get(Object key)(Code)



getAllFields
public Map getAllFields()(Code)
Returns key/value pairs of entity fields java.util.Map



getAllKeys
public Collection getAllKeys()(Code)
Returns keys of entity fields java.util.Collection



getBoolean
public Boolean getBoolean(String name)(Code)



getBytes
public byte[] getBytes(String name)(Code)



getDate
public java.sql.Date getDate(String name)(Code)



getDelegator
public GenericDelegator getDelegator()(Code)
Get the GenericDelegator instance that created this value object and that is repsonsible for it. GenericDelegator object



getDouble
public Double getDouble(String name)(Code)



getEntityName
public String getEntityName()(Code)



getFields
public Map getFields(Collection keysofFields)(Code)
Used by clients to specify exactly the fields they are interested in
Parameters:
  keysofFields - the name of the fields the client is interested in java.util.Map



getFloat
public Float getFloat(String name)(Code)



getInteger
public Integer getInteger(String name)(Code)



getIsFromEntitySync
public boolean getIsFromEntitySync()(Code)
Returns the isFromEntitySync.



getLong
public Long getLong(String name)(Code)



getModelEntity
public ModelEntity getModelEntity()(Code)



getPrimaryKey
public GenericPK getPrimaryKey()(Code)



getString
public String getString(String name)(Code)



getTime
public java.sql.Time getTime(String name)(Code)



getTimestamp
public java.sql.Timestamp getTimestamp(String name)(Code)



hashCode
public int hashCode()(Code)
Creates a hashCode for the entity, using the default String hashCode and Map hashCode, overrides the default hashCode Hashcode corresponding to this entity



isEmpty
public boolean isEmpty()(Code)



isModified
public boolean isModified()(Code)



isMutable
public boolean isMutable()(Code)



isPrimaryKey
public boolean isPrimaryKey()(Code)
Returns true if the entity contains all of the primary key fields, but NO others.



keySet
public java.util.Set keySet()(Code)



lockEnabled
public boolean lockEnabled()(Code)
Used to indicate if locking is enabled for this entity True if locking is enabled



makeXmlDocument
public static Document makeXmlDocument(Collection values)(Code)



makeXmlElement
public Element makeXmlElement(Document document)(Code)
Makes an XML Element object with an attribute for each field of the entity
Parameters:
  document - The XML Document that the new Element will be part of org.w3c.dom.Element object representing this generic entity



makeXmlElement
public Element makeXmlElement(Document document, String prefix)(Code)
Makes an XML Element object with an attribute for each field of the entity
Parameters:
  document - The XML Document that the new Element will be part of
Parameters:
  prefix - A prefix to put in front of the entity name in the tag name org.w3c.dom.Element object representing this generic entity



matchesFields
public boolean matchesFields(Map keyValuePairs)(Code)



put
public Object put(Object key, Object value)(Code)



putAll
public void putAll(java.util.Map map)(Code)



refreshFromValue
public void refreshFromValue(GenericEntity newValue) throws GenericEntityException(Code)



remove
public Object remove(Object key)(Code)



removedFromDatasource
public void removedFromDatasource()(Code)



set
public void set(String name, Object value)(Code)
Sets the named field to the passed value, even if the value is null
Parameters:
  name - The field name to set
Parameters:
  value - The value to set



set
public synchronized Object set(String name, Object value, boolean setIfNull)(Code)
Sets the named field to the passed value. If value is null, it is only set if the setIfNull parameter is true. This is useful because an update will only set values that are included in the HashMap and will store null values in the HashMap to the datastore. If a value is not in the HashMap, it will be left unmodified in the datastore.
Parameters:
  name - The field name to set
Parameters:
  value - The value to set
Parameters:
  setIfNull - Specifies whether or not to set the value if it is null



setAllFields
public void setAllFields(Map fields, boolean setIfEmpty, String namePrefix, Boolean pks)(Code)
Intelligently sets fields on this entity from the Map of fields passed in
Parameters:
  fields - The fields Map to get the values from
Parameters:
  setIfEmpty - Used to specify whether empty/null values in the field Map should over-write non-empty values in this entity
Parameters:
  namePrefix - If not null or empty will be pre-pended to each field name (upper-casing the first letter of the field name first), and that will be used as the fields Map lookup name instead of the field-name
Parameters:
  pks - If null, get all values, if TRUE just get PKs, if FALSE just get non-PKs



setBytes
public void setBytes(String name, byte[] bytes)(Code)
Sets a field with an array of bytes, wrapping them automatically for easy use.
Parameters:
  name - The field name to set
Parameters:
  bytes - The byte array to be wrapped and set



setDelegator
public void setDelegator(GenericDelegator internalDelegator)(Code)
Set the GenericDelegator instance that created this value object and that is repsonsible for it.



setFields
public synchronized void setFields(Map keyValuePairs)(Code)
Used by clients to update particular fields in the entity
Parameters:
  keyValuePairs - java.util.Map



setImmutable
public void setImmutable()(Code)



setIsFromEntitySync
public void setIsFromEntitySync(boolean isFromEntitySync)(Code)

Parameters:
  isFromEntitySync - The isFromEntitySync to set.



setNonPKFields
public void setNonPKFields(Map fields)(Code)
go through the non-pks and for each one see if there is an entry in fields to set



setNonPKFields
public void setNonPKFields(Map fields, boolean setIfEmpty)(Code)
go through the non-pks and for each one see if there is an entry in fields to set



setPKFields
public void setPKFields(Map fields)(Code)
go through the pks and for each one see if there is an entry in fields to set



setPKFields
public void setPKFields(Map fields, boolean setIfEmpty)(Code)
go through the pks and for each one see if there is an entry in fields to set



setString
public void setString(String name, String value)(Code)
Sets the named field to the passed value, converting the value from a String to the corrent type using Type.valueOf()
Parameters:
  name - The field name to set
Parameters:
  value - The String value to convert and set



size
public int size()(Code)



synchronizedWithDatasource
public void synchronizedWithDatasource()(Code)



toString
public String toString()(Code)
Creates a String for the entity, overrides the default toString String corresponding to this entity



values
public java.util.Collection values()(Code)



writeXmlText
public void writeXmlText(PrintWriter writer, String prefix)(Code)
Writes XML text with an attribute or CDATA element for each field of the entity
Parameters:
  writer - A PrintWriter to write to
Parameters:
  prefix - A prefix to put in front of the entity name in the tag name



Methods inherited from java.util.Observable
public synchronized void addObserver(Observer o)(Code)(Java Doc)
protected synchronized void clearChanged()(Code)(Java Doc)
public synchronized int countObservers()(Code)(Java Doc)
public synchronized void deleteObserver(Observer o)(Code)(Java Doc)
public synchronized void deleteObservers()(Code)(Java Doc)
public synchronized boolean hasChanged()(Code)(Java Doc)
public void notifyObservers()(Code)(Java Doc)
public void notifyObservers(Object arg)(Code)(Java Doc)
protected synchronized void setChanged()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.