1 23 package org.infoglue.cms.applications.workflowtool.function.defaultvalue; 24 25 import java.util.Date ; 26 27 import org.infoglue.cms.applications.common.VisualFormatter; 28 29 import com.opensymphony.workflow.WorkflowException; 30 31 34 public abstract class DatePopulator extends Populator 35 { 36 39 private static final String DATETIME_PATTERN = "yyyy-MM-dd HH:mm"; 40 41 42 43 46 protected DatePopulator() 47 { 48 super(); 49 } 50 51 54 protected void populate() throws WorkflowException 55 { 56 } 57 58 61 protected void populate(final String name) throws WorkflowException { 62 populate(name, new Date ()); 63 } 64 65 68 protected void populate(final String name, final String value) throws WorkflowException 69 { 70 populate(name, new VisualFormatter().parseDate(value, DATETIME_PATTERN)); 71 } 72 73 76 protected void populate(final String name, final Date value) throws WorkflowException 77 { 78 doPopulate(name, new VisualFormatter().formatDate(value, DATETIME_PATTERN)); 79 } 80 } 81 | Popular Tags |