1 23 24 package org.enhydra.xml.xmlc.metadata; 25 26 import org.enhydra.xml.xmlc.XMLCException; 27 import org.w3c.dom.Document ; 28 29 32 public abstract class URLEdit extends ElementEdit { 33 36 private static final String EDIT_ATTRS_ATTR = "editAttrs"; 37 38 41 private String [] editAttrs; 42 43 46 protected URLEdit(Document ownerDoc, 47 String tagName) { 48 super(ownerDoc, tagName); 49 } 50 51 54 public String [] getEditAttrs() { 55 return getStringArrayAttribute(EDIT_ATTRS_ATTR); 56 } 57 58 61 public void setEditAttrs(String [] values) { 62 setRemoveStringArrayAttribute(EDIT_ATTRS_ATTR, values); 63 } 64 65 68 public void addEditAttrs(String value) { 69 addStringArrayAttribute(EDIT_ATTRS_ATTR, value); 70 } 71 72 77 public boolean matchesEditAttrConstraints(String attrName, 78 boolean ignoreCase) { 79 if (editAttrs == null) { 80 editAttrs = getEditAttrs(); 81 } 82 if (editAttrs.length == 0) { 83 return true; 84 } 85 if (ignoreCase) { 86 for (int idx = 0; idx < editAttrs.length; idx++) { 87 if (attrName.equalsIgnoreCase(editAttrs[idx])) { 88 return true; 89 } 90 } 91 } else { 92 for (int idx = 0; idx < editAttrs.length; idx++) { 93 if (attrName.equals(editAttrs[idx])) { 94 return true; 95 } 96 } 97 } 98 return false; 99 } 100 101 106 protected void completeModifications() throws XMLCException { 107 super.completeModifications(); 108 editAttrs = null; 109 } 110 } 111 | Popular Tags |