use of org.apereo.portal.PortalException in project uPortal by Jasig.
the class DeleteManager method addDeleteDirective.
/**
* This method does the actual work of adding a delete directive and then recursively calling
* itself for any incoporated children that need to be deleted as well.
*/
private static void addDeleteDirective(Element compViewNode, String elementID, IPerson person, Document plf, Element delSet) throws PortalException {
String ID = null;
try {
ID = getDLS().getNextStructDirectiveId(person);
} catch (Exception e) {
throw new PortalException("Exception encountered while " + "generating new delete node " + "Id for userId=" + person.getID(), e);
}
Element delete = plf.createElement(Constants.ELM_DELETE);
delete.setAttribute(Constants.ATT_TYPE, Constants.ELM_DELETE);
delete.setAttribute(Constants.ATT_ID, ID);
delete.setAttributeNS(Constants.NS_URI, Constants.ATT_NAME, elementID);
delSet.appendChild(delete);
// now pass through children and add delete directives for those with
// IDs indicating that they were incorporated
Element child = (Element) compViewNode.getFirstChild();
while (child != null) {
String childID = child.getAttribute("ID");
if (childID.startsWith(Constants.FRAGMENT_ID_USER_PREFIX))
addDeleteDirective(child, childID, person, plf, delSet);
child = (Element) child.getNextSibling();
}
}
use of org.apereo.portal.PortalException in project uPortal by Jasig.
the class EditManager method addDirective.
/**
* Create and append an edit directive to the edit set if not there.
*/
private static void addDirective(Element plfNode, String attributeName, String type, IPerson person) throws PortalException {
Document plf = (Document) person.getAttribute(Constants.PLF);
Element editSet = getEditSet(plfNode, plf, person, true);
// see if attributes has already been marked as being edited
Element child = (Element) editSet.getFirstChild();
Element edit = null;
while (child != null && edit == null) {
if (child.getNodeName().equals(type) && child.getAttribute(Constants.ATT_NAME).equals(attributeName))
edit = child;
child = (Element) child.getNextSibling();
}
if (// if not found then newly mark as edited
edit == null) {
String ID = null;
try {
ID = getDLS().getNextStructDirectiveId(person);
} catch (Exception e) {
throw new PortalException("Exception encountered while " + "generating new edit node " + "Id for userId=" + person.getID(), e);
}
edit = plf.createElement(type);
edit.setAttribute(Constants.ATT_TYPE, type);
edit.setAttribute(Constants.ATT_ID, ID);
edit.setAttribute(Constants.ATT_NAME, attributeName);
editSet.appendChild(edit);
}
}
use of org.apereo.portal.PortalException in project uPortal by Jasig.
the class ParameterEditManager method getParmEditSet.
/**
* Get the parameter edits set if any stored in the root of the document or create it if
* passed-in create flag is true.
*/
private static Element getParmEditSet(Document plf, IPerson person, boolean create) throws PortalException {
Node root = plf.getDocumentElement();
Node child = root.getFirstChild();
while (child != null) {
if (child.getNodeName().equals(Constants.ELM_PARM_SET))
return (Element) child;
child = child.getNextSibling();
}
if (create == false)
return null;
String ID = null;
try {
ID = getDLS().getNextStructDirectiveId(person);
} catch (Exception e) {
throw new PortalException("Exception encountered while " + "generating new parameter edit set node " + "Id for userId=" + person.getID(), e);
}
Element parmSet = plf.createElement(Constants.ELM_PARM_SET);
parmSet.setAttribute(Constants.ATT_TYPE, Constants.ELM_PARM_SET);
parmSet.setAttribute(Constants.ATT_ID, ID);
parmSet.setIdAttribute(Constants.ATT_ID, true);
root.appendChild(parmSet);
return parmSet;
}
use of org.apereo.portal.PortalException in project uPortal by Jasig.
the class ParameterEditManager method addParmEditDirective.
/**
* This method does the actual work of adding a newly created parameter edit and adding it to
* the parameter edits set.
*/
private static void addParmEditDirective(String targetID, String name, String value, IPerson person, Document plf, Element parmSet) throws PortalException {
String ID = null;
try {
ID = getDLS().getNextStructDirectiveId(person);
} catch (Exception e) {
throw new PortalException("Exception encountered while " + "generating new parameter edit node " + "Id for userId=" + person.getID(), e);
}
Element parm = plf.createElement(Constants.ELM_PARM_EDIT);
parm.setAttribute(Constants.ATT_TYPE, Constants.ELM_PARM_EDIT);
parm.setAttribute(Constants.ATT_ID, ID);
parm.setIdAttribute(Constants.ATT_ID, true);
parm.setAttributeNS(Constants.NS_URI, Constants.ATT_TARGET, targetID);
parm.setAttribute(Constants.ATT_NAME, name);
parm.setAttribute(Constants.ATT_USER_VALUE, value);
parmSet.appendChild(parm);
}
use of org.apereo.portal.PortalException in project uPortal by Jasig.
the class PositionManager method getPositionSet.
/**
* This method locates the position set element in the child list of the passed in plfParent or
* if not found it will create one automatically and return it if the passed in create flag is
* true.
*/
private static Element getPositionSet(Element plfParent, IPerson person, boolean create) throws PortalException {
Node child = plfParent.getFirstChild();
while (child != null) {
if (child.getNodeName().equals(Constants.ELM_POSITION_SET))
return (Element) child;
child = child.getNextSibling();
}
if (create == false)
return null;
String ID = null;
try {
ID = getDLS().getNextStructDirectiveId(person);
} catch (Exception e) {
throw new PortalException("Exception encountered while " + "generating new position set node " + "Id for userId=" + person.getID(), e);
}
Document plf = plfParent.getOwnerDocument();
Element positions = plf.createElement(Constants.ELM_POSITION_SET);
positions.setAttribute(Constants.ATT_TYPE, Constants.ELM_POSITION_SET);
positions.setAttribute(Constants.ATT_ID, ID);
plfParent.appendChild(positions);
return positions;
}
Aggregations