1 package org.infoglue.cms.applications.common.actions; 2 3 import java.util.ArrayList ; 4 import java.util.Collection ; 5 6 import org.infoglue.cms.entities.kernel.Persistent; 7 import org.infoglue.cms.exception.ConstraintException; 8 9 15 public abstract class ModelAction extends InfoGlueAbstractAction 16 { 17 private Persistent model = createModel(); 18 private Collection models = new ArrayList (); 19 20 public Persistent getModel() 21 { 22 return model; 23 } 24 25 protected void setModel(Persistent o) 26 { 27 model = (o == null) ? createModel() : o; 28 } 29 30 public Collection getModels() 31 { 32 return models; 33 } 34 35 protected void setModels(Collection c) 36 { 37 models = (c == null) ? new ArrayList () : c; 38 } 39 40 44 protected abstract Persistent createModel(); 45 46 50 protected void validateModel() throws ConstraintException 51 { 52 getModel().validate().throwIfNotEmpty(); 53 } 54 55 58 protected String doExecute() throws Exception 59 { 60 return SUCCESS; 61 } 62 63 68 } 69 | Popular Tags |