use of org.jaffa.datatypes.DateTime in project jaffa-framework by jaffa-projects.
the class AttachmentGraph method setCreatedOn.
/**
* Setter for property createdOn.
*
* @param createdOn Value of property createdOn.
*/
public void setCreatedOn(DateTime createdOn) {
DateTime oldCreatedOn = this.createdOn;
this.createdOn = createdOn;
propertyChangeSupport.firePropertyChange("createdOn", oldCreatedOn, createdOn);
}
use of org.jaffa.datatypes.DateTime in project jaffa-framework by jaffa-projects.
the class FormTag method initTag.
/**
* Reset any valued cached by the tag on construction or re-use
*/
private void initTag() {
m_securityContextSet = false;
m_url = null;
m_dateTime = new DateTime();
m_guardedHtmlLocation = null;
m_guardedButtonPresent = false;
m_headerCache = new HashMap();
m_footerCache = new HashMap();
m_htmlName = null;
m_htmlIdPrefix = null;
m_oldForm = null;
}
use of org.jaffa.datatypes.DateTime in project jaffa-framework by jaffa-projects.
the class DateTimeFieldValidator method validate.
/**
* The RulesEngine will invoke this method to perform the field validation.
* @throws ValidationException if any validation rule fails.
* @throws FrameworkException if any framework error occurs.
*/
public void validate() throws ValidationException, FrameworkException {
Object value = getValue();
if (value != null) {
DateTimeFieldMetaData meta = new DateTimeFieldMetaData(null, getLabelToken(), null, getLayout(), getMinValue(), getMaxValue());
if (value instanceof DateTime)
FieldValidator.validate((DateTime) value, meta, false);
else if (value instanceof Date)
FieldValidator.validate(new DateTime((Date) value), meta, false);
else
FieldValidator.validateData(value.toString(), meta);
}
}
use of org.jaffa.datatypes.DateTime in project jaffa-framework by jaffa-projects.
the class AddTest method testAddWithAutoKeyUsingProxy.
/**
* Inserts a record into ASSET, which has a database generated key
* It then checks if the record was added. Finally the record is deleted
*/
public void testAddWithAutoKeyUsingProxy() {
try {
String assetId = "Z-TESTASSET-01";
DateTime datetime = new DateTime(2003, DateTime.SEPTEMBER, 10, 20, 30, 40, 0);
IAsset obj = (IAsset) m_uow.newPersistentInstance(IAsset.class);
obj.setAssetId(assetId);
obj.setCreatedDatetime(datetime);
m_uow.add(obj);
m_uow.commit();
// Now retrieve the added record & check if it was correctly added
m_uow = new UOW();
Criteria c = new Criteria();
c.setTable(IAsset.class.getName());
c.addCriteria(IAsset.ASSET_ID, assetId);
Iterator i = m_uow.query(c).iterator();
IAsset asset = (IAsset) i.next();
assertNotNull(asset.getAssetTk());
assertEquals(assetId, asset.getAssetId());
assertEquals(datetime, asset.getCreatedDatetime());
// Now delete the bugger
m_uow.delete(asset);
m_uow.commit();
} catch (Exception e) {
e.printStackTrace();
fail();
}
}
use of org.jaffa.datatypes.DateTime in project jaffa-framework by jaffa-projects.
the class AddTest method testAddDateTimeUsingProxy.
/**
* Inserts a record into ITEM using the query:
* insert into ITEM(ITEM_ID, CREATED_DATETIME) values('Z-TESTITEM-04', to_date('2003-09-10 20:30:40', 'yyyy-MM-dd hh24:mi:ss')).
* It then checks if the record was added. Finally the record is deleted
*/
public void testAddDateTimeUsingProxy() {
try {
String itemId = "Z-TESTITEM-04";
DateTime datetime = new DateTime(2003, DateTime.SEPTEMBER, 10, 20, 30, 40, 0);
IItem obj = (IItem) m_uow.newPersistentInstance(IItem.class);
obj.setItemId(itemId);
obj.setCreatedDatetime(datetime);
m_uow.add(obj);
m_uow.commit();
// Now retrieve the added record & check if it was correctly added
m_uow = new UOW();
Criteria c = new Criteria();
c.setTable(IItem.class.getName());
c.addCriteria(IItem.ITEM_ID, itemId);
Iterator i = m_uow.query(c).iterator();
IItem item = (IItem) i.next();
assertEquals(itemId, item.getItemId());
assertEquals(datetime, item.getCreatedDatetime());
// Now delete the bugger
m_uow.delete(item);
m_uow.commit();
} catch (Exception e) {
e.printStackTrace();
fail();
}
}
Aggregations