use of org.apereo.portal.portletpublishing.xml.PortletPublishingDefinition in project uPortal by Jasig.
the class XmlChannelPublishingDefinitionDao method getSharedParameters.
private List<Step> getSharedParameters() {
if (this.sharedParameters != null) {
return this.sharedParameters;
}
// read and parse the shared CPD
final Resource paramResource = this.resourceLoader.getResource("classpath:" + SHARED_PARAMETERS_PATH);
if (!paramResource.exists()) {
throw new MissingResourceException("Failed to find shared parameters CPD '" + SHARED_PARAMETERS_PATH + "'", this.getClass().getName(), SHARED_PARAMETERS_PATH);
}
final InputStream paramStream;
try {
paramStream = paramResource.getInputStream();
} catch (IOException e) {
throw new MissingResourceException("Failed to load CPD '" + SHARED_PARAMETERS_PATH + "'", this.getClass().getName(), SHARED_PARAMETERS_PATH);
}
// parse the shared CPD and add its steps to the end of the type-specific
try {
PortletPublishingDefinition config = (PortletPublishingDefinition) unmarshaller.unmarshal(paramStream);
this.sharedParameters = config.getSteps();
} catch (JAXBException e) {
logger.warn("Failed to parse: " + paramResource, e);
} finally {
IOUtils.closeQuietly(paramStream);
}
return this.sharedParameters;
}
use of org.apereo.portal.portletpublishing.xml.PortletPublishingDefinition in project uPortal by Jasig.
the class XmlChannelPublishingDefinitionDao method getChannelPublishingDefinitions.
/* (non-Javadoc)
* @see org.apereo.portal.portlets.portletadmin.xmlsupport.IChannelPublishingDefinitionDao#getChannelPublishingDefinitions()
*/
@Override
public Map<IPortletType, PortletPublishingDefinition> getChannelPublishingDefinitions() {
final List<IPortletType> channelTypes = this.portletTypeRegistry.getPortletTypes();
final Map<IPortletType, PortletPublishingDefinition> cpds = new LinkedHashMap<IPortletType, PortletPublishingDefinition>(channelTypes.size());
for (final IPortletType channelType : channelTypes) {
final PortletPublishingDefinition cpd = this.getChannelPublishingDefinition(channelType.getId());
cpds.put(channelType, cpd);
}
return cpds;
}
use of org.apereo.portal.portletpublishing.xml.PortletPublishingDefinition in project uPortal by Jasig.
the class XmlChannelPublishingDefinitionDaoTest method testGetChannelPublishingDefinition.
@Test
public void testGetChannelPublishingDefinition() {
PortletPublishingDefinition portletPublishingDefinition = xmlChannelPublishingDefinitionDao.getChannelPublishingDefinition(1010);
assertEquals(portletPublishingDefinition.getPortletDescriptor().getPortletName(), "WebProxyPortlet");
assertEquals(portletPublishingDefinition.getPortletDescriptor().getWebAppName(), "/WebProxyPortlet");
assertEquals(portletPublishingDefinition.getSteps().size(), 1);
List<Step> steps = portletPublishingDefinition.getSteps();
Step step = steps.get(0);
assertEquals(step.getName(), "General Configuration");
assertEquals(step.getDescription(), "Use the configuration options after reviewing the portlet publishing information to configure the portlet.");
}
use of org.apereo.portal.portletpublishing.xml.PortletPublishingDefinition 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;
}
use of org.apereo.portal.portletpublishing.xml.PortletPublishingDefinition in project uPortal by Jasig.
the class PortletAdministrationHelper method getArbitraryPortletPreferenceNames.
/**
* Get a list of the key names of the currently-set arbitrary portlet preferences.
*
* @param form
* @return
*/
public Set<String> getArbitraryPortletPreferenceNames(PortletDefinitionForm form) {
// set default values for all portlet parameters
PortletPublishingDefinition cpd = this.portletPublishingDefinitionDao.getChannelPublishingDefinition(form.getTypeId());
Set<String> currentPrefs = new HashSet<>();
currentPrefs.addAll(form.getPortletPreferences().keySet());
for (Step step : cpd.getSteps()) {
if (step.getPreferences() != null) {
for (Preference pref : step.getPreferences()) {
currentPrefs.remove(pref.getName());
}
}
}
return currentPrefs;
}
Aggregations