Package org.jasig.portal.xml

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


  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

  }
 
  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

TOP

Related Classes of org.jasig.portal.xml.PortletDescriptor

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.