Examples of PortletDescriptor


Examples of net.sf.jportlet.portlet.descriptor.PortletDescriptor

                                PortletRequestImpl  portletRequest,
                                HttpServletResponse httpResponse )
    {
        super( httpResponse );

        PortletDescriptor descriptor = proxy.getDescriptor(  );
        _proxy           = proxy;
        _portletRequest  = portletRequest;
        _httpResponse    = httpResponse;
        _pathPrefix      = descriptor.getContextPath(  );
        _namespacePrefix = "_" + descriptor.getName(  ) + "_";
    }
View Full Code Here

Examples of net.sf.jportlet.portlet.descriptor.PortletDescriptor

        String  id = getId( proxy, request, response );

        if ( id != null )
        {
            PortletResponseImpl resp = ( PortletResponseImpl ) response;
            PortletDescriptor   descr = proxy.getDescriptor(  );
            CacheDescriptor     cache = descr.getCacheDescriptor( request.getMode(  ) );
            CacheRegion         region = getCacheService( proxy ).getRegion( descr.getName(  ), true );
            CacheableImpl       cacheable = new CacheableImpl( id, resp.getBuffer(  ).toString(  ), 1000 * cache.getExpires(  ) );

            if ( debug )
            {
                __log.debug( "Caching portlet content:" + id );
View Full Code Here

Examples of net.sf.jportlet.portlet.descriptor.PortletDescriptor

                         PortletRequest  request,
                         PortletResponse response )
    {
        /* No caching */
        StringBuffer      id = new StringBuffer(  );
        PortletDescriptor descr = proxy.getDescriptor(  );
        Portlet.Mode      mode = request.getMode(  );
        CacheDescriptor   cache = descr.getCacheDescriptor( mode );
        if ( ( cache == null ) || ( cache.getExpires(  ) == 0 ) )
        {
            return null;
        }

View Full Code Here

Examples of net.sf.jportlet.portlet.descriptor.PortletDescriptor

        assertNotNull( "app", app );
        assertEquals( "app.name", "Portlet Application", app.getName(  ) );
        assertEquals( "app.contextParameter[param1]", "value1", app.getContextParameter( "param1" ) );

        PortletDescriptor portlet = app.getPortletDescriptor( "portlet1" );
        assertNotNull( "portlet1 not found", portlet );
        assertEquals( "portlet.name", "portlet1", portlet.getName(  ) );
        assertEquals( "portlet.portletClass", PortletAdapter.class, portlet.getPortletClass(  ) );
        assertEquals( "portlet.actionListenerClass", ApplicationDescriptorLoaderTest.class, portlet.getActionListenerClass(  ) );
        assertEquals( "portlet.messageListenerClass", ApplicationDescriptorLoaderTest.class, portlet.getMessageListenerClass(  ) );
        assertEquals( "portlet.defaultLocale", Locale.ENGLISH.toString(  ), portlet.getDefaultLocale(  ) );
        assertEquals( "portlet.initParameter[param1]", "value1", portlet.getInitParameter( "param1" ) );

        /* Markup support */
        assertTrue( "portlet.supports(html,view)", portlet.supports( Portlet.Mode.VIEW, Portlet.Markup.HTML ) );
        assertTrue( "portlet.supports(html,edit)", portlet.supports( Portlet.Mode.EDIT, Portlet.Markup.HTML ) );
        assertTrue( "portlet.supports(html,help)", portlet.supports( Portlet.Mode.HELP, Portlet.Markup.HTML ) );
        assertTrue( "portlet.supports(html,configure)", portlet.supports( Portlet.Mode.CONFIGURE, Portlet.Markup.HTML ) );

        assertTrue( "portlet.supports(html,view)", portlet.supports( Portlet.Mode.VIEW, Portlet.Markup.WML ) );
        assertFalse( "portlet.supports(wml,edit)", portlet.supports( Portlet.Mode.EDIT, Portlet.Markup.WML ) );
        assertFalse( "portlet.supports(wml,help)", portlet.supports( Portlet.Mode.HELP, Portlet.Markup.WML ) );
        assertFalse( "portlet.supports(wml,configure)", portlet.supports( Portlet.Mode.CONFIGURE, Portlet.Markup.WML ) );

        /* Language */
        LanguageDescriptor lang = portlet.getLanguageDescriptor( Locale.ENGLISH );
        assertNotNull( "lang[en]", lang );
        assertEquals( "lang[en].title", "Portlet #1", lang.getTitle(  ) );
        assertEquals( "lang[en].titleShort", "P #1", lang.getTitleShort(  ) );
        assertEquals( "lang[en].description", "Description of Portlet #1", lang.getDescription(  ) );
        assertEquals( "lang[en].keywords", "test,portlet", lang.getKeywords(  ) );

        LanguageDescriptor lang2 = portlet.getLanguageDescriptor( new Locale( "en", "US" ) );
        assertNotNull( "lang[en_US]", lang );
        assertEquals( "lang[en] != lang[en_US]", lang, lang2 );

        lang = portlet.getLanguageDescriptor( Locale.FRENCH );
        assertNotNull( "lang[fr]", lang );
        assertEquals( "lang[fr].title", "Portlet No1", lang.getTitle(  ) );

        /* Cache */
        CacheDescriptor cache = portlet.getCacheDescriptor( Portlet.Mode.VIEW );
        assertNotNull( "cache[view]", cache );
        assertEquals( "cache[view].expires", 300, cache.getExpires(  ) );
        assertFalse( "cache[view].shared", cache.isShared(  ) );

        cache = portlet.getCacheDescriptor( Portlet.Mode.HELP );
        assertNotNull( "cache[help]", cache );
        assertEquals( "cache[help].expires", -1, cache.getExpires(  ) );
        assertTrue( "cache[help].shared", cache.isShared(  ) );

        /* auth */
        AuthConstraintDescriptor auth = portlet.getAuthConstraintDescriptor( Portlet.Mode.VIEW );
        assertNotNull( "auth[view]", auth );
        assertTrue( "auth[view].allowAnonymous", auth.isAllowAnonymous(  ) );
        assertTrue( "auth[view].role[author]", auth.containsRole( "author" ) );
        assertTrue( "auth[view].role[admin]", auth.containsRole( "admin" ) );

        auth = portlet.getAuthConstraintDescriptor( Portlet.Mode.CONFIGURE );
        assertNotNull( "auth[configure]", auth );
        assertFalse( "auth[configure].allowAnonymous", auth.isAllowAnonymous(  ) );
        assertFalse( "auth[configure].role[author]", auth.containsRole( "author" ) );
        assertTrue( "auth[configure].role[admin]", auth.containsRole( "admin" ) );
       
        WebflowActionDescriptor wf = portlet.getWebflowAction( "view" );
        assertNotNull( "webflow[view]", wf );
        assertEquals( "webflow[view].success", "/success.jsp", wf.getReturnURI("success"));
        assertEquals( "webflow[view].input", "/portlet/capital/mode/view/state/maximized", wf.getReturnURI("input"));
        assertNull( "webflow[view].???", wf.getReturnURI("???"));
       
        wf = portlet.getWebflowAction( "???" );
        assertNull( "webflow[???]", wf );
    }
View Full Code Here

Examples of net.sf.jportlet.portlet.descriptor.PortletDescriptor

        Iterator it = _descriptor.getPortletDescriptors(  ).iterator(  );

        while ( it.hasNext(  ) )
        {
            PortletDescriptor descr = ( PortletDescriptor ) it.next(  );
            PortletProxy      proxy = new PortletProxy( descr );
            String            name = descr.getName(  );

            if ( info )
            {
                __log.info( "Initializing Portlet: " + name );
            }
View Full Code Here

Examples of org.jasig.portal.xml.PortletDescriptor

    }

    @Transactional
    @Override
    public void importData(ExternalPortletDefinition portletRep) {
      final PortletDescriptor portletDescriptor = portletRep.getPortletDescriptor();
      final Boolean isFramework = portletDescriptor.isIsFramework();

      if (isFramework != null && isFramework && "UPGRADED_CHANNEL_IS_NOT_A_PORTLET".equals(portletDescriptor.getPortletName())) {
        if (errorOnChannel) {
          throw new IllegalArgumentException(portletRep.getFname() + " is not a portlet. It was likely an IChannel from a previous version of uPortal and cannot be imported.");
        }

        logger.warn(portletRep.getFname() + " is not a portlet. It was likely an IChannel from a previous version of uPortal and will not be imported.");
        return;
      }
       
        // get the portlet type
        final IPortletType portletType = portletTypeRegistry.getPortletType(portletRep.getType());
        if (portletType == null) {
          throw new IllegalArgumentException("No portlet type registered for: " + portletRep.getType());
        }
       
        final List<PortletCategory> categories = new ArrayList<PortletCategory>();
        for (String categoryName : portletRep.getCategories()) {
            EntityIdentifier[] cats = GroupService.searchForGroups(categoryName, IGroupConstants.IS, IPortletDefinition.class);
           
            PortletCategory category = null;
            if (cats != null && cats.length > 0) {
                category = portletCategoryRegistry.getPortletCategory(cats[0].getKey());
            }
            else {
                category = portletCategoryRegistry.getPortletCategory(categoryName);
            }
           
            if (category == null) {
                throw new IllegalArgumentException("No category '" + categoryName + "' found when importing portlet: " + portletRep.getFname());
            }
           
            categories.add(category);
        }

        final List<IGroupMember> groups = new ArrayList<IGroupMember>();
        for (String groupName : portletRep.getGroups()) {
            EntityIdentifier[] gs = GroupService.searchForGroups(groupName, IGroupConstants.IS, IPerson.class);
            IGroupMember group;
            if (gs != null && gs.length > 0) {
                group = GroupService.findGroup(gs[0].getKey());
            } else {
                // An actual group key might be specified, so try looking up group directly
                group = GroupService.findGroup(groupName);
            }
           
            if (group == null) {
                throw new IllegalArgumentException("No group '" + groupName + "' found when importing portlet: " + portletRep.getFname());
            }
           
            groups.add(group);
        }
       
       
        final String fname = portletRep.getFname();
        IPortletDefinition def = portletDefinitionDao.getPortletDefinitionByFname(fname);
        if (def == null) {
            def = portletDefinitionDao.createPortletDefinition(
                    portletType,
                    fname,
                    portletRep.getName(),
                    portletRep.getTitle(),
                    portletDescriptor.getWebAppName(),
                    portletDescriptor.getPortletName(),
                    isFramework != null ? isFramework : false);
        }
        else {
            final IPortletDescriptorKey portletDescriptorKey = def.getPortletDescriptorKey();
            portletDescriptorKey.setPortletName(portletDescriptor.getPortletName());
            if (isFramework != null && isFramework) {
                portletDescriptorKey.setFrameworkPortlet(true);
                portletDescriptorKey.setWebAppName(null);
            }
            else {
                portletDescriptorKey.setFrameworkPortlet(false);
                portletDescriptorKey.setWebAppName(portletDescriptor.getWebAppName());
            }
        }
       
        def.setName(portletRep.getName());
        def.setTitle(portletRep.getTitle());
View Full Code Here

Examples of org.jasig.portal.xml.PortletDescriptor

  public void setChannelPublishingDefinition(PortletPublishingDefinition cpd) {

        // Set appName/portletName if a descriptor is present.  If a framework
        // portlet, the applicationId is /uPortal.
        if (cpd.getPortletDescriptor() != null) {
            final PortletDescriptor pDesc = cpd.getPortletDescriptor();
            // PortletDescriptor is a class generated from XSD.  The value of
            // isIsFramework() will commonly be null.
            final boolean isFramework = pDesc.isIsFramework() != null
                    ? pDesc.isIsFramework()
                    : false;
            applicationId = isFramework
                    ? FRAMEWORK_PORTLET_URL
                    : pDesc.getWebAppName();
            portletName = pDesc.getPortletName();
        }

    // set default values for all portlet parameters
    for (Step step : cpd.getSteps()) {
      if (step.getParameters() != null) {
View Full Code Here

Examples of org.jasig.portal.xml.PortletDescriptor

  }
 
  public boolean offerPortletSelection(PortletDefinitionForm form) {
    final IPortletType portletType = this.portletTypeRegistry.getPortletType(form.getTypeId());
    final PortletPublishingDefinition portletPublishingDefinition = this.portletPublishingDefinitionDao.getChannelPublishingDefinition(portletType.getId());
    final PortletDescriptor portletDescriptor = portletPublishingDefinition.getPortletDescriptor();
    if (portletDescriptor == null) {
        return true;
    }
   
    final Boolean isFramework = portletDescriptor.isIsFramework();
    if (isFramework != null && isFramework) {
        form.setFramework(isFramework);
    }
    else {
        final String webAppName = portletDescriptor.getWebAppName();
            form.setApplicationId(webAppName);
    }
   
    final String portletName = portletDescriptor.getPortletName();
        form.setPortletName(portletName);
   
    return false;
  }
View Full Code Here

Examples of org.jboss.shrinkwrap.descriptor.api.portletapp20.PortletDescriptor

            }
        }
    }

    private boolean processPortletXml(Archive<?> applicationArchive) {
        PortletDescriptor portletXml;
        try {
            portletXml = Descriptors.importAs(PortletDescriptor.class).fromStream(
                    applicationArchive.get("WEB-INF/portlet.xml").getAsset().openStream());

            if (null != portletXml) {
                PortletArchiveMetadata metadata = new PortletArchiveMetadata();
                List<PortletType<PortletDescriptor>> portlets = portletXml.getAllPortlet();
                for (PortletType<PortletDescriptor> portlet : portlets) {
                    metadata.addPortletName(portlet.getPortletName());
                }
                portletMetadata.set(metadata);
            }
View Full Code Here

Examples of org.jboss.shrinkwrap.descriptor.api.portletapp20.PortletDescriptor

    @Override
    public PortletArchive createSimplePortlet(Class<? extends Portlet> portletClass) {
        String name = portletClass.getSimpleName();

        PortletDescriptor desc = getOrCreatePortletDescriptor()
                .createPortlet()
                    .portletName(name)
                    .portletClass(portletClass.getName())
                    .createSupports()
                        .mimeType("text/html")
                        .portletMode(PortletMode.VIEW.toString())
                        .portletMode(PortletMode.EDIT.toString())
                        .portletMode(PortletMode.HELP.toString())
                        .up()
                    .getOrCreatePortletInfo()
                        .title(name)
                        .up()
                    .up();

        this.setPortletXML(new StringAsset(desc.exportAsString()));
        return covarientReturn();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.