/** * Check for a naming conflict e.g. when pasting files from clipboard * * @param files * @return */ public HashMap<File, SoapClientObject> checkNamingConflict(List<File> files) { HashMap<File, SoapClientObject> conflict = new HashMap<File, SoapClientObject>(); for (File file : files) { for (SoapClientObject obj : getObjects()) { if (file.getName().equalsIgnoreCase(obj.getTitle()) && (obj.getType().equals("file") || obj.getType().equals("fold") || obj.getType().equals("cat")) && obj.isWritable()) { logger.info("File names are equal!"); conflict.put(file, obj); } } } return conflict; }
public List<File> checkNamingConflicts(List<File> files) { ArrayList<File> conflicted = new ArrayList<File>(); for (File file : files) { for (SoapClientObject obj : getObjects()) { if (file.getName().equalsIgnoreCase(obj.getTitle()) && (obj.getType().equals("file") || obj.getType().equals("fold") || obj.getType().equals("cat")) && obj.isWritable()) { logger.info("File names are equal!"); conflicted.add(file); } } } return conflicted; }
/** * Get list of path elements * * @param includeLeaf * @return */ public List<SoapClientObjectReferencePath> getFirstPath(boolean includeLeaf) { List<SoapClientObjectReferencePath> pathList = new ArrayList<SoapClientObjectReferencePath>(); // choose first object for (SoapClientObject obj : getObjects()) { // choose first reference for (SoapClientObjectReference ref : obj.getReferences()) { pathList = ref.getPathElements(); break; } break; } // Append a leaf the leaf node as path element if desired if (includeLeaf) { for (SoapClientObject obj : getObjects()) { for (SoapClientObjectReference ref : obj.getReferences()) { SoapClientObjectReferencePath leaf = new SoapClientObjectReferencePath(); if (pathList.size() < 1) { leaf.setTitle("Repository"); } else { leaf.setTitle(obj.getTitle()); } leaf.setRefId(ref.getRefId()); leaf.setType(obj.getType()); pathList.add(leaf); break; } break; } } return pathList; }