private void removeExcludes() { if (!isNew()) { resourceElement.removeChild("excludes"); } excludes = null; }
private void removeIncludes() { if (!isNew()) { resourceElement.removeChild("includes"); } includes = null; }
public Resource setFiltering(boolean filtering) { this.filtering = filtering; if (!isNew()) { if (resourceElement.hasSingleChild("filtering")) { resourceElement.getSingleChild("filtering").setText(Boolean.toString(filtering)); } else { resourceElement.insertChild( createElement("filtering", Boolean.toString(filtering)), after("targetPath").or(inTheBegin())); } } return this; }
private void setExcludes0(Collection<String> excludes) { this.excludes = new ArrayList<>(excludes); if (isNew()) return; // if excludes element exists we should replace it children // with new set of excludes, otherwise create element for it if (resourceElement.hasSingleChild("excludes")) { final Element excludesElement = resourceElement.getSingleChild("excludes"); // remove all exclusions from element for (Element exclusion : excludesElement.getChildren()) { exclusion.remove(); } // append each new exclusion to "excludes" element for (String exclusion : excludes) { excludesElement.appendChild(createElement("exclude", exclusion)); } } else { resourceElement.appendChild(newXMLElement(this.excludes, "excludes", "exclude")); } }
/** Specifies the directory structure to place the set of resources from a build */ public Resource setTargetPath(String targetPath) { this.targetPath = targetPath; if (!isNew()) { if (targetPath == null) { resourceElement.removeChild("targetPath"); } else if (resourceElement.hasChild("targetPath")) { resourceElement.getSingleChild("targetPath").setText(targetPath); } else { resourceElement.insertChild(createElement("targetPath", targetPath), inTheBegin()); } } return this; }
private void setIncludes0(Collection<String> includes) { this.includes = new ArrayList<>(includes); if (isNew()) return; // if includes element exists we should replace it children // with new set of includes, otherwise create element for it if (resourceElement.hasSingleChild("includes")) { final Element includesElement = resourceElement.getSingleChild("includes"); // remove all includes from element for (Element inclusion : includesElement.getChildren()) { inclusion.remove(); } // append each new inclusion to "includes" element for (String inclusion : includes) { includesElement.appendChild(createElement("include", inclusion)); } } else { resourceElement.insertChild( newXMLElement(this.includes, "includes", "include"), before("excludes").or(inTheEnd())); } }
/** Specifies directory where the resource are to be found */ public Resource setDirectory(String directory) { this.directory = directory; if (!isNew()) { if (directory == null) { resourceElement.removeChild("directory"); } else if (resourceElement.hasSingleChild("directory")) { resourceElement.getSingleChild("directory").setText(directory); } else { resourceElement.insertChild( createElement("directory", directory), afterAnyOf("targetPath", "filtering").or(inTheBegin())); } } return this; }