Package org.campware.dream.om

Examples of org.campware.dream.om.Dcontract


    protected boolean getEntry(Criteria criteria, Context context)
    {
        try
        {
            Dcontract entry = (Dcontract) DcontractPeer.doSelect(criteria).get(0);
            context.put("entry", entry);
            context.put("entryitems", entry.getDcontractItems());
            return true;
        }
        catch (Exception e)
        {
            return false;
View Full Code Here


    protected boolean getNew(Context context)
    {
        try
        {
            Dcontract entry = new Dcontract();
            context.put("entry", entry);
            return true;
        }
        catch (Exception e)
        {
View Full Code Here

     * wouldn't be secure.
     */
    public void doInsert(RunData data, Context context)
        throws Exception
    {
        Dcontract entry = new Dcontract();
        data.getParameters().setProperties(entry);

        entry.setDcontractCode(getTempCode());

        entry.setIssuedDate(parseDate(data.getParameters().getString("issueddate")));
        entry.setClosedDate(parseDate(data.getParameters().getString("closeddate")));
    entry.setStartDate(parseDate(data.getParameters().getString("startdate")));
    entry.setEndDate(parseDate(data.getParameters().getString("enddate")));
        entry.setCreatedBy(data.getUser().getUserName());
        entry.setCreated(new Date());
        entry.setModifiedBy(data.getUser().getUserName());
        entry.setModified(new Date());
       
        ParameterParser pp= data.getParameters();
        Enumeration paramKeys= pp.keys();
       
      while(paramKeys.hasMoreElements()) {
          String paramName = paramKeys.nextElement().toString();
          if(paramName.startsWith("costtypeid")) { 
              String suffix=paramName.substring(10, paramName.length());
              DcontractItem entryItem= new DcontractItem();

              entryItem.setCostTypeId(pp.getInt("costtypeid" + suffix));
        entryItem.setCostFunction(pp.getInt("costfunction" + suffix));
              BigDecimal itmCostAmount= pp.getBigDecimal("costamount" + suffix);
              entryItem.setCostAmount(itmCostAmount);

              entry.addDcontractItem(entryItem);
            }
        }

        Connection conn = Transaction.begin(DcontractPeer.DATABASE_NAME);
        boolean success = false;
        try {
            entry.save(conn);
            entry.setDcontractCode(getRowCode("CO", entry.getDcontractId()));
            entry.save(conn);
            Transaction.commit(conn);
            success = true;

        } finally {
            if (!success) Transaction.safeRollback(conn);
View Full Code Here

     * into the database.
     */
    public void doUpdate(RunData data, Context context)
        throws Exception
    {
        Dcontract entry = new Dcontract();
        data.getParameters().setProperties(entry);

        entry.setIssuedDate(parseDate(data.getParameters().getString("issueddate")));
        entry.setClosedDate(parseDate(data.getParameters().getString("closeddate")));
    entry.setStartDate(parseDate(data.getParameters().getString("startdate")));
    entry.setEndDate(parseDate(data.getParameters().getString("enddate")));
        entry.setCreated(parseDateTime(data.getParameters().getString("created")));
        entry.setModifiedBy(data.getUser().getUserName());
        entry.setModified(new Date());

        ParameterParser pp= data.getParameters();
        Enumeration paramKeys= pp.keys();
       
      while(paramKeys.hasMoreElements()) {
          String paramName = paramKeys.nextElement().toString();
      if(paramName.startsWith("costtypeid")) { 
        String suffix=paramName.substring(10, paramName.length());
        DcontractItem entryItem= new DcontractItem();

        entryItem.setCostTypeId(pp.getInt("costtypeid" + suffix));
        entryItem.setCostFunction(pp.getInt("costfunction" + suffix));
        BigDecimal itmCostAmount= pp.getBigDecimal("costamount" + suffix);
        entryItem.setCostAmount(itmCostAmount);

        entry.addDcontractItem(entryItem);
      }
        }

        entry.setModified(true);
        entry.setNew(false);

        Criteria crit = new Criteria();
        crit.add(DcontractItemPeer.DCONTRACT_ID, entry.getDcontractId());

        Connection conn = Transaction.begin(DcontractPeer.DATABASE_NAME);
        boolean success = false;
        try {
            DcontractItemPeer.doDelete(crit, conn);
            entry.save(conn);
            Transaction.commit(conn);
            success = true;

        } finally {
            if (!success) Transaction.safeRollback(conn);
View Full Code Here

TOP

Related Classes of org.campware.dream.om.Dcontract

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.