1 23 package org.infoglue.cms.applications.workflowtool.function; 24 25 import org.infoglue.cms.controllers.kernel.impl.simple.ContentTypeDefinitionController; 26 import org.infoglue.cms.entities.management.ContentTypeDefinitionVO; 27 28 import com.opensymphony.workflow.WorkflowException; 29 30 public class ContentTypeDefinitionProvider extends InfoglueFunction 31 { 32 33 36 public static final String CONTENT_TYPE_DEFINITION_PARAMETER = "contentTypeDefinition"; 37 38 41 private static final String NAME_ARGUMENT = "contentTypeDefinitionName"; 42 43 46 private String name; 47 48 51 public ContentTypeDefinitionProvider() 52 { 53 super(); 54 } 55 56 59 protected void execute() throws WorkflowException 60 { 61 try 62 { 63 final ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithName(name, getDatabase()); 64 if(contentTypeDefinitionVO == null) 65 { 66 throwException(name + " is not a definied content type."); 67 } 68 setParameter(CONTENT_TYPE_DEFINITION_PARAMETER, contentTypeDefinitionVO); 69 } 70 catch(Exception e) 71 { 72 throwException(e); 73 } 74 } 75 76 82 protected void initialize() throws WorkflowException 83 { 84 super.initialize(); 85 this.name = getArgument(NAME_ARGUMENT); 86 } 87 } 88 | Popular Tags |