[cvs]
expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dataobjects
DefaultDataField.java
JCorporate Ltd
jcorp at jcorp2.servlets.net
Sat Aug 7 11:50:24 PDT 2004
Update of /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dataobjects
In directory jcorp2.servlets.net:/tmp/cvs-serv21013/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dataobjects
Modified Files:
DefaultDataField.java
Log Message:
reformat only
Index: DefaultDataField.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dataobjects/DefaultDataField.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** DefaultDataField.java 7 Aug 2004 02:10:20 -0000 1.27
--- DefaultDataField.java 7 Aug 2004 18:50:22 -0000 1.28
***************
*** 101,109 ****
*
* @author Michael Rimov
- *
* @since Expresso 5.0
*/
! public class DefaultDataField implements DataField, Serializable
! {
private static final BigDecimal zeroDecimal = new BigDecimal("0.00");
private static final Integer zeroInteger = new Integer(0);
--- 101,107 ----
*
* @author Michael Rimov
* @since Expresso 5.0
*/
! public class DefaultDataField implements DataField, Serializable {
private static final BigDecimal zeroDecimal = new BigDecimal("0.00");
private static final Integer zeroInteger = new Integer(0);
***************
*** 138,143 ****
*/
private static transient ThreadLocal patternMatcher = new ThreadLocal() {
! protected synchronized Object initialValue()
! {
return new Perl5Matcher();
}
--- 136,140 ----
*/
private static transient ThreadLocal patternMatcher = new ThreadLocal() {
! protected synchronized Object initialValue() {
return new Perl5Matcher();
}
***************
*** 184,193 ****
* Creates a new DefaultDataField object.
*
! * @param metaData DOCUMENT ME!
* @param parentObject DOCUMENT ME!
*/
protected DefaultDataField(DataFieldMetaData metaData,
! DataObject parentObject)
! {
myMetaData = metaData;
--- 181,189 ----
* Creates a new DefaultDataField object.
*
! * @param metaData DOCUMENT ME!
* @param parentObject DOCUMENT ME!
*/
protected DefaultDataField(DataFieldMetaData metaData,
! DataObject parentObject) {
myMetaData = metaData;
***************
*** 205,216 ****
* DOCUMENT ME!
*
! * @param metaData DOCUMENT ME!
* @param parentObject DOCUMENT ME!
- *
* @return DOCUMENT ME!
*/
public static DefaultDataField getInstance(DataFieldMetaData metaData,
! DataObject parentObject)
! {
return new DefaultDataField(metaData, parentObject);
}
--- 201,210 ----
* DOCUMENT ME!
*
! * @param metaData DOCUMENT ME!
* @param parentObject DOCUMENT ME!
* @return DOCUMENT ME!
*/
public static DefaultDataField getInstance(DataFieldMetaData metaData,
! DataObject parentObject) {
return new DefaultDataField(metaData, parentObject);
}
***************
*** 223,228 ****
* @return java.util.map
*/
! public Map getAllAttributes()
! {
if (attributes == null) {
return new HashMap();
--- 217,221 ----
* @return java.util.map
*/
! public Map getAllAttributes() {
if (attributes == null) {
return new HashMap();
***************
*** 236,243 ****
*
* @param attributeName the name of the attribute to set
! * @param value the value to set it to
*/
! public void setAttribute(String attributeName, Object value)
! {
if (attributes == null) {
attributes = new HashMap();
--- 229,235 ----
*
* @param attributeName the name of the attribute to set
! * @param value the value to set it to
*/
! public void setAttribute(String attributeName, Object value) {
if (attributes == null) {
attributes = new HashMap();
***************
*** 251,259 ****
*
* @param attributeName the name of the attribute to retrieve
- *
* @return an object or null if the attribute doesn't exist
*/
! public Object getAttribute(String attributeName)
! {
if (attributes == null) {
return null;
--- 243,249 ----
*
* @param attributeName the name of the attribute to retrieve
* @return an object or null if the attribute doesn't exist
*/
! public Object getAttribute(String attributeName) {
if (attributes == null) {
return null;
***************
*** 271,276 ****
* object was constructed or reset)
*/
! public boolean isChanged()
! {
return isChanged;
--- 261,265 ----
* object was constructed or reset)
*/
! public boolean isChanged() {
return isChanged;
***************
*** 282,289 ****
*
* @param newMetadata the new Field Meta data object... for example
! * <code>DBField</code>
*/
! public void setFieldMetaData(DataFieldMetaData newMetadata)
! {
this.myMetaData = newMetadata;
}
--- 271,277 ----
*
* @param newMetadata the new Field Meta data object... for example
! * <code>DBField</code>
*/
! public void setFieldMetaData(DataFieldMetaData newMetadata) {
this.myMetaData = newMetadata;
}
***************
*** 294,299 ****
* @return DataFieldMetaData
*/
! public DataFieldMetaData getFieldMetaData()
! {
return this.myMetaData;
}
--- 282,286 ----
* @return DataFieldMetaData
*/
! public DataFieldMetaData getFieldMetaData() {
return this.myMetaData;
}
***************
*** 304,309 ****
* @return true if the object is null
*/
! public boolean isNull()
! {
return (currentValue == null);
}
--- 291,295 ----
* @return true if the object is null
*/
! public boolean isNull() {
return (currentValue == null);
}
***************
*** 313,321 ****
* null if isChanged() is false
*
- * @deprecated 8/04 v.5.5 do not expose this cache
* @return the original object or null
*/
! public Object getOriginalValue()
! {
return originalValue;
}
--- 299,306 ----
* null if isChanged() is false
*
* @return the original object or null
+ * @deprecated 8/04 v.5.5 do not expose this cache
*/
! public Object getOriginalValue() {
return originalValue;
}
***************
*** 326,331 ****
* @param newOwner The new parent object.
*/
! public void setOwner(DataObject newOwner)
! {
this.owner = newOwner;
}
--- 311,315 ----
* @param newOwner The new parent object.
*/
! public void setOwner(DataObject newOwner) {
this.owner = newOwner;
}
***************
*** 337,342 ****
* @return DataObject the containing data object.
*/
! public DataObject getOwner()
! {
return this.owner;
}
--- 321,325 ----
* @return DataObject the containing data object.
*/
! public DataObject getOwner() {
return this.owner;
}
***************
*** 348,353 ****
* @param o the object to set.
*/
! public void setSerializedForm(Object o)
! {
currentValue = o;
originalValue = null;
--- 331,335 ----
* @param o the object to set.
*/
! public void setSerializedForm(Object o) {
currentValue = o;
originalValue = null;
***************
*** 359,367 ****
*
* @return java.lang.Object
- *
* @throws DataException upon error
*/
! public Object getSerializedForm() throws DataException
! {
try {
if (currentValue == null) {
--- 341,347 ----
*
* @return java.lang.Object
* @throws DataException upon error
*/
! public Object getSerializedForm() throws DataException {
try {
if (currentValue == null) {
***************
*** 372,377 ****
if (!(currentValue instanceof String)) {
throw new IllegalArgumentException("Field " +
! myMetaData.getName() +
! " must be a string value to be encrypted");
}
--- 352,357 ----
if (!(currentValue instanceof String)) {
throw new IllegalArgumentException("Field " +
! myMetaData.getName() +
! " must be a string value to be encrypted");
}
***************
*** 386,391 ****
try {
boolean nativeBoolean = ConfigManager.getContext(owner.getDataContext())
! .getJdbc()
! .isNativeBool();
if (!nativeBoolean) {
--- 366,371 ----
try {
boolean nativeBoolean = ConfigManager.getContext(owner.getDataContext())
! .getJdbc()
! .isNativeBool();
if (!nativeBoolean) {
***************
*** 416,421 ****
* @param newValue a new Object to set the value to
*/
! public void setValue(Object newValue)
! {
if (originalValue == null) {
// we preserve the very first, original value; not sure what use this is! todo: eliminate orignalValue?
--- 396,400 ----
* @param newValue a new Object to set the value to
*/
! public void setValue(Object newValue) {
if (originalValue == null) {
// we preserve the very first, original value; not sure what use this is! todo: eliminate orignalValue?
***************
*** 452,462 ****
* @return DOCUMENT ME!
*/
! public Object getValue()
! {
if ((currentValue != null) && currentValue instanceof String &&
myMetaData.isEncrypted()) {
try {
return CryptoManager.getInstance().getStringEncryption()
! .decryptString((Base64.decodeNoPadding((String) currentValue)));
} catch (ChainedException ce) {
return currentValue;
--- 431,440 ----
* @return DOCUMENT ME!
*/
! public Object getValue() {
if ((currentValue != null) && currentValue instanceof String &&
myMetaData.isEncrypted()) {
try {
return CryptoManager.getInstance().getStringEncryption()
! .decryptString((Base64.decodeNoPadding((String) currentValue)));
} catch (ChainedException ce) {
return currentValue;
***************
*** 472,477 ****
* @return true if the field has had the value set since the last reset
*/
! public boolean isValueSet()
! {
return isValueSet;
}
--- 450,454 ----
* @return true if the field has had the value set since the last reset
*/
! public boolean isValueSet() {
return isValueSet;
}
***************
*** 484,489 ****
* able to convert it.
*/
! public BigDecimal asBigDecimal()
! {
Object o = getValue();
--- 461,465 ----
* able to convert it.
*/
! public BigDecimal asBigDecimal() {
Object o = getValue();
***************
*** 501,508 ****
return returnValue.setScale(this.getFieldMetaData()
! .getPrecision());
} catch (NumberFormatException ex) {
return zeroDecimal.setScale(this.getFieldMetaData()
! .getPrecision());
}
}
--- 477,484 ----
return returnValue.setScale(this.getFieldMetaData()
! .getPrecision());
} catch (NumberFormatException ex) {
return zeroDecimal.setScale(this.getFieldMetaData()
! .getPrecision());
}
}
***************
*** 516,521 ****
* @return Boolean object. Null if the object's value is null
*/
! public Boolean asBoolean()
! {
Object o = getValue();
--- 492,496 ----
* @return Boolean object. Null if the object's value is null
*/
! public Boolean asBoolean() {
Object o = getValue();
***************
*** 548,553 ****
* to convert it.
*/
! public Date asDate()
! {
Object o = getValue();
--- 523,527 ----
* to convert it.
*/
! public Date asDate() {
Object o = getValue();
***************
*** 568,575 ****
try {
myConfig = ConfigManager.getJdbcRequired(this.getOwner()
! .getDataContext());
} catch (ConfigurationException ce) {
log.error("Error getting data context: " +
! getOwner().getDataContext());
return null;
--- 542,549 ----
try {
myConfig = ConfigManager.getJdbcRequired(this.getOwner()
! .getDataContext());
} catch (ConfigurationException ce) {
log.error("Error getting data context: " +
! getOwner().getDataContext());
return null;
***************
*** 584,588 ****
} else if (this.getFieldMetaData().isDateTimeType()) {
if (!StringUtil.notNull(myConfig.getDateTimeSelectFormat())
! .equals("")) {
convertFormat = myConfig.getDateTimeSelectFormat();
} else {
--- 558,562 ----
} else if (this.getFieldMetaData().isDateTimeType()) {
if (!StringUtil.notNull(myConfig.getDateTimeSelectFormat())
! .equals("")) {
convertFormat = myConfig.getDateTimeSelectFormat();
} else {
***************
*** 597,601 ****
} else {
log.warn("Unable to find convert type for class " +
! o.getClass().getName());
return null;
--- 571,575 ----
} else {
log.warn("Unable to find convert type for class " +
! o.getClass().getName());
return null;
***************
*** 621,625 ****
log.warn("Unable to find conversion for object " +
! o.getClass().getName() + " to Date");
return null;
--- 595,599 ----
log.warn("Unable to find conversion for object " +
! o.getClass().getName() + " to Date");
return null;
***************
*** 633,638 ****
* to convert it.
*/
! public Double asDouble()
! {
Object o = getValue();
--- 607,611 ----
* to convert it.
*/
! public Double asDouble() {
Object o = getValue();
***************
*** 658,663 ****
* @return a java.lang.Integer object, or null if the object is null.
*/
! public Integer asInteger()
! {
Object o = getValue();
--- 631,635 ----
* @return a java.lang.Integer object, or null if the object is null.
*/
! public Integer asInteger() {
Object o = getValue();
***************
*** 691,696 ****
* serializable
*/
! public InputStream asStream()
! {
Object o = getValue();
--- 663,667 ----
* serializable
*/
! public InputStream asStream() {
Object o = getValue();
***************
*** 705,709 ****
if (!(o instanceof Serializable)) {
log.error("Object: " + o.getClass().getName() +
! " is not serializable. Cannot retrieve as stream");
return null;
--- 676,680 ----
if (!(o instanceof Serializable)) {
log.error("Object: " + o.getClass().getName() +
! " is not serializable. Cannot retrieve as stream");
return null;
***************
*** 734,739 ****
* @return a String value representing the object as a string
*/
! public String asString()
! {
Object o = getValue();
--- 705,709 ----
* @return a String value representing the object as a string
*/
! public String asString() {
Object o = getValue();
***************
*** 753,757 ****
try {
return DateTime.getDateTimeForDB((Date) o,
! this.getOwner().getDataContext());
} catch (DBException ex) {
}
--- 723,727 ----
try {
return DateTime.getDateTimeForDB((Date) o,
! this.getOwner().getDataContext());
} catch (DBException ex) {
}
***************
*** 766,771 ****
* @throws DataException if the field value is not valid
*/
! public void checkValue() throws DataException
! {
DataObjectMetaData ownerMetaData = owner.getMetaData();
--- 736,740 ----
* @throws DataException if the field value is not valid
*/
! public void checkValue() throws DataException {
DataObjectMetaData ownerMetaData = owner.getMetaData();
***************
*** 881,886 ****
* DOCUMENT ME!
*/
! public void release()
! {
currentValue = null;
originalValue = null;
--- 850,854 ----
* DOCUMENT ME!
*/
! public void release() {
currentValue = null;
originalValue = null;
***************
*** 896,901 ****
* @param attribute The attribute key to remove
*/
! public void removeAttribute(String attribute)
! {
if (attributes == null) {
return;
--- 864,868 ----
* @param attribute The attribute key to remove
*/
! public void removeAttribute(String attribute) {
if (attributes == null) {
return;
***************
*** 908,913 ****
* Resets the changed flag and sets the original value field to null
*/
! public void resetChanged()
! {
originalValue = null;
isChanged = false;
--- 875,879 ----
* Resets the changed flag and sets the original value field to null
*/
! public void resetChanged() {
originalValue = null;
isChanged = false;
***************
*** 919,933 ****
*
* @param theFieldValue The target value
- *
* @return the string value
* @throws IllegalArgumentException If we can't get the data context
*/
! protected String getBooleanFieldValue(Boolean theFieldValue)
! {
try {
boolean fieldValue = theFieldValue.booleanValue();
boolean nativeBoolean = ConfigManager.getContext(this.getOwner()
! .getDataContext())
! .getJdbc().isNativeBool();
if (fieldValue == true) {
--- 885,897 ----
*
* @param theFieldValue The target value
* @return the string value
* @throws IllegalArgumentException If we can't get the data context
*/
! protected String getBooleanFieldValue(Boolean theFieldValue) {
try {
boolean fieldValue = theFieldValue.booleanValue();
boolean nativeBoolean = ConfigManager.getContext(this.getOwner()
! .getDataContext())
! .getJdbc().isNativeBool();
if (fieldValue == true) {
***************
*** 947,951 ****
log.error("Error getting data context.", ce);
throw new IllegalArgumentException("Error getting datacontext " +
! this.getOwner().getDataContext());
}
}
--- 911,915 ----
log.error("Error getting data context.", ce);
throw new IllegalArgumentException("Error getting datacontext " +
! this.getOwner().getDataContext());
}
}
***************
*** 958,963 ****
* @return PatternMatcher
*/
! protected PatternMatcher getPatternMatcher()
! {
return (PatternMatcher) patternMatcher.get();
}
--- 922,926 ----
* @return PatternMatcher
*/
! protected PatternMatcher getPatternMatcher() {
return (PatternMatcher) patternMatcher.get();
}
***************
*** 969,973 ****
*
* @param pattern the format pattern to look up
- *
* @return an instantiated SimpleDateFormat object. SimpleDateFormat is
* NOT threadsafe, so make sure you do your parsing while still in
--- 932,935 ----
***************
*** 975,980 ****
* pool will be better.
*/
! private SimpleDateFormat getSimpleDateFormat(String pattern)
! {
SimpleDateFormat aFormat = null;
aFormat = (SimpleDateFormat) dateConvertFormatMap.get(pattern);
--- 937,941 ----
* pool will be better.
*/
! private SimpleDateFormat getSimpleDateFormat(String pattern) {
SimpleDateFormat aFormat = null;
aFormat = (SimpleDateFormat) dateConvertFormatMap.get(pattern);
More information about the cvs
mailing list