Search in sources :

Example 11 with IPortletType

use of org.apereo.portal.portlet.om.IPortletType in project uPortal by Jasig.

the class PortletTypeImporterExporter method importData.

@Transactional
@Override
public void importData(ExternalPortletType data) {
    final String name = data.getName();
    IPortletType portletType = this.portletTypeRegistry.getPortletType(name);
    if (portletType == null) {
        portletType = this.portletTypeRegistry.createPortletType(name, data.getUri());
    } else {
        portletType.setCpdUri(data.getUri());
    }
    portletType.setDescription(data.getDescription());
    this.portletTypeRegistry.savePortletType(portletType);
}
Also used : IPortletType(org.apereo.portal.portlet.om.IPortletType) Transactional(org.springframework.transaction.annotation.Transactional)

Example 12 with IPortletType

use of org.apereo.portal.portlet.om.IPortletType in project uPortal by Jasig.

the class PortletAdministrationHelperTest method updateFormForSinglePortletTypeNoOpWhenMultiplePortletTypes.

/**
     * When there are multiple available portlet types, the method
     * updateFormForSinglePortletType(...) is a no-op returning null.
     *
     * <p>This test case verifies that the method returns null in this case.
     */
@Test
public void updateFormForSinglePortletTypeNoOpWhenMultiplePortletTypes() {
    PortletAdministrationHelper helper = new PortletAdministrationHelper();
    Map<IPortletType, PortletPublishingDefinition> portletDefinitions = new HashMap<>();
    IPortletType someType = new PortletTypeImpl("someType", "someUri");
    IPortletType someOtherType = new PortletTypeImpl("someOtherType", "someOtherUri");
    PortletPublishingDefinition someDefinition = new PortletPublishingDefinition();
    PortletPublishingDefinition someOtherDefinition = new PortletPublishingDefinition();
    portletDefinitions.put(someType, someDefinition);
    portletDefinitions.put(someOtherType, someOtherDefinition);
    PortletDefinitionForm form = new PortletDefinitionForm();
    assertNull(helper.updateFormForSinglePortletType(portletDefinitions, form));
}
Also used : PortletTypeImpl(org.apereo.portal.portlet.dao.jpa.PortletTypeImpl) HashMap(java.util.HashMap) IPortletType(org.apereo.portal.portlet.om.IPortletType) PortletPublishingDefinition(org.apereo.portal.portletpublishing.xml.PortletPublishingDefinition) Test(org.junit.Test)

Example 13 with IPortletType

use of org.apereo.portal.portlet.om.IPortletType in project uPortal by Jasig.

the class PortletAdministrationHelper method updateFormForSinglePortletType.

/**
     * updates the editPortlet form with the portletType of the first (and only) portletDefinition
     * passed in through the Map of portlet definitions.
     *
     * @param portletDefinitions
     * @param form
     * @return PortletPublishingDefinition of the first portlet definition in the list, null if the
     *     list is empty or has more than one element.
     */
public PortletPublishingDefinition updateFormForSinglePortletType(Map<IPortletType, PortletPublishingDefinition> portletDefinitions, PortletDefinitionForm form) {
    if (portletDefinitions.size() != 1) {
        return null;
    }
    IPortletType portletType = portletDefinitions.keySet().iterator().next();
    form.setTypeId(portletType.getId());
    PortletPublishingDefinition cpd = portletPublishingDefinitionDao.getChannelPublishingDefinition(portletType.getId());
    form.setChannelPublishingDefinition(cpd);
    return cpd;
}
Also used : IPortletType(org.apereo.portal.portlet.om.IPortletType) PortletPublishingDefinition(org.apereo.portal.portletpublishing.xml.PortletPublishingDefinition)

Aggregations

IPortletType (org.apereo.portal.portlet.om.IPortletType)13 PortletPublishingDefinition (org.apereo.portal.portletpublishing.xml.PortletPublishingDefinition)7 IPortletDefinition (org.apereo.portal.portlet.om.IPortletDefinition)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 IPortletPreference (org.apereo.portal.portlet.om.IPortletPreference)3 Test (org.junit.Test)3 Transactional (org.springframework.transaction.annotation.Transactional)3 Set (java.util.Set)2 IGroupMember (org.apereo.portal.groups.IGroupMember)2 PortletDefinitionImpl (org.apereo.portal.portlet.dao.jpa.PortletDefinitionImpl)2 PortletPreferenceImpl (org.apereo.portal.portlet.dao.jpa.PortletPreferenceImpl)2 IPortletDefinitionId (org.apereo.portal.portlet.om.IPortletDefinitionId)2 PortletCategory (org.apereo.portal.portlet.om.PortletCategory)2 BasePortalJpaDaoTest (org.apereo.portal.test.BasePortalJpaDaoTest)2 PortletDescriptor (org.apereo.portal.xml.PortletDescriptor)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 BigInteger (java.math.BigInteger)1