Package org.apache.jetspeed.portal

Examples of org.apache.jetspeed.portal.PortletInstance


            PortletTab tab = new PortletTab();
           
            // Handle the portlet title
            String title = null;           
            PortletInstance pi = PersistenceManager.getInstance(p, rundata);
            if (pi != null)
            {
                title = pi.getTitle();
                if (title == null)
                {
                    title = (p.getTitle() != null) ? p.getTitle() : p.getName();
                }
            }
View Full Code Here


    * @author <a href="mailto:sweaver@rippe.com">Scott Weaver</a>
    */
    public void setAttribute(String attrName, String value, Context context)
        throws PortalPersistenceException
    {
        PortletInstance instance = getPortletInstance(context);
        instance.setAttribute(attrName, value);
        PersistenceManager.store(instance);
    }
View Full Code Here

    * @author <a href="mailto:sweaver@rippe.com">Scott Weaver</a>
    */
    public void setAttribute(String attrName, String value, Context context)
        throws PortalPersistenceException
    {
        PortletInstance instance = getPortletInstance(context);
        instance.setAttribute(attrName, value);
        PersistenceManager.store(instance);
    }
View Full Code Here

     * @return a list of ordered PortletAction objects describing the
     * the actions available for this portlet
     */
    protected List buildActionList( RunData rundata, Portlet portlet )
    {       
        PortletInstance instance = portlet.getInstance(rundata);
        Portlet real = portlet.getInstance(rundata).getPortlet();
       
        if (!(real instanceof JetspeedFusionPortlet))
        {
            return super.buildActionList(rundata, portlet);
        }
        JetspeedFusionPortlet fusion = (JetspeedFusionPortlet)real;
       
        List actions = new Vector();
        JetspeedRunData jdata = (JetspeedRunData)rundata;

        // disable actions option
        if (JetspeedSecurity.areActionsDisabledForAllUsers())
        {
            return actions;
        }
        JetspeedUser user = jdata.getJetspeedUser();
        if (JetspeedSecurity.areActionsDisabledForAnon() && false == user.hasLoggedIn())
        {
            return actions;
        }

        // the portlet is state aware
        PortletState state = (PortletState)portlet;
               
        String entityId = instance.getAttribute(J2_ENTITY, "");
        serviceNavsPipeline(rundata, entityId);
       
        String pa = getPortletConfig().getInitParameter(PORTLET_APPLICATION_NAME, null);
        String pd = getPortletConfig().getInitParameter(PORTLET_DEFINITION_NAME, null);
        String registryKey = pa + "::" + pd;
View Full Code Here

        HttpServletResponse response = data.getResponse();
        String entityId = null;
       
        try
        {
            PortletInstance instance = this.getInstance(jrun);
            entityId = instance.getAttribute(J2_ENTITY, "");
            String pa = getPortletConfig().getInitParameter(PORTLET_APPLICATION_NAME, null);
            String pd = getPortletConfig().getInitParameter(PORTLET_DEFINITION_NAME, null);
            String registryKey = pa + "::" + pd;
           
            PortletWindow window = getPortletWindow(entityId, registryKey);
View Full Code Here

    {
        super.setMinimized(flag, rundata);
        JetspeedRunData jrun = (JetspeedRunData)rundata;
        String entityId = null;
       
        PortletInstance instance = this.getInstance(jrun);
        entityId = instance.getAttribute(J2_ENTITY, "3");
        PortletWindow window = windowAccessor.getPortletWindow(entityId);
        if (window == null)
        {
            window = windowAccessor.createPortletWindow(entityId);
        }
View Full Code Here

        context.put("securitys", CustomizeSetAction.buildList(rundata, Registry.SECURITY));

        // we should first retrieve the portlet to customize
        Portlet p = ((JetspeedRunData)rundata).getCustomized();
       
        PortletInstance instance = PersistenceManager.getInstance(p, rundata);
        context.put("portlet_instance", PersistenceManager.getInstance(p, rundata));

        if (p==null) return;

        // retrieve the portlet parameters
View Full Code Here

        // we should first retrieve the portlet to customize
        Portlet p = ((JetspeedRunData)rundata).getCustomized();

        context.put("action", "portlets.CustomizeAction");

        PortletInstance instance = PersistenceManager.getInstance(p, rundata);
        context.put("portlet_instance", PersistenceManager.getInstance(p, rundata));

        if (p==null) return;

        // retrieve the portlet parameters
        PortletEntry entry = (PortletEntry)Registry.getEntry(Registry.PORTLET,p.getName());
        // save the entry in the session
        Vector params = new Vector();
        Iterator i = entry.getParameterNames();

        //System.out.println("==========================================");
        while(i.hasNext())
        {
            String name = (String)i.next();
            Parameter param = entry.getParameter(name);

            // filter some "system" and hidden parameters
            if (  (!param.isHidden()) && (name.charAt(0)!='_') )
            {
                // check the user role
                if (JetspeedSecurity.checkPermission((JetspeedUser)rundata.getUser(), new PortalResource( entry, param), JetspeedSecurity.PERMISSION_CUSTOMIZE))
                {
                    // Implementation of clone() is missing so we have do it "by hand"
                    Parameter clone = new BaseParameter();
                    clone.setName(param.getName());
                    clone.setTitle(param.getTitle());
                    clone.setDescription(param.getDescription());
                    clone.setType(param.getType());
                    if (instance.getAttribute(name, null) != null)
                    {
                        clone.setValue(instance.getAttribute(name));
                        //System.out.println("Adding value from instance [" + name + "] = [" + clone.getValue() + "]");
                    }
                    else if (p.getPortletConfig().getInitParameter(name) != null)
                    {
                        clone.setValue(p.getPortletConfig().getInitParameter(name));
View Full Code Here

        Portlet p = ((JetspeedRunData) rundata).getCustomized();

        // Update paramaters
        try
        {
            PortletInstance instance = PersistenceManager.getInstance(p, rundata);

            instance.removeAllAttributes();

            try
            {
                ((JetspeedRunData) rundata).getCustomizedProfile().store();
            }
View Full Code Here

        }

        // Update paramaters
        try
        {
            PortletInstance instance = PersistenceManager.getInstance(p, rundata);
            PortletEntry regEntry = (PortletEntry) Registry.getEntry(Registry.PORTLET, p.getName());

            Iterator i = params.iterator();

            //System.out.println("==========================================");
            while(i.hasNext())
            {
                Parameter param = (Parameter)i.next();
                String name = param.getName();
                String newValue = null;
                String[] testArray = rundata.getParameters().getStrings(name);
                if (testArray != null && testArray.length > 1)
                {
                    newValue = org.apache.jetspeed.util.StringUtils.arrayToString(testArray, ",");
                }
                else
                {
                    newValue = rundata.getParameters().getString(name);
                    if (newValue == null)
                    {
                        newValue = "";
                    }
                }
                String regValue = regEntry.getParameter(name).getValue(); //param.getValue();
                String psmlValue = instance.getAttribute(name);

                //System.out.println(name + "= [" + psmlValue + "] in psml");
                //System.out.println(name + "= [" + regValue + "] in registry");

                // New value for this parameter exists
                if (newValue != null)
                {
                    //System.out.println(name + "= [" + newValue + "] in request");
                    // New value differs from registry - record it in psml
                    if (!regValue.equals(newValue) || !psmlValue.equals(newValue))
                    {
                        instance.setAttribute(name, newValue);
                        psmlValue = newValue;
                        //System.out.println("setting attribute for [" + name + "] to [" + newValue + "]");
                    }
                    madePsChange = true;
                }
                // Remove duplicate parameters from psml
                if (psmlValue != null && psmlValue.equals(regValue))
                {
                    //System.out.println("removing attribute for [" + name + "]");
                    instance.removeAttribute(name);
                    madePsChange = true;
                }

            }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.portal.PortletInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.