1 4 package com.inversoft.verge.mvc.controller.actionflow.config; 5 6 7 import org.apache.log4j.Logger; 8 import org.jdom.Element; 9 10 import com.inversoft.config.ConfigurationException; 11 import com.inversoft.error.ErrorList; 12 import com.inversoft.util.StringTools; 13 14 15 23 public class PresentationNodeBuilder extends BaseNodeBuilder { 24 25 28 private static final Logger logger = Logger.getLogger(PresentationNodeBuilder.class); 29 30 31 34 public PresentationNodeBuilder() { 35 } 36 37 38 51 public Node build(Namespace namespace, Element element) 52 throws ConfigurationException { 53 54 ErrorList errors = new ErrorList(); 55 BaseNode.BaseValues values = super.buildValues(element, errors); 56 57 if (StringTools.isEmpty(values.name)) { 59 errors.addError(Constants.NAME_ATTRIBUTE + " is a required attribute"); 60 logger.debug("name is null"); 61 } else if (values.name.indexOf("\\") != -1) { 62 errors.addError("Presentation node named: " + values.name + 63 " can not contain '\\' characters in the " + 64 Constants.NAME_ATTRIBUTE); 65 } else if (values.name.lastIndexOf("/") == (values.name.length() - 1)) { 66 errors.addError("Presentation node named: " + values.name + 67 " does not have a name that describes a presentation path and" + 68 " file name"); 69 } 70 71 if (!errors.isEmpty()) { 73 throw new ConfigurationException(errors); 74 } 75 76 BaseNode node = new PresentationNode(values, namespace); 77 node.setElement(element); 78 return node; 79 } 80 } 81 82 | Popular Tags |