/** * Set properties in studies "prop" file for the given SQ node. A typical location: <br> * <CODE> * vnmrsys/studies/exp2/tmpstudy/info/n002/prop * </CODE> * * @param cursqexp Experiment directory for the SQ. * @param id The ID of the SQ node. * @param node The node to write about. */ private void writePropFile(String cursqexp, String id, SQNode node) { // The attributes that are written into the "props" file // (e.g., studies/exp2/tmpstudy/info/n002/prop), in the order // they should appear. Order is important, because macros // may read the value of a particular line number without checking // the key. // In xmaction it is noted: // "$id=sqval[1] $type=sqval[2] $status=sqval[3] - fixed position" // (ID is added to the front of the list after reading the prop file.) final String[] propAttributes = { ATTR_TYPE, ATTR_STATUS, ATTR_LOCK, ATTR_TITLE, ATTR_EXP, ATTR_TIME, ATTR_MACRO, ATTR_DATA, }; String path = cursqexp + "/tmpstudy/info/" + id; File filePath = new File(path, "/prop"); PrintWriter out = null; try { new File(path).mkdirs(); out = new PrintWriter(filePath); for (String name : propAttributes) { out.println(name + " " + node.getAttr(name)); } } catch (FileNotFoundException e) { Messages.postDebug("Could not write file " + filePath.getPath()); } finally { try { out.close(); } catch (Exception e) { } } }
private boolean updateNodeInSQ(String id, SQNode srcNode, List<String> changed) { boolean ok = false; ProtocolBuilder mgr = m_studyQueue.getMgr(); VElement elem = mgr.getElement(id); if (elem != null) { for (String attr : changed) { String value = srcNode.getAttr(attr); mgr.setAttribute(elem, attr, value); } ok = true; } return ok; }