public void execute( PluginNode pNode, DMConnection pCon, IDfPersistentObject[] pTargets, ALogger pLogger) throws Exception { for (int t = 0; t < pTargets.length; t++) { IDfSysObject obj = (IDfSysObject) pTargets[t]; String id = obj.getObjectId().toString(); String dql = "select f.dos_extension,f.name " + "FROM dm_sysobject (ALL) s, dmr_content r, dm_store t, dm_format f " + "WHERE r_object_id = ID('" + id + "') " + "AND ANY (parent_id=ID('" + id + "') AND page = 0) " + "AND r.storage_id=t.r_object_id " + "AND f.r_object_id=r.format"; IDfQuery query = pCon.createQuery(dql); IDfCollection res = query.execute(pCon.getSession(), IDfQuery.READ_QUERY); while (res.next()) { try { String name = res.getString("name"); pLogger.out.println(">>> " + name + "@" + ObjectTool.getName(obj)); String ext = res.getString("dos_extension"); ByteArrayInputStream stream = obj.getContentEx2(name, 0, null); String content = AFile.readFile(stream); stream.close(); for (Enumeration i = properties.keys(); i.hasMoreElements(); ) { String key = (String) i.nextElement(); content = content.replaceAll(key, properties.getProperty(key)); } content = AFile.readFile(fileHeader) + content + AFile.readFile(fileFooter); File f = new File( tmpDir, obj.getObjectName() + "_" + obj.getString("language_code") + "_" + name + "." + ext); pLogger.out.println("--- WRITE: " + f.getAbsolutePath()); AFile.writeFile(f, content); } catch (Exception e) { pLogger.out.println(e.toString()); } } res.close(); } }
protected void apiObjectHotSelected0( DMConnection con, IDfPersistentObject[] parents2, IDfPersistentObject[] obj) throws Exception { if (!TREE_HOT_SELECT) return; if (obj == null || obj.length != 1) return; String path = ObjectTool.getPath(obj[0]); boolean flag = true; DefaultMutableTreeNode docbasetreenode = tree.getRootNode(); Vector vector = new Vector(); vector.addElement(tree.getRootNode()); for (StringTokenizer stringtokenizer = new StringTokenizer(path, "/"); stringtokenizer.hasMoreElements(); ) { String s1 = stringtokenizer.nextToken(); DefaultMutableTreeNode docbasetreenode1 = null; for (Enumeration enumeration = docbasetreenode.children(); enumeration.hasMoreElements(); ) { DefaultMutableTreeNode docbasetreenode2 = (DefaultMutableTreeNode) enumeration.nextElement(); Object uo = docbasetreenode2.getUserObject(); if (uo instanceof ContentTree.NodeValue) { if (stringtokenizer.hasMoreTokens()) { if (((ContentTree.NodeValue) uo).getName().equals(s1)) { docbasetreenode1 = docbasetreenode2; break; } } else { // find last element by id if (((ContentTree.NodeValue) uo).getId().equals(obj[0].getObjectId())) { docbasetreenode1 = docbasetreenode2; break; } } } } if (docbasetreenode1 != null) { tree.loadChilds(docbasetreenode1, false); vector.addElement(docbasetreenode1); docbasetreenode = docbasetreenode1; } else if (!stringtokenizer.hasMoreTokens()) flag = false; } TreePath treePath = vectorToPath(vector); tree.getTree().expandPath(treePath); tree.getTree().setSelectionPath(treePath); tree.getTree().scrollPathToVisible(treePath); }