@Override public List<CopyToEnvironmentItem> processMandatoryDependencies( CopyToEnvironmentItem item, List<String> pathsToDeploy, Set<String> missingDependenciesPaths) throws DeploymentException { List<CopyToEnvironmentItem> mandatoryDependencies = new ArrayList<CopyToEnvironmentItem>(); String site = item.getSite(); String path = item.getPath(); if (item.getAction() == CopyToEnvironmentItem.Action.NEW || item.getAction() == CopyToEnvironmentItem.Action.MOVE) { String helpPath = path.replace("/" + _indexFile, ""); int idx = helpPath.lastIndexOf("/"); String parentPath = helpPath.substring(0, idx) + "/" + _indexFile; if (_contentRepository.isNew(site, parentPath) || _contentRepository.isRenamed(site, parentPath)) { String parentFullPath = _contentRepository.getFullPath(site, parentPath); if (!missingDependenciesPaths.contains(parentFullPath) && !pathsToDeploy.contains(parentFullPath)) { try { _deploymentDAL.cancelWorkflow(site, parentPath); } catch (DeploymentDALException e) { LOGGER.error( "Error while canceling workflow for path {0}, site {1}", e, site, parentPath); } missingDependenciesPaths.add(parentFullPath); CopyToEnvironmentItem parentItem = createMissingItem(site, parentPath, item); processItem(parentItem); mandatoryDependencies.add(parentItem); mandatoryDependencies.addAll( processMandatoryDependencies(parentItem, pathsToDeploy, missingDependenciesPaths)); } } List<String> dependentPaths = _contentRepository.getDependentPaths(site, path); for (String dependentPath : dependentPaths) { if (_contentRepository.isNew(site, dependentPath) || _contentRepository.isRenamed(site, dependentPath)) { String dependentFullPath = _contentRepository.getFullPath(site, dependentPath); if (!missingDependenciesPaths.contains(dependentFullPath) && !pathsToDeploy.contains(dependentFullPath)) { try { _deploymentDAL.cancelWorkflow(site, dependentPath); } catch (DeploymentDALException e) { LOGGER.error( "Error while canceling workflow for path {0}, site {1}", e, site, dependentPath); } missingDependenciesPaths.add(dependentFullPath); CopyToEnvironmentItem dependentItem = createMissingItem(site, dependentPath, item); processItem(dependentItem); mandatoryDependencies.add(dependentItem); mandatoryDependencies.addAll( processMandatoryDependencies( dependentItem, pathsToDeploy, missingDependenciesPaths)); } } } } return mandatoryDependencies; }
/** * Returns true if a given JID belongs to a known Clearspace component domain. * * @param address Address to check. * @return True if the specified address is a Clearspace component. */ public boolean isFromClearspace(JID address) { return clearspaces.contains(address.getDomain()); }