Search in sources :

Example 46 with DateTime

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);
}
Also used : DateTime(org.jaffa.datatypes.DateTime)

Example 47 with DateTime

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;
}
Also used : DateTime(org.jaffa.datatypes.DateTime)

Example 48 with DateTime

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);
    }
}
Also used : DateTimeFieldMetaData(org.jaffa.metadata.DateTimeFieldMetaData) DateTime(org.jaffa.datatypes.DateTime) Date(java.util.Date)

Example 49 with DateTime

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();
    }
}
Also used : Iterator(java.util.Iterator) AtomicCriteria(org.jaffa.persistence.AtomicCriteria) Criteria(org.jaffa.persistence.Criteria) UOW(org.jaffa.persistence.UOW) DateTime(org.jaffa.datatypes.DateTime)

Example 50 with DateTime

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();
    }
}
Also used : Iterator(java.util.Iterator) AtomicCriteria(org.jaffa.persistence.AtomicCriteria) Criteria(org.jaffa.persistence.Criteria) UOW(org.jaffa.persistence.UOW) DateTime(org.jaffa.datatypes.DateTime)

Aggregations

DateTime (org.jaffa.datatypes.DateTime)74 Criteria (org.jaffa.persistence.Criteria)16 UOW (org.jaffa.persistence.UOW)11 AtomicCriteria (org.jaffa.persistence.AtomicCriteria)9 PreparedStatement (java.sql.PreparedStatement)8 ValidationException (org.jaffa.datatypes.ValidationException)8 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)8 Iterator (java.util.Iterator)7 Map (java.util.Map)5 Date (java.util.Date)4 FrameworkException (org.jaffa.exceptions.FrameworkException)4 LinkedHashMap (java.util.LinkedHashMap)3 JMSException (javax.jms.JMSException)3 MarshallException (org.directwebremoting.extend.MarshallException)3 CheckBoxModel (org.jaffa.presentation.portlet.widgets.model.CheckBoxModel)3 DateTimeModel (org.jaffa.presentation.portlet.widgets.model.DateTimeModel)3 DropDownModel (org.jaffa.presentation.portlet.widgets.model.DropDownModel)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Enumeration (java.util.Enumeration)2 LinkedList (java.util.LinkedList)2