Package org.apache.jetspeed.om.profile

Examples of org.apache.jetspeed.om.profile.Entry


                                                           .getPortletsById(set.getID());

            List usedPortlets = AutoProfile.getPortletList(rundata);
            boolean addIt;
            int cc;
            Entry usedEntry;
                                         
            for (int i = 0; i < pnames.length; i++)
            {
                PortletEntry entry = (PortletEntry) Registry.getEntry(Registry.PORTLET, pnames[i]);

                // add only new portlets!
                if ((entry != null) && (portlets != null))
                {
               
                    addIt = true;
/*
                    for (cc=0; cc<usedPortlets.size(); cc++)
                    {
                      usedEntry = (Entry) usedPortlets.get(cc);
                      if (entry.getName().equals(usedEntry.getParent()))
                      {
                        addIt = false;
                        break;
                      }
                     
                    }
*/
                    if (addIt)
                    {
                      Entry p = new PsmlEntry();
                      // add the ClearPortletControl to wml entries     
                      //if (isWML)
                      //  p.setControl (ctrl);
                   
                      p.setParent(pnames[i]);
                      p.setId(JetspeedIdGenerator.getNextPeid());
//                      SecurityReference defaultRef = PortalToolkit.getDefaultSecurityRef(
//                          ((JetspeedRunData) rundata).getCustomizedProfile());
//                      if (defaultRef != null)
//                      {
//                          if (Log.getLogger().isDebugEnabled())
View Full Code Here


        assertNotNull( "Getting turbine user", turbineUser);
        turbineUser.setHasLoggedIn(Boolean.TRUE);
       
        JetspeedUser anonymousUser =  (JetspeedUser) JetspeedSecurity.getAnonymousUser();
        assertNotNull( "Getting anonymous user", anonymousUser);
        Entry adminEntry = createEntry( ADMIN_PORTLET, "ST_01.admin");
        Entry userEntry = createEntry(USER_PORTLET, "ST_01.user");
        Entry allEntry = createEntry(ALL_PORTLET, "ST_01.all");
       
        assertEquals( "Admin user has view access to " + ADMIN_PORTLET, true, JetspeedPortalAccessController.checkPermission( adminUser, adminEntry, "view"));
//        assertEquals( "Turbine user DOES NOT have view access to " + ADMIN_PORTLET, false, JetspeedPortalAccessController.checkPermission( turbineUser, adminEntry, "view"));

//        assertEquals( "Anonymous user DOES NOT have view access to " + ADMIN_PORTLET, false, JetspeedPortalAccessController.checkPermission( anonymousUser, adminEntry, "view"));
View Full Code Here

        assertNotNull( "Getting turbine user", turbineUser);
        turbineUser.setHasLoggedIn(Boolean.TRUE);
       
        JetspeedUser anonymousUser =  (JetspeedUser) JetspeedSecurity.getAnonymousUser();
        assertNotNull( "Getting anonymous user", anonymousUser);
        Entry adminEntry = createEntry( ADMIN_PORTLET, "ST_01.admin", adminSecurityRef);
        Entry userEntry = createEntry( USER_PORTLET, "ST_01.user", userSecurityRef);
        Entry allEntry = createEntry( ALL_PORTLET, "ST_01.all", defaultSecurityRef);
        Entry userAnonEntry = createEntry( USERANON_PORTLET, "ST_01.userAnon", userAllAnonViewSecurityRef);
       
        assertEquals( "Admin user has view access to " + ADMIN_PORTLET, true, JetspeedPortalAccessController.checkPermission( adminUser, adminEntry, "view"));
        assertEquals( "Turbine user DOES NOT have view access to " + ADMIN_PORTLET, false, JetspeedPortalAccessController.checkPermission( turbineUser, adminEntry, "view"));
        assertEquals( "Anonymous user DOES NOT have view access to " + ADMIN_PORTLET, false, JetspeedPortalAccessController.checkPermission( anonymousUser, adminEntry, "view"));
       
View Full Code Here

        assertNotNull( "Getting turbine user", turbineUser);
        turbineUser.setHasLoggedIn(Boolean.TRUE);
       
        JetspeedUser anonymousUser =  (JetspeedUser) JetspeedSecurity.getAnonymousUser();
        assertNotNull( "Getting anonymous user", anonymousUser);
        Entry adminEntry = createEntry( ADMIN_PORTLET, "ST_01.admin", adminSecurityRef);
        Entry userEntry = createEntry( USER_PORTLET, "ST_01.user", userSecurityRef);
        Entry allEntry = createEntry( ALL_PORTLET, "ST_01.all", defaultSecurityRef);
        Entry userAnonEntry = createEntry( USERANON_PORTLET, "ST_01.userAnon", userAllAnonViewSecurityRef);
       
        assertEquals( "Admin user has view access to " + ADMIN_PORTLET, true, JetspeedPortalAccessController.checkPermission( adminUser, adminEntry, "view"));
        assertEquals( "Turbine user DOES NOT have view access to " + ADMIN_PORTLET, false, JetspeedPortalAccessController.checkPermission( turbineUser, adminEntry, "view"));
        assertEquals( "Anonymous user DOES NOT have view access to " + ADMIN_PORTLET, false, JetspeedPortalAccessController.checkPermission( anonymousUser, adminEntry, "view"));
       
View Full Code Here

      }
    }   
   
    SecurityReference secRef = new BaseSecurityReference();
    secRef.setParent("powerusers_all-anon_view");
    Entry adminEntry = createEntry(ADMIN_PORTLET, "ST_01.apache.admin", secRef);
       
    JetspeedUser turbineUser = (JetspeedUser) JetspeedSecurity.getUser("turbine");
    assertNotNull( "Getting turbine user", turbineUser);
    turbineUser.setHasLoggedIn(Boolean.TRUE);
View Full Code Here

        if (p.getPortletConfig().getSkin() != null)
            context.put(
                "current_skin",
                p.getPortletConfig().getPortletSkin().getName());

        Entry psmlEntry =
            ((JetspeedRunData) rundata)
                .getProfile()
                .getDocument()
                .getEntryById(
                p.getID());
        if (psmlEntry.getControl() != null)
            context.put("current_control", psmlEntry.getControl().getName());

        Profile profile = ((JetspeedRunData) rundata).getCustomizedProfile();
        String currentTitle =
            profile.getDocument().getEntryById(p.getID()).getTitle();
        if (currentTitle == null && p.getPortletConfig().getMetainfo() != null)
View Full Code Here

            doCancel(rundata, context);
            return;
        }
        PortletConfig pc = p.getPortletConfig();
        Profile profile = ((JetspeedRunData) rundata).getCustomizedProfile();
        Entry entry = profile.getDocument().getEntryById(p.getID());

        // Only update the security ref if the parent changed
        if ((newSecurityParent != null))
        {
            boolean securityChanged = false;
            SecurityReference currentSecurityRef = pc.getSecurityRef();
            if (currentSecurityRef != null)
            {
                securityChanged =
                    (newSecurityParent.equals(currentSecurityRef.getParent())
                        == false);
            }
            else
            {
                securityChanged = (newSecurityParent.trim().length() > 0);
            }
            if (securityChanged == true)
            {
                SecurityReference securityRef = null;
                if ((newSecurityParent.trim().length() > 0))
                {
                    securityRef = new BaseSecurityReference();
                    securityRef.setParent(newSecurityParent);
                }
                // Note: setting the portlet's config may not be a good idea -
                // it might be used as the Portlet for other PSMLDocument Entries that
                // have a different idea of security - and the caching of Portlets does
                // NOT include security -ggolden.
                pc.setSecurityRef(securityRef);
                entry.setSecurityRef(securityRef);
                madePcChange = true;
            }
        }

        // Only update the skin if the name changed
        if (newSkinName != null)
        {
            boolean skinChanged = false;
            String currentSkinName = null;

            if (pc.getSkin() != null)
                currentSkinName = pc.getPortletSkin().getName();

            if (currentSkinName != null)
            {
                skinChanged = (newSkinName.equals(currentSkinName) == false);
            }
            else
            {
                skinChanged = (newSkinName.trim().length() > 0);
            }

            if (skinChanged == true)
            {
                PortletSkin skin = null;
                if ((newSkinName.trim().length() > 0))
                {
                    skin = PortalToolkit.getSkin(newSkinName);
                    if (skin != null)
                    {
                        // Note: setting the portlet's config may not be a good idea -
                        // it might be used as the Portlet for other PSMLDocument Entries that
                        // have a different idea of skin - and the caching of Portlets does
                        // NOT include skin -ggolden.
                        pc.setPortletSkin(skin);

                        Skin psmlSkin = entry.getSkin();
                        if (psmlSkin == null)
                        {
                            entry.setSkin(new PsmlSkin());
                        }
                        entry.getSkin().setName(newSkinName);
                    }
                    else
                    {
                        logger.warn(
                            "Unable to update skin for portlet entry "
                                + entry.getId()
                                + " because skin "
                                + skin
                                + " does not exist.");
                    }
                }
                else
                {
                    // Note: setting the portlet's config may not be a good idea -
                    // it might be used as the Portlet for other PSMLDocument Entries that
                    // have a different idea of skin - and the caching of Portlets does
                    // NOT include skin -ggolden.
                    pc.setPortletSkin(null);
                    entry.setSkin(null);
                }
                madePcChange = true;
            }
        }

        // Only update the title if the title changed
        if (newTitle != null)
        {
            boolean titleChanged = false;
            String currentTitle = entry.getTitle();

            MetaData md = pc.getMetainfo();
            if (currentTitle == null && md != null && md.getTitle() != null)
                currentTitle = md.getTitle();

            if (currentTitle != null)
            {
                titleChanged = (newTitle.equals(currentTitle) == false);
            }
            else
            {
                titleChanged = (newTitle.trim().length() > 0);
            }

            if (titleChanged == true)
            {

                if ((newTitle.trim().length() > 0))
                {
                    // Note: setting the portlet's config may not be a good idea -
                    // it might be used as the Portlet for other PSMLDocument Entries that
                    // have a different idea of title - and the caching of Portlets does
                    // NOT include title -ggolden.
                    if (md == null)
                    {
                        md = new MetaData();
                        pc.setMetainfo(md);
                    }
                    md.setTitle(newTitle);
                    entry.setTitle(newTitle);
                    madePcChange = true;
                }
            }
        }

    // Only update the control if the name changed
    if (newControlName != null)
    {
      boolean controlChanged = false;
      String currentControlName = null;

      if (entry.getControl() != null)
        currentControlName = entry.getControl().getName();

      if (currentControlName != null)
      {
        controlChanged = (newControlName.equals(currentControlName) == false);
      }
      else
      {
        controlChanged = (newControlName.trim().length() > 0);
      }

      if (controlChanged == true)
      {
        PortletControl control = null;
        if ((newControlName.trim().length() > 0))
        {
          control = PortalToolkit.getControl(newControlName);
          if (control != null)
          {
            Control psmlControl = new PsmlControl();
            psmlControl.setName(newControlName);
            entry.setControl(psmlControl);
          }
          else
          {
            logger.warn(
              "Unable to update control for portlet entry "
                + entry.getId()
                + " because control "
                + newControlName
                + " does not exist.");
          }
        }
        else
        {
          entry.setControl(null);
        }
        madePcChange = true;
      }
    }
View Full Code Here

            while (profiles.hasNext() )
            {
                Profile profile = (Profile)profiles.next();               
                PSMLDocument doc = profile.getDocument();
                // System.out.println("Scanning: " + doc.getName());
                Entry entry = doc.getEntry(name);
                if (entry != null)
                {
                    // System.out.println("***** REMOVING ENTRY : " + entry.getName());
                    doc.removeEntryById(entry.getId());
                    PsmlManager.store(profile);
                }
            }
        }
        catch(Exception e)
View Full Code Here

    {
        // First let's add all the Entries in the current level
        Iterator eItr = portlets.getEntriesIterator();
        while(eItr.hasNext())
        {
            Entry entry =  (Entry)eItr.next();
            //System.out.println("entry = " + entry.getId());
            Parameter param = entry.getParameter(J2_ENTITY);
            if (param == null)
            {
                continue;
            }
            //System.out.println("entity id = " + param.getValue());
            if (windowId.equals(param.getValue()))
            {
                //System.out.println("GOT A MATCH: " + entry.getId());
                if (windowAction.equals(WindowState.MAXIMIZED.toString()))
                {
                    jdata.getUser().setTemp("js_peid", entry.getId());
                }
                else if (windowAction.equals(WindowState.NORMAL.toString()))
                {
                    // restore
                    jdata.getUser().removeTemp("js_peid");
View Full Code Here

    {
        // First let's add all the Entries in the current level
        Iterator eItr = portlets.getEntriesIterator();
        while(eItr.hasNext())
        {
            Entry entry =  (Entry)eItr.next();
           
            Portlet portlet = null;
            try
            {
                portlet = PortletFactory.getPortlet(entry);
            }
            catch (Exception e)
            {
                log.error("Could not create portlet for entry " + entry.getId(), e);               
                continue;
            }
            if (portlet == null)
            {
                log.error("Could not create portlet for entry " + entry.getId());
                continue;
            }  
            if (isFusionPortlet(portlet))
            {
                String pa = portlet.getPortletConfig().getInitParameter(PORTLET_APPLICATION_NAME, null);
                String pd = portlet.getPortletConfig().getInitParameter(PORTLET_DEFINITION_NAME, null);
                String registryKey = pa + "::" + pd;
               
                Parameter param = entry.getParameter(J2_ENTITY);
                if (param == null)
                {
                    PortletRegistry registryAccess =
                        (PortletRegistry)Jetspeed.getComponentManager().getComponent(PortletRegistry.class);
                    PortletEntityAccessComponent entityAccess =
                        (PortletEntityAccessComponent)Jetspeed.getComponentManager().getComponent(PortletEntityAccessComponent.class);
                   
                    PortletDefinition portletDef = registryAccess.getPortletDefinitionByUniqueName(registryKey);
                    if (null == portletDef)
                    {
                        log.error("Could not find portlet definition in registry for " + registryKey);
                        continue;
                    }
                    PortletEntity entity = entityAccess.newPortletEntityInstance(portletDef);
                    try
                    {
                        entityAccess.storePortletEntity(entity);                   
                        param = new PsmlParameter();
                        param.setName(J2_ENTITY);
                        param.setValue(entity.getId().toString());
                        entry.addParameter(param);
                        count++;                       
                    }
                    catch (Exception e)
                    {
                        log.error("Failed to store portlet entity: " + registryKey, e);
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.profile.Entry

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.