@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)); }
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; }
PortletAdministrationHelper implements ServletContextAware { 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; } }
PortletAdministrationHelper implements ServletContextAware { 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; }  }
PortletAdministrationHelper implements ServletContextAware { 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; }  @Override void setServletContext(ServletContext servletContext); PortletDefinitionForm createPortletDefinitionForm(IPerson person, String portletId); PortletDefinitionForm savePortletRegistration(
            IPerson publisher, PortletDefinitionForm form); void removePortletRegistration(IPerson person, PortletDefinitionForm form); boolean shouldDisplayLayoutLink(
            IPerson person, PortletDefinitionForm form, String portletId); String getFragmentAdminURL(HttpServletRequest request); Set<String> getArbitraryPortletPreferenceNames(PortletDefinitionForm form); boolean supportsConfigMode(PortletDefinitionForm form); void cleanOptions(PortletDefinitionForm form, PortletRequest request); List<PortletApplicationDefinition> getPortletApplications(); PortletDefinition getPortletDescriptor(PortletDefinitionForm form); void loadDefaultsFromPortletDefinitionIfNew(PortletDefinitionForm form); PortletLifecycleState[] getLifecycleStates(); Set<PortletLifecycleState> getAllowedLifecycleStates(
            IPerson person, SortedSet<JsonEntityBean> categories); boolean hasLifecyclePermission(
            IPerson person, PortletLifecycleState state, SortedSet<JsonEntityBean> categories); IPortletWindowId getDelegateWindowId(ExternalContext externalContext, String fname); boolean configModeAction(ExternalContext externalContext, String fname); PortletPublishingDefinition updateFormForSinglePortletType(
            Map<IPortletType, PortletPublishingDefinition> portletDefinitions,
            PortletDefinitionForm form); boolean offerPortletSelection(PortletDefinitionForm form); Map<IPortletType, PortletPublishingDefinition> getAllowableChannelPublishingDefinitions(
            IPerson user); }
PortletAdministrationHelper implements ServletContextAware { 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; }  @Override void setServletContext(ServletContext servletContext); PortletDefinitionForm createPortletDefinitionForm(IPerson person, String portletId); PortletDefinitionForm savePortletRegistration(
            IPerson publisher, PortletDefinitionForm form); void removePortletRegistration(IPerson person, PortletDefinitionForm form); boolean shouldDisplayLayoutLink(
            IPerson person, PortletDefinitionForm form, String portletId); String getFragmentAdminURL(HttpServletRequest request); Set<String> getArbitraryPortletPreferenceNames(PortletDefinitionForm form); boolean supportsConfigMode(PortletDefinitionForm form); void cleanOptions(PortletDefinitionForm form, PortletRequest request); List<PortletApplicationDefinition> getPortletApplications(); PortletDefinition getPortletDescriptor(PortletDefinitionForm form); void loadDefaultsFromPortletDefinitionIfNew(PortletDefinitionForm form); PortletLifecycleState[] getLifecycleStates(); Set<PortletLifecycleState> getAllowedLifecycleStates(
            IPerson person, SortedSet<JsonEntityBean> categories); boolean hasLifecyclePermission(
            IPerson person, PortletLifecycleState state, SortedSet<JsonEntityBean> categories); IPortletWindowId getDelegateWindowId(ExternalContext externalContext, String fname); boolean configModeAction(ExternalContext externalContext, String fname); PortletPublishingDefinition updateFormForSinglePortletType(
            Map<IPortletType, PortletPublishingDefinition> portletDefinitions,
            PortletDefinitionForm form); boolean offerPortletSelection(PortletDefinitionForm form); Map<IPortletType, PortletPublishingDefinition> getAllowableChannelPublishingDefinitions(
            IPerson user);  }