Search in sources :

Example 1 with IUserLayoutStore

use of org.apereo.portal.layout.IUserLayoutStore in project uPortal by Jasig.

the class GenerateEntityFileNameTask method perform.

/* (non-Javadoc)
     * @see org.danann.cernunnos.Phrase#evaluate(org.danann.cernunnos.TaskRequest, org.danann.cernunnos.TaskResponse)
     */
@Override
public void perform(TaskRequest req, TaskResponse res) {
    final Element rootElement = (Element) entityElement.evaluate(req, res);
    final IUserLayoutStore rdbmdls = (IUserLayoutStore) layoutStore.evaluate(req, res);
    SupportedFileTypes y = SupportedFileTypes.getApplicableFileType(rootElement, rdbmdls);
    String entityFileName = y.getSafeFileNameWithExtension(rootElement);
    ReturnValue rslt = (ReturnValue) req.getAttribute(Attributes.RETURN_VALUE);
    rslt.setValue(entityFileName);
}
Also used : Element(org.dom4j.Element) ReturnValue(org.danann.cernunnos.ReturnValue) IUserLayoutStore(org.apereo.portal.layout.IUserLayoutStore)

Example 2 with IUserLayoutStore

use of org.apereo.portal.layout.IUserLayoutStore in project uPortal by Jasig.

the class HandlerUtils method createILFCopy.

/**
 * Creates a copy of an ilf node in the plf and sets up necessary storage attributes.
 */
private static Element createILFCopy(Element compViewNode, Element compViewParent, boolean includeChildNodes, Document plf, Element plfParent, IPerson person) throws PortalException {
    Element plfNode = (Element) plf.importNode(compViewNode, includeChildNodes);
    // make sure that we don't include ILF restriction params in the PLF if
    // this ILF node contained any.
    plfNode.removeAttributeNS(Constants.NS_URI, Constants.LCL_ADD_CHILD_ALLOWED);
    plfNode.removeAttributeNS(Constants.NS_URI, Constants.LCL_DELETE_ALLOWED);
    plfNode.removeAttributeNS(Constants.NS_URI, Constants.LCL_EDIT_ALLOWED);
    plfNode.removeAttributeNS(Constants.NS_URI, Constants.LCL_MOVE_ALLOWED);
    String ID = plfNode.getAttribute(Constants.ATT_ID);
    plfNode.setIdAttribute(Constants.ATT_ID, true);
    IUserLayoutStore uls = null;
    uls = UserLayoutStoreLocator.getUserLayoutStore();
    if (plfNode.getAttribute(Constants.ATT_PLF_ID).equals("")) {
        String plfID = null;
        try {
            if (!plfNode.getAttribute(Constants.ATT_CHANNEL_ID).equals(// dealing with a channel
            ""))
                plfID = uls.generateNewChannelSubscribeId(person);
            else
                plfID = uls.generateNewFolderId(person);
        } catch (Exception e) {
            throw new PortalException("Exception encountered while " + "generating new user layout node " + "Id for userId=" + person.getID(), e);
        }
        plfNode.setAttributeNS(Constants.NS_URI, Constants.ATT_PLF_ID, plfID);
        plfNode.setAttributeNS(Constants.NS_URI, Constants.ATT_ORIGIN, ID);
    }
    plfParent.appendChild(plfNode);
    PositionManager.updatePositionSet(compViewParent, plfParent, person);
    return plfNode;
}
Also used : Element(org.w3c.dom.Element) IUserLayoutStore(org.apereo.portal.layout.IUserLayoutStore) PortalException(org.apereo.portal.PortalException) PortalException(org.apereo.portal.PortalException)

Example 3 with IUserLayoutStore

use of org.apereo.portal.layout.IUserLayoutStore in project uPortal by Jasig.

the class UserLayoutStoreLocator method getUserLayoutStore.

public static IUserLayoutStore getUserLayoutStore() {
    AbstractBeanLocator<IUserLayoutStore> locator = locatorInstance;
    if (locator == null) {
        LOG.info("Looking up bean '" + BEAN_NAME + "' in ApplicationContext due to context not yet being initialized");
        final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext();
        applicationContext.getBean(UserLayoutStoreLocator.class.getName());
        locator = locatorInstance;
        if (locator == null) {
            LOG.warn("Instance of '" + BEAN_NAME + "' still null after portal application context has been initialized");
            return applicationContext.getBean(BEAN_NAME, IUserLayoutStore.class);
        }
    }
    return locator.getInstance();
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) IUserLayoutStore(org.apereo.portal.layout.IUserLayoutStore)

Aggregations

IUserLayoutStore (org.apereo.portal.layout.IUserLayoutStore)3 PortalException (org.apereo.portal.PortalException)1 ReturnValue (org.danann.cernunnos.ReturnValue)1 Element (org.dom4j.Element)1 ApplicationContext (org.springframework.context.ApplicationContext)1 Element (org.w3c.dom.Element)1