/** * Get the parm edit set if any from the plf and process each edit command removing any that fail * from the set so that the set is self cleaning. * * @throws Exception */ static void applyAndUpdateParmEditSet(Document plf, Document ilf, IntegrationResult result) { Element pSet = null; try { pSet = getParmEditSet(plf, null, false); } catch (Exception e) { LOG.error("Exception occurred while getting user's DLM " + "paramter-edit-set.", e); } if (pSet == null) return; NodeList edits = pSet.getChildNodes(); for (int i = edits.getLength() - 1; i >= 0; i--) { if (applyEdit((Element) edits.item(i), ilf) == false) { pSet.removeChild(edits.item(i)); result.changedPLF = true; } else { result.changedILF = true; } } if (pSet.getChildNodes().getLength() == 0) { plf.getDocumentElement().removeChild(pSet); result.changedPLF = true; } }
/** * This method trims down the position set to the position directives on the node info elements * still having a position directive. Any directives that violated restrictions were removed from * the node info objects so the position set should be made to match the order of those still * having one. */ static void adjustPositionSet( List<NodeInfo> order, Element positionSet, IntegrationResult result) { Node nodeToMatch = positionSet.getFirstChild(); Element nodeToInsertBefore = positionSet.getOwnerDocument().createElement("INSERT_POINT"); positionSet.insertBefore(nodeToInsertBefore, nodeToMatch); for (Iterator iter = order.iterator(); iter.hasNext(); ) { NodeInfo ni = (NodeInfo) iter.next(); if (ni.positionDirective != null) { // found one check it against the current one in the position // set to see if it is different. If so then indicate that // something (the position set) has changed in the plf if (ni.positionDirective != nodeToMatch) result.changedPLF = true; // now bump the insertion point forward prior to // moving on to the next position node to be evaluated if (nodeToMatch != null) nodeToMatch = nodeToMatch.getNextSibling(); // now insert it prior to insertion point positionSet.insertBefore(ni.positionDirective, nodeToInsertBefore); } } // now for any left over after the insert point remove them. while (nodeToInsertBefore.getNextSibling() != null) positionSet.removeChild(nodeToInsertBefore.getNextSibling()); // now remove the insertion point positionSet.removeChild(nodeToInsertBefore); }
/** * This method determines if applying all of the positioning rules and restrictions ended up * making changes to the compViewParent or the original position set. If changes are applicable to * the CVP then they are applied. If the position set changed then the original stored in the PLF * is updated. */ static void evaluateAndApply( List<NodeInfo> order, Element compViewParent, Element positionSet, IntegrationResult result) throws PortalException { adjustPositionSet(order, positionSet, result); if (hasAffectOnCVP(order, compViewParent)) { applyToNodes(order, compViewParent); result.changedILF = true; } }