01: /* Copyright 2005 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.layout.dlm;
07:
08: import org.jasig.portal.PortalException;
09: import org.jasig.portal.security.IPerson;
10: import org.w3c.dom.Element;
11:
12: /**
13: * Layout processing to reset a channel parameter to the value specified by the
14: * owning fragment.
15: *
16: * @author Mark Boyd
17: */
18: public class LPAResetParameter implements ILayoutProcessingAction {
19: private String nodeId = null;
20: private String name = null;
21: private IPerson person = null;
22: private Element ilfNode = null;
23: private String fragmentValue = null;
24:
25: LPAResetParameter(String nodeId, String name, String fragmentValue,
26: IPerson p, Element ilfNode) {
27: this .nodeId = nodeId;
28: this .name = name;
29: this .person = p;
30: this .ilfNode = ilfNode;
31: this .fragmentValue = fragmentValue;
32: }
33:
34: /**
35: * Reset the parameter to not override the value specified by a fragment.
36: * This is done by removing the parm edit in the PLF and setting the value
37: * in the ILF to the passed-in fragment value.
38: */
39: public void perform() throws PortalException {
40: // push the change into the PLF
41: if (nodeId.startsWith(Constants.FRAGMENT_ID_USER_PREFIX)) {
42: // remove the parm edit
43: ParameterEditManager.removeParmEditDirective(nodeId, name,
44: person);
45: }
46: // push the fragment value into the ILF
47: LPAChangeParameter.changeParameterChild(ilfNode, name,
48: fragmentValue);
49: }
50: }
|