Package org.campware.dream.om

Examples of org.campware.dream.om.Distributor


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


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

      DinboxEvent entry = new DinboxEvent();

      Criteria criteria = new Criteria();
      criteria.add(DistributorPeer.EMAIL, (Object)email, Criteria.EQUAL);
      if (DistributorPeer.doSelect(criteria).size()>0){
        Distributor myDistrib = (Distributor) DistributorPeer.doSelect(criteria).get(0);
        entry.setDistributorId(myDistrib.getDistributorId());
      }else{
        if (name!=null){
          entry.setBody("From: " + name + " " + email + "\n\n" + content);
        }else{
          entry.setBody("From: " + email + "\n\n" + content);
View Full Code Here

    Iterator i = receivers.iterator();
    VelocityTool velTool= new VelocityTool(context);

    while (i.hasNext())
    {
      Distributor dist = (Distributor) i.next();

      String sEmailAddress=dist.getEmail();

      if (sEmailAddress.length()>1){
      VelocityHtmlEmail ve = new VelocityHtmlEmail(data);
      ve.setCharset("UTF-8");
      ve.addTo( sEmailAddress, "");
      ve.setFrom(TurbineResources.getString("mail.smtp.from"), TurbineResources.getString("mail.smtp.from.name"));
      ve.setSubject(emailEntry.getSubject());
      context.put("name", dist.getDistributorName1());
      context.put("display", dist.getDistributorDisplay());
      context.put("dear", dist.getDear());
      context.put("email", dist.getEmail());
      context.put("custom1", dist.getCustom1());
      context.put("custom2", dist.getCustom2());
      context.put("custom3", dist.getCustom3());
      context.put("custom4", dist.getCustom4());
      context.put("custom5", dist.getCustom5());
      context.put("custom6", dist.getCustom6());
      context.put("emailbody", velTool.evaluate(emailEntry.getBody()));
      ve.setTextTemplate("screens/SendEmail.vm");
      ve.send();
      }
    }
View Full Code Here

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


        String myCode=data.getParameters().getString("distributorcode");

        entry.setCreatedBy(data.getUser().getUserName());
        entry.setCreated(new Date());
        entry.setModifiedBy(data.getUser().getUserName());
        entry.setModified(new Date());
       

        if (myCode.equals("AUTO"))
        {
            entry.setDistributorCode(getTempCode());

            Connection conn = Transaction.begin(DistributorPeer.DATABASE_NAME);
            boolean success = false;
            try {
                entry.save(conn);
                entry.setDistributorCode(getRowCode("DI", entry.getDistributorId()));
                entry.save(conn);
                Transaction.commit(conn);
                success = true;
   
            } finally {
                if (!success) Transaction.safeRollback(conn);
            }
        }
        else
        {
            entry.save();
        }

    }
View Full Code Here

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

        String myCode=data.getParameters().getString("distributorcode");
        if (myCode.equals("AUTO"))
        {
            entry.setDistributorCode(getRowCode("DI", entry.getDistributorId()));
        }

        entry.setCreated(parseDateTime(data.getParameters().getString("created")));
        entry.setModifiedBy(data.getUser().getUserName());
        entry.setModified(new Date());

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

    }
View Full Code Here

TOP

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

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.