Package org.jbpm.pvm.internal.cal

Examples of org.jbpm.pvm.internal.cal.Duration$HourSetter


  public void setDueDateDescription(String dueDateDescription) {

    ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
    dueDateDescription = (String) scriptManager.evaluateExpression(dueDateDescription, null);
   
    Duration duration = new Duration(dueDateDescription);
    Date now = Clock.getCurrentTime();
   
    if ( duration.isBusinessTime()
         || duration.getMonths()>0
         || duration.getYears()>0
       ) {
      Environment environment = Environment.getCurrent();
      if (environment==null) {
        throw new JbpmException("no environment to get business calendar for calculating duedate "+dueDateDescription);
      }
      BusinessCalendar businessCalendar = environment.get(BusinessCalendar.class);
      dueDate = businessCalendar.add(now, duration);

    } else {
      long millis = duration.getMillis() +
                    1000*( duration.getSeconds() +
                           60*( duration.getMinutes() +
                                60*( duration.getHours() +
                                     24*( duration.getDays() +
                                          7*duration.getWeeks()))));
      dueDate = new Date(now.getTime() + millis);
    }
  }
View Full Code Here

TOP

Related Classes of org.jbpm.pvm.internal.cal.Duration$HourSetter

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.