public BitBunkerObject createBitBunkerObject(Node node) throws SystemException { BitBunkerObject item = null; if (node.getNodeName().equals("file")) { item = createFile(node); } else if (node.getNodeName().equals("folder")) { item = createFolder(node); } else { throw new SystemException(); } item.setClient(this.getClient()); return item; }
public List<BitBunkerObject> createList(Node node, String path) throws BitBunkerException { try { List<BitBunkerObject> items = new ArrayList<BitBunkerObject>(); NodeList results = Utils.findChild(Utils.findChild(node, "list"), "objects").getChildNodes(); for (int i = 0; i < results.getLength(); i++) { Node objectNode = results.item(i); if (objectNode.getNodeType() == Node.ELEMENT_NODE) { BitBunkerObject item = createBitBunkerObject(objectNode); item.setPath(String.format("%s%s", path, item.getName())); items.add(item); } } return items; } catch (Exception ex) { throw new XmlException(ex); } }
private BitBunkerObject fillBitBunkerObject(Node node, BitBunkerObject item) { item.setName(new java.io.File(Utils.findNodeText(Utils.findChild(node, "name"))).getName()); item.setSize(Utils.findNodeLong(Utils.findChild(node, "size"))); return item; }