The following document contains the results of PMD's CPD 3.7.
| File | Line |
|---|---|
| org/apache/shale/clay/component/chain/CreateValidatorCommand.java | 50 |
| org/apache/shale/clay/component/chain/CreateValueChangeListenerCommand.java | 49 |
log = LogFactory.getLog(CreateValueChangeListenerCommand.class);
}
/**
* <p>
* Creates a <code>ValueChangeListener</code> and assigns it to the
* <code>parent</code> attribute.
* </p>
*
* @param context common chains
* @return <code>true</code> if the chain is complete
* @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
if (clayContext == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.clayContext"));
}
UIComponent child = (UIComponent) clayContext.getChild();
if (child == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.childComponent"));
}
ComponentBean displayElement = clayContext.getDisplayElement();
if (displayElement == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.componentBean"));
}
EditableValueHolder parent = (EditableValueHolder) clayContext
.getParent();
if (parent == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.parentComponent"));
}
FacesContext facesContext = clayContext.getFacesContext();
if (facesContext == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.facesContext"));
} | |
| File | Line |
|---|---|
| org/apache/shale/clay/component/chain/PropertyConverterCommand.java | 43 |
| org/apache/shale/clay/component/chain/PropertyActionCommand.java | 42 |
public class PropertyActionCommand extends AbstractCommand implements Command {
/**
* <p>
* Common logger utility class.
* </p>
*/
private static Log log;
static {
log = LogFactory.getLog(PropertyActionCommand.class);
}
/**
* <p>
* Looks to see if the {@link AttributeBean} on the {@link ClayContext} is a
* <code>action</code> attribute. If it is, create a
* <code>MethodBinding</code> and assign it to the component returning a
* <code>true</code> value. Otherwise, return a <code>false</code>
* value. This <code>Command</code> is invoked from the
* {@link AssignPropertiesCommand} chain.
* </p>
*
* @param context common chains
* @return <code>true</code> if the chain is complete
* @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
if (clayContext == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.clayContext"));
}
AttributeBean attributeBean = clayContext.getAttribute();
if (attributeBean == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.attributeBean"));
}
ComponentBean displayElement = clayContext.getDisplayElement();
if (displayElement == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.componentBean"));
}
FacesContext facesContext = clayContext.getFacesContext();
if (facesContext == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.facesContext"));
}
if (attributeBean.getName().equals("action") && attributeBean.getValue() != null) { | |
| File | Line |
|---|---|
| org/apache/shale/clay/component/chain/AbstractCommand.java | 253 |
| org/apache/shale/clay/component/chain/AbstractCommand.java | 316 |
i = (wasReplacementMade ? buff.indexOf("@") : i);
if (i == -1) {
break replace;
}
next: while (i > -1 && i <= (buff.length() - key.length())) {
int n = -1;
indexOf: for (int s = i; s <= (buff.length() - key.length()); s++) {
for (int c = 0; c < key.length(); c++) {
char skey = Character.toLowerCase(key.charAt(c));
char tkey = Character.toLowerCase(buff.charAt(s + c));
if (skey != tkey) {
continue indexOf;
}
}
// match found
n = s;
break indexOf;
}
if (n > -1) { | |
| File | Line |
|---|---|
| org/apache/shale/clay/parser/builder/SelectManyMenuBuilder.java | 65 |
| org/apache/shale/clay/parser/builder/SelectOneMenuBuilder.java | 66 |
}
/**
* <p>
* Returns a <code>true</code> value indicating that the target JSF
* component can have children.
* </p>
*
* @return <code>true</code>
*/
public boolean isChildrenAllowed() {
return true;
}
/**
* <p>Remove any child nodes that are not "option" nodes.</p>
*
* @param node markup
* @param target child node
* @param root child's parent
*/
protected void encodeBegin(Node node, ElementBean target, ComponentBean root) {
//remove any children that are not option nodes
ArrayList delList = new ArrayList();
Iterator ci = node.getChildren().iterator();
while (ci.hasNext()) {
Node child = (Node) ci.next();
if (child.getName() == null || !child.getName().equalsIgnoreCase("option")) {
delList.add(child);
}
}
for (int i = 0; i < delList.size(); i++) {
node.getChildren().remove(delList.get(i));
}
delList.clear();
super.encodeBegin(node, target, root);
}
} | |
| File | Line |
|---|---|
| org/apache/shale/clay/component/chain/PropertyConverterCommand.java | 52 |
| org/apache/shale/clay/component/chain/PropertyValidatorCommand.java | 52 |
log = LogFactory.getLog(PropertyValidatorCommand.class);
}
/**
* <p>
* Looks to see if the {@link AttributeBean} on the {@link ClayContext} is a
* <code>validator</code> attribute. If it is, create a
* <code>MethodBinding</code> and assign it to the component returning a
* <code>true</code> value. Otherwise, return a <code>false</code>
* value.
* </p>
*
* @param context common chains
* @return <code>true</code> if the chain is complete
* @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
if (clayContext == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.clayContext"));
}
AttributeBean attributeBean = clayContext.getAttribute();
if (attributeBean == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.attributeBean"));
}
ComponentBean displayElement = clayContext.getDisplayElement();
if (displayElement == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.componentBean"));
}
FacesContext facesContext = clayContext.getFacesContext();
if (facesContext == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.facesContext"));
}
if (attributeBean.getName().equals("validator") && attributeBean.getValue() != null) { | |
| File | Line |
|---|---|
| org/apache/shale/clay/parser/builder/ElementBuilder.java | 388 |
| org/apache/shale/clay/parser/builder/Builder.java | 299 |
target.setId(id);
// look to see if this node should be bound to a component
if (target.getJsfid() != null) {
// lookup the ConfigBean that handles the id
ConfigBean config = ConfigBeanFactory.findConfig(target.getJsfid());
// disconnect component type
target.setComponentType(null);
try {
//assign the parent
config.assignParent(target);
// resolve inheritance
config.realizingInheritance(target);
} catch (RuntimeException e) {
log.error(e);
throw new RuntimeException(
messages.getMessage("parser.unresolved",
new Object[] {node.getToken(), node.getToken().getRawText()}));
}
// if the inheritance is broken, toggle back to the default
if (target.getComponentType() == null) {
target.setComponentType(this.getComponentType(node));
}
}
// HTML attributes will override the declarative component
assignAttributes(node, target);
}
/**
* <p>
* This method applies the HTML attribute overrides to the declarative
* component, an object representation of the XML configuration.
* </p>
*
* @param node markup
* @param target child config bean
*/
protected void assignAttributes(Node node, ComponentBean target) { | |
| File | Line |
|---|---|
| org/apache/shale/clay/parser/builder/ElementBuilder.java | 221 |
| org/apache/shale/clay/parser/builder/JsfDefaultBuilder.java | 165 |
&& child.getName().equals("validatorVar")) {
String name = (String) child.getAttributes().get("name");
String value = (String) child.getAttributes().get("value");
String bindingType = (String) child.getAttributes().get("bindingType");
AttributeBean attr = target.getAttribute(name);
if (attr != null) {
createAttribute(attr, value, target);
} else {
attr = new AttributeBean();
attr.setName(name);
attr.setValue(value);
attr.setBindingType(bindingType);
target.addAttribute(attr);
}
}
}
}
/**
* @inheritDoc
* @param node markup
* @param target child config bean
*/
protected void addValidator(Node node, ElementBean target) { | |
| File | Line |
|---|---|
| org/apache/shale/clay/component/chain/AssignActionListenersCommand.java | 52 |
| org/apache/shale/clay/component/chain/AssignValidatorsCommand.java | 52 |
log = LogFactory.getLog(AssignValueChangeListenersCommand.class);
}
/**
* <p>
* Uses the <code>Globals.ADD_VALUE_CHANGE_LISTENER_COMMAND_NAME</code>
* command to create a <code>ValueChangeListener</code>.</p>
*
* @param context common chains
* @return <code>true</code> if the chain is complete
* @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
if (clayContext == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.clayContext"));
}
UIComponent child = (UIComponent) clayContext.getChild();
if (child == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.childComponent"));
}
ComponentBean displayElement = clayContext.getDisplayElement();
if (displayElement == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.componentBean"));
}
if (displayElement.getValueChangeListeners().size() > 0) { | |
| File | Line |
|---|---|
| org/apache/shale/clay/parser/Parser.java | 571 |
| org/apache/shale/clay/parser/Parser.java | 587 |
public static final Rule[] BEGIN_CDATA_RULES = {new Rule('<', true, 0, true),
new Rule('!', true, 1, true),
new Rule('[', true, 2, true),
new Rule('C', true, 3, true),
new Rule('D', true, 4, true),
new Rule('A', true, 5, true),
new Rule('T', true, 6, true),
new Rule('A', true, 7, true),
new Rule('[', true, 8, true)}; | |
| File | Line |
|---|---|
| org/apache/shale/clay/component/chain/CreateActionListenerCommand.java | 52 |
| org/apache/shale/clay/component/chain/AssignValueChangeListenersCommand.java | 54 |
log = LogFactory.getLog(CreateConverterCommand.class);
}
/**
* <p>
* Creates a object instance realizing the {@link Converter} interface
* assigning to the <code>parent</code>. The <code>parent</code> must
* implement the {@link ValueHolder} interface.
* </p>
*
* @param context commons chains
* @return <code>true</code> if chain is done
* @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
if (clayContext == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.clayContext"));
}
UIComponent child = (UIComponent) clayContext.getChild();
if (child == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.childComponent"));
}
ComponentBean displayElement = clayContext.getDisplayElement();
if (displayElement == null) {
throw new NullPointerException(getMessages()
.getMessage("clay.null.componentBean"));
} | |
| File | Line |
|---|---|
| org/apache/shale/clay/parser/builder/VerbatimBuilder.java | 68 |
| org/apache/shale/clay/parser/builder/IgnoreBuilder.java | 66 |
attr.setBindingType(AttributeBean.BINDING_TYPE_NONE);
attr.setName("value");
attr.setValue(value.toString());
target.addAttribute(attr);
attr = new AttributeBean();
attr.setBindingType(AttributeBean.BINDING_TYPE_NONE);
attr.setName("escape");
attr.setValue(Boolean.FALSE.toString());
target.addAttribute(attr);
attr = new AttributeBean();
attr.setBindingType(AttributeBean.BINDING_TYPE_NONE);
attr.setName("isTransient");
attr.setValue(Boolean.TRUE.toString());
target.addAttribute(attr);
}
/**
* <p>Recursively traverses the children of the HTML
* {@link org.apache.shale.clay.parser.Node} concatenating
* the raw text of each {@link org.apache.shale.clay.parser.Token}
* into the <code>commentBody</code>. Ending nodes are not kept
* with the parser. If a start node is found that is not self
* terminated, a matching ending node is created.</p>
*
* @param node markup
* @param commentBody concatenated raw text of all the children
*/
protected void captureComment(Node node, StringBuffer commentBody) { | |
| File | Line |
|---|---|
| org/apache/shale/clay/component/chain/PropertyConverterCommand.java | 52 |
| org/apache/shale/clay/component/chain/PropertyValueChangeListenerCommand.java | 52 |
log = LogFactory.getLog(PropertyValueChangeListenerCommand.class);
}
/**
* <p>
* Looks to see if the {@link AttributeBean} on the {@link ClayContext} is a
* <code>valueChangeListener</code> attribute. If it is, create a
* <code>methodBinding</code> and assign it to the component returning a
* <code>true</code> value. Otherwise, return a <code>false</code>
* value.
* </p>
*
* @param context common chains
* @return <code>true</code> if the chain is complete
* @exception Exception propagated up to the top of the chain
*/
public boolean execute(Context context) throws Exception {
boolean isFinal = false;
ClayContext clayContext = (ClayContext) context;
if (clayContext == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.clayContext"));
}
AttributeBean attributeBean = clayContext.getAttribute();
if (attributeBean == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.attributeBean"));
}
ComponentBean displayElement = clayContext.getDisplayElement();
if (displayElement == null) {
throw new NullPointerException(getMessages().getMessage("clay.null.childComponent")); | |