Package org.jasig.portal.portlet.om

Examples of org.jasig.portal.portlet.om.IPortletDefinition


            public IPortletDefinitionId call() throws Exception {

                final IPortletType channelType = jpaChannelTypeDao.createPortletType("BaseType", "foobar");
               
                //Create a definition
                final IPortletDefinition chanDef1 = jpaPortletDefinitionDao.createPortletDefinition(channelType, "fname1", "Test Portlet 1", "Test Portlet 1 Title", "/context1", "portletName1", false);
                return chanDef1.getPortletDefinitionId();
            }
        });
       
       
        final IPortletEntityId portletEntityId = execute(new Callable<IPortletEntityId>() {
            @Override
            public IPortletEntityId call() throws Exception {
                IPortletEntity portEnt1 = jpaPortletEntityDao.createPortletEntity(portletDefinitionId, "chanSub1", 1);
               
                return portEnt1.getPortletEntityId();
            }
        });
               

        execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                final IPortletEntity portEnt1a = jpaPortletEntityDao.getPortletEntity(portletEntityId);
                assertNotNull(portEnt1a);
               
                final IPortletEntity portEnt1b = jpaPortletEntityDao.getPortletEntity("chanSub1", 1);
                assertEquals(portEnt1a, portEnt1b);
               
                final IPortletEntity portEnt1c = jpaPortletEntityDao.getPortletEntity("chanSub1", 1);
                assertEquals(portEnt1b, portEnt1c);
               
                final Set<IPortletEntity> portletEntities1 = jpaPortletEntityDao.getPortletEntities(portletDefinitionId);
                assertEquals(Collections.singleton(portEnt1a), portletEntities1);
               
                final Set<IPortletEntity> portletEntitiesByUser = jpaPortletEntityDao.getPortletEntitiesForUser(1);
                assertEquals(Collections.singleton(portEnt1a), portletEntitiesByUser);
               
                return null;
            }
        });
               
        execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                //Add entity and preferences
                final IPortletDefinition portDef1 = jpaPortletDefinitionDao.getPortletDefinition(portletDefinitionId);
                portDef1.getPortletPreferences().add(new PortletPreferenceImpl("defpref1", false, "dpv1", "dpv2"));
                jpaPortletDefinitionDao.updatePortletDefinition(portDef1);
               
                final IPortletEntity portEnt1 = jpaPortletEntityDao.getPortletEntity(portletEntityId);
                portEnt1.getPortletPreferences().add(new PortletPreferenceImpl("entpref1", false, "epv1", "epv2"));
//                portEnt1.setWindowState(WindowState.MINIMIZED);
                jpaPortletEntityDao.updatePortletEntity(portEnt1);
               
                return null;
            }
        });
               
        execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                //Delete whole tree
                final IPortletDefinition portDef2 = jpaPortletDefinitionDao.getPortletDefinition(portletDefinitionId);
                jpaPortletDefinitionDao.deletePortletDefinition(portDef2);
               
                return null;
            }
        });
View Full Code Here


    @Autowired
    private IPortletDefinitionDao portletDefinitionDao;
   
    @Test
    public void testLoginAggregationLifecycle() throws Exception {
        final IPortletDefinition portletDefinition = mock(IPortletDefinition.class);
        when(portletDefinition.getName()).thenReturn("PortletName");
        when(portletDefinitionDao.getPortletDefinitionByFname("fname")).thenReturn(portletDefinition);
       
        this.execute(new CallableWithoutResult() {
            @Override
            protected void callWithoutResult() {
View Full Code Here

            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());
        def.setDescription(portletRep.getDesc());
        final BigInteger timeout = portletRep.getTimeout();
        if (timeout != null) {
            def.setTimeout(timeout.intValue());
        }
        final BigInteger actionTimeout = portletRep.getActionTimeout();
        if (actionTimeout != null) {
            def.setActionTimeout(actionTimeout.intValue());
        }
        final BigInteger eventTimeout = portletRep.getEventTimeout();
        if (eventTimeout != null) {
            def.setEventTimeout(eventTimeout.intValue());
        }
        final BigInteger renderTimeout = portletRep.getRenderTimeout();
        if (renderTimeout != null) {
            def.setRenderTimeout(renderTimeout.intValue());
        }
        final BigInteger resourceTimeout = portletRep.getResourceTimeout();
        if (resourceTimeout != null) {
            def.setResourceTimeout(resourceTimeout.intValue());
        }
        def.setType(portletType);
       
        Date now = new Date();
        IPerson systemUser = PersonFactory.createSystemPerson();
        def.setApprovalDate(now);
        def.setApproverId(systemUser.getID());
        def.setPublishDate(now);
        def.setPublisherId(systemUser.getID());    
       
       
        final Set<IPortletDefinitionParameter> parameters = new LinkedHashSet<IPortletDefinitionParameter>();
        for (ExternalPortletParameter param : portletRep.getParameters()) {
            parameters.add(new PortletDefinitionParameterImpl(param.getName(), param.getValue()));
        }
        def.setParameters(parameters);
       
        final ArrayList<IPortletPreference> preferenceList = new ArrayList<IPortletPreference>();
        for (ExternalPortletPreference pref : portletRep.getPortletPreferences()) {
            final List<String> valueList = pref.getValues();
            final String[] values = valueList.toArray(new String[valueList.size()]);
           
            final Boolean readOnly = pref.isReadOnly();
            preferenceList.add(
                    new PortletPreferenceImpl(
                            pref.getName(),
                            readOnly != null ? readOnly : false,
                            values));
        }
        def.setPortletPreferences(preferenceList);
       
        savePortletDefinition(def, PersonFactory.createSystemPerson(), categories, groups);
    }
View Full Code Here

     * @see org.jasig.portal.io.xml.IDataImporter#deleteData(java.lang.String)
     */
    @Transactional
    @Override
  public ExternalPortletDefinition deleteData(String fname) {
      final IPortletDefinition def = this.portletDefinitionDao.getPortletDefinitionByFname(fname);
      if(null == def) {
        return null;
      }
     
    ExternalPortletDefinition result = convert(def);
View Full Code Here

    }

    @Transactional
    @Override
    public void removePortletDefinition(IPortletDefinition portletDefinition, IPerson person) {
        IPortletDefinition portletDef = portletDefinitionDao.getPortletDefinition(portletDefinition.getPortletDefinitionId());

        // Delete existing category memberships for this channel
        String portletDefinitionId = portletDefinition.getPortletDefinitionId().getStringId();
        IEntity channelDefEntity = GroupService.getEntity(portletDefinitionId, IPortletDefinition.class);
        @SuppressWarnings("unchecked")
View Full Code Here

        portletDefinitionDao.deletePortletDefinition(portletDef);
    }

    @Override
    public ExternalPortletDefinition exportData(String fname) {
        final IPortletDefinition def = this.portletDefinitionDao.getPortletDefinitionByFname(fname);
        if (def == null) {
            return null;
        }
       
        return convert(def);
View Full Code Here

     * @param key java.lang.String
     */
    public String getName (String key) throws Exception {
      IPortletDefinitionRegistry registry = PortletDefinitionRegistryLocator.getPortletDefinitionRegistry();
     
        IPortletDefinition portletDefinition;
      if (StringUtils.isNumeric(key)) {
            portletDefinition = registry.getPortletDefinition(key);
      } else {
            portletDefinition = registry.getPortletDefinition(key.split("\\.")[1]);
         
      }
        return  portletDefinition.getName();
    }
View Full Code Here

   
    @ResourceMapping
    @RequestMapping(params = "action=getEntity")
    public ModelAndView getPortletDefinition(@RequestParam("id") String portletId, @RequestParam("locale") String locale)
            throws Exception {
        final IPortletDefinition definition = portletDefinitionDao.getPortletDefinition(portletId);
       
        final PortletDefinitionTranslation translation = new PortletDefinitionTranslation();
        translation.setId(portletId);
        translation.setLocale(locale);
        translation.setLocalized(new LocalizedPortletDefinition(definition, locale));
View Full Code Here

   
    @ResourceMapping
    @RequestMapping(params = "action=postTranslation")
    public ModelAndView postPortletTranslation(@RequestParam("id") String portletId,
            @RequestParam("locale") String locale, ResourceRequest request) throws Exception {
        final IPortletDefinition definition = portletDefinitionDao.getPortletDefinition(portletId);
        if (definition != null) {
            definition.addLocalizedTitle(locale, request.getParameter("title"));
            definition.addLocalizedName(locale, request.getParameter("name"));
            definition.addLocalizedDescription(locale, request.getParameter("description"));
            portletDefinitionDao.updatePortletDefinition(definition);
        }
       
        return new ModelAndView("json");
    }
View Full Code Here

            logger.warn("Failed to resolve IPortletWindow for id: " + portletWindowId + ", the id will be used instead of the fname");
            return portletWindowId.toString();
        }

        final IPortletEntity portletEntity = portletWindow.getPortletEntity();
        final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition();
        return portletDefinition.getFName();
    }
View Full Code Here

TOP

Related Classes of org.jasig.portal.portlet.om.IPortletDefinition

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.