/** * Kicks off the entire search and create file process based on the package.properties file. * * @param dirToPlaceXmlFile * <p>Responsible for reading all properties in package.properties and parsing each delimited * property before passing off for further parsing. */ private void buildXmlFile(String dirToPlaceXmlFile) { ArrayList<String> properties = PropertyReader.getDestructiveProperties(); for (String property : properties) { // get directory name String dirName = PropertyReader.getDestructiveProperty( property, PropertyReader.DestructivePropertyTypes.Directory); File dirMetadata = new File(orgTo.getSourceFolder().getPath() + File.separator + dirName); if (!dirMetadata.exists()) { continue; } // get metadata type String metadataType = PropertyReader.getDestructiveProperty( property, PropertyReader.DestructivePropertyTypes.MetadataType); if (metadataType == null) { continue; } // get search term final String searchTerm = PropertyReader.getDestructiveProperty( property, PropertyReader.DestructivePropertyTypes.SearchTerm); if (searchTerm == null) { continue; } // get package name final String xmlName = PropertyReader.getDestructiveProperty( property, PropertyReader.DestructivePropertyTypes.XmlName); // get some work done String deployToPath = orgTo.getSourceFolder().getPath() + File.separator + dirName; if (searchTerm.equals(PropertyReader.FILESEACH)) { // check if dirDeployToSrc has files that we need to destroy walkAndDestroy( deployToPath, deployToPath, orgFrom.getSourceFolder().getPath(), metadataType, dirName, metadataType); } else { seekAndDestroy( deployToPath, deployToPath, orgFrom.getSourceFolder().getPath(), xmlName, dirName, searchTerm, metadataType); } } }
/** * @param dir * <p>Calls the packager, passing the dir path to where the packager should create the * destructiveChanges.xml file. */ public void createDestructiveChangesXmlFile(String dir) { packager.createFile(dir, PropertyReader.getSystemProperty("sf.destruct.file.name"), true); }