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);
}
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));
}
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;
}
Aggregations