use of org.apereo.portal.PortalException in project uPortal by Jasig.
the class DistributedLayoutManager method getPreviousSiblingId.
public String getPreviousSiblingId(String nodeId) throws PortalException {
Document uld = this.getUserLayoutDOM();
Element nelement = uld.getElementById(nodeId);
if (nelement != null) {
Node nsibling = nelement.getPreviousSibling();
// scroll to the next element node
while (nsibling != null && nsibling.getNodeType() != Node.ELEMENT_NODE) {
nsibling = nsibling.getNextSibling();
}
if (nsibling != null) {
Element e = (Element) nsibling;
return e.getAttribute("ID");
}
return null;
}
throw new PortalException("Node with id=\"" + nodeId + "\" doesn't exist. Occurred in layout for " + owner.getAttribute(IPerson.USERNAME) + ".");
}
use of org.apereo.portal.PortalException in project uPortal by Jasig.
the class DistributedLayoutManager method saveUserLayout.
public synchronized void saveUserLayout() throws PortalException {
Document uld = this.getUserLayoutDOM();
if (uld == null) {
throw new PortalException("UserLayout has not been initialized for " + owner.getAttribute(IPerson.USERNAME) + ".");
}
try {
this.distributedLayoutStore.setUserLayout(this.owner, this.profile, uld, channelsAdded);
} catch (Exception e) {
throw new PortalException("Exception encountered while " + "saving layout for userId=" + this.owner.getID() + ", profileId=" + this.profile.getProfileId(), e);
}
this.channelsAdded = false;
}
use of org.apereo.portal.PortalException in project uPortal by Jasig.
the class DistributedLayoutManager method canAddNode.
protected boolean canAddNode(IUserLayoutNodeDescription node, IUserLayoutNodeDescription parent, String nextSiblingId) throws PortalException {
// make sure sibling exists and is a child of nodeId
if (nextSiblingId != null && !nextSiblingId.equals("")) {
IUserLayoutNodeDescription sibling = getNode(nextSiblingId);
if (sibling == null) {
throw new PortalException("Unable to find a sibling node " + "with id=\"" + nextSiblingId + "\". Occurred " + "in layout for " + owner.getAttribute(IPerson.USERNAME) + ".");
}
if (!parent.getId().equals(getParentId(nextSiblingId))) {
throw new PortalException("Given sibling (\"" + nextSiblingId + "\") is not a child of a given parentId (\"" + parent.getId() + "\"). Occurred " + "in layout for " + owner.getAttribute(IPerson.USERNAME) + ".");
}
}
if (parent == null || !(node.isMoveAllowed() || isFragmentOwner))
return false;
if (parent instanceof IUserLayoutFolderDescription && !(((IUserLayoutFolderDescription) parent).isAddChildAllowed()) && !isFragmentOwner)
return false;
if (// end of list targeted
nextSiblingId == null || nextSiblingId.equals(""))
return true;
// so lets see if we can place it at the end of the sibling list and
// hop left until we get into the correct position.
Enumeration sibIds = getVisibleChildIds(parent.getId());
List sibs = Collections.list(sibIds);
if (// last node in list so should be ok
sibs.size() == 0)
return true;
// unprocessed nodes is not altered.
for (int idx = sibs.size() - 1; idx >= 0; idx--) {
IUserLayoutNodeDescription prev = getNode((String) sibs.get(idx));
if (!isFragmentOwner && !MovementRules.canHopLeft(node, prev))
return false;
if (prev.getId().equals(nextSiblingId))
return true;
}
// oops never found the sib
return false;
}
use of org.apereo.portal.PortalException in project uPortal by Jasig.
the class DistributedLayoutManager method getNextSiblingId.
public String getNextSiblingId(String nodeId) throws PortalException {
Document uld = this.getUserLayoutDOM();
Element nelement = uld.getElementById(nodeId);
if (nelement != null) {
Node nsibling = nelement.getNextSibling();
// scroll to the next element node
while (nsibling != null && nsibling.getNodeType() != Node.ELEMENT_NODE) {
nsibling = nsibling.getNextSibling();
}
if (nsibling != null) {
Element e = (Element) nsibling;
return e.getAttribute("ID");
}
return null;
}
throw new PortalException("Node with id=\"" + nodeId + "\" doesn't exist. Occurred " + "in layout for " + owner.getAttribute(IPerson.USERNAME) + ".");
}
use of org.apereo.portal.PortalException in project uPortal by Jasig.
the class LogoutController method afterPropertiesSet.
@Override
public void afterPropertiesSet() throws Exception {
final Map<String, String> rdHash = new HashMap<String, String>(1);
try {
// We retrieve the redirect strings for each context
// from the security properties file.
String key;
final Properties props = ResourceLoader.getResourceAsProperties(LogoutController.class, "/properties/security.properties");
final Enumeration propNames = props.propertyNames();
while (propNames.hasMoreElements()) {
final String propName = (String) propNames.nextElement();
final String propValue = props.getProperty(propName);
if (propName.startsWith("logoutRedirect.")) {
key = propName.substring(15);
key = key.startsWith("root.") ? key.substring(5) : key;
if (log.isDebugEnabled()) {
log.debug("Redirect key=" + key + ", value=" + propValue);
}
rdHash.put(key, propValue);
}
}
} catch (final PortalException pe) {
log.error("Failed to load logout redirect URLs", pe);
} catch (final IOException ioe) {
log.error("Failed to load logout redirect URLs", ioe);
}
this.redirectMap = rdHash;
}
Aggregations