Package org.jugile.util

Examples of org.jugile.util.Time


 
  public static void createDomain(Domain d) {
    Person p1 = d.createPerson();
    p1.setName("Jukka");
    p1.setAge(10);
    p1.setTs(new Time("11.11.2011"));
    pid1 = p1.id();
   
    Family f1 = d.createFamily().setName("f1");
    f1.setType(FamilyType.BIG);
    fid1 = f1.id();
View Full Code Here


   
    assertTrue(d.getPersons().size() > 2);
    Person p1 = d.getPerson(pid1);
    assertEquals("Jukka",p1.getName());
    assertEquals(10,p1.getAge());
    assertEquals(new Time("11.11.2011"),p1.getTs());

    Family f1 = p1.getFamily();
    assertNotNull(f1);
    assertEquals("f1", f1.getName());
    assertEquals(FamilyType.BIG, f1.getType());
View Full Code Here

    assertEquals(0,d.getPersons().size());
   
    Person p = d.createPerson();
    p.setName("Jukka");
    p.setAge(10);
    p.setTs(new Time("11.11.2011"));
    assertTrue(d.getCommitSize() > 0);
    assertEquals(1,d.getPersons().size());
    d.commit();
    assertTrue(d.getCommitSize() == 0);

    assertEquals(1,d.getPersons().size());
    Person p1 = d.getPerson(p.id());
    assertEquals("Jukka",p1.getName());
    assertEquals(10,p1.getAge());
    assertEquals(new Time("11.11.2011"),p1.getTs());
    d.rollback();
  }
View Full Code Here

  public void testDelta() {
    Domain d = Domain.getDomain();
    Person p1 = d.createPerson();
    p1.setName("Jukka");
    p1.setAge(40);
    p1.setTs(new Time("11.11.2011"));
   
    Family f1 = d.createFamily();
    f1.setName("Rahkonen");
    p1.setFamily(f1);
   
View Full Code Here

public class ExamplesTest extends JugileTestCase {
 
  public void testDemo1() {
   
    Domain d = Domain.getDomain();
    Person p1 = d.createPerson().setName("Bart Simpson").setAge(12).setTs(new Time("21.06.1971"));
    long id = p1.id();
    d.commit();
   
    p1 = d.getPerson(id);
    assertNotNull(p1);
View Full Code Here

    // skip id(0)
    long v = parseLongSafe(values.get(1)); // verify version - don't update older version
    if (version > 0) if (v < version) return;
    version = v;
    if ("-".equals(values.get(2))) _modified = null;
    else _modified = new Time(values.get(2),TSFORMAT)
   
    for (int i = 3; i < flds.size(); i++) {
      String val = null;
      try {
        val = values.get(i);
      } catch (Exception e) {
        log.error("ERROR: " + e);
        log.error("  " + join(flds) + " = " + join(values));
      }
      //log.debug("parse " + id() +": "+ flds.get(i) + "=" + val);
      if (empty(val)) continue;
      String fld = flds.get(i);
      Field f = fld(fld);
      if (val.equals(""+NULLCHAR)) val = null;
      Object o = null;
      if (f.getAnnotation(Fld.class) != null) {
        if (val != null) {
          if (f.getType() == Time.class) {
            o = new Time(val,TSFORMAT);
          } else if (f.getType() == Money.class) {
            o = new Money(parseIntSafe(val));
          } else if (f.getType() == String.class) {
            if (val.equals(""+NULLCHAR+NULLCHAR)) val = ""+NULLCHAR;
            o = val;
View Full Code Here

   }
   
  private Time _modified;
  public Time getModifiedTime() { return _modified; }
  protected void _setState(DomainData dd, BoInfo bi, List<Object> row) throws Exception {
    _modified = row.get(1)==null?null:new Time((java.util.Date)row.get(1));
    //String host = (String)row.get(2);
    version = (Integer)row.get(3);
    _setFlds(dd,bi,row,countSelectHeaderFlds());
  }
View Full Code Here

      List<List> rows = c.select();
      if (rows.size() == 1) {
        List row = rows.get(0);
        // set state
        Bo o = origin;
        o._modified = row.get(1)==null?null:new Time((java.util.Date)row.get(1));
        //String host = (String)row.get(2);
        o.version = (Integer)row.get(3);
        o._setFlds(dd,bi(),row,countSelectHeaderFlds());
        // copy fields to copy
        o.copy(bi(),this);
View Full Code Here

 
  protected void _setFlds(DomainData dd, BoInfo bi, List row, int idx) throws Exception {
    for (Field f : bi.flds) {
      Object val = row.get(idx++);
      if (f.getType() == Time.class) {
        val = val==null?null:new Time((java.util.Date)val);       
      } else if (f.getType() == double.class) {
        val = val==null?0.0:((BigDecimal)val).doubleValue()
      } else if (f.getType() == Money.class) {
        val = val==null?null:new Money((Integer)val)
      } else if (f.getType() == boolean.class) {
View Full Code Here

      for (Long id : ids) { c.param(id); }
      for (List<Object> row : c.select()) {
        String msg = (String)row.get(0);
        String nodeid = (String)row.get(1);
        long id = (Integer)row.get(2);
        Time ts = new Time((java.util.Date)row.get(3));
        Msg m = new Msg(msg);
        m.id = id;
        m.ts = ts;
        m.nodeid = nodeid;
        msgs.add(m);
View Full Code Here

TOP

Related Classes of org.jugile.util.Time

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.