DDMFormDisplayContext { public boolean isFormShared() { PortletSession portletSession = _renderRequest.getPortletSession(false); if (portletSession != null) { return SessionParamUtil.getBoolean(_renderRequest, "shared"); } return ParamUtil.getBoolean(_renderRequest, "shared"); } DDMFormDisplayContext(
		RenderRequest renderRequest, RenderResponse renderResponse,
		DDMFormFieldTypeServicesTracker ddmFormFieldTypeServicesTracker,
		DDMFormInstanceLocalService ddmFormInstanceLocalService,
		DDMFormInstanceRecordLocalService ddmFormInstanceRecordLocalService,
		DDMFormInstanceRecordVersionLocalService
			ddmFormInstanceRecordVersionLocalService,
		DDMFormInstanceService ddmFormInstanceService,
		DDMFormInstanceVersionLocalService ddmFormInstanceVersionLocalService,
		DDMFormRenderer ddmFormRenderer,
		DDMFormValuesFactory ddmFormValuesFactory,
		DDMFormValuesMerger ddmFormValuesMerger,
		DDMFormWebConfiguration ddmFormWebConfiguration,
		DDMStorageAdapterTracker ddmStorageAdapterTracker,
		GroupLocalService groupLocalService, JSONFactory jsonFactory,
		WorkflowDefinitionLinkLocalService workflowDefinitionLinkLocalService,
		Portal portal); int getAutosaveInterval(); String[] getAvailableLanguageIds(); String getContainerId(); String getDDMFormHTML(); DDMFormSuccessPageSettings getDDMFormSuccessPageSettings(); String getDefaultLanguageId(); DDMFormInstance getFormInstance(); long getFormInstanceId(); DDMFormInstanceRecord getFormInstanceRecord(); long getFormInstanceRecordId(); String getRedirectURL(); String getSubmitLabel(); boolean hasAddFormInstanceRecordPermission(); boolean hasValidStorageType(DDMFormInstance ddmFormInstance); boolean hasViewPermission(); boolean isAutosaveEnabled(); boolean isFormAvailable(); boolean isFormShared(); boolean isPreview(); Boolean isRequireAuthentication(); boolean isShowConfigurationIcon(); boolean isShowSubmitButton(); boolean isShowSuccessPage();  }
@Test public void testIsSharedFormWithoutPortletSession() throws Exception { MockRenderRequest renderRequest = mockRenderRequest(); Assert.assertNull(renderRequest.getPortletSession(false)); renderRequest.setParameter("shared", Boolean.TRUE.toString()); DDMFormDisplayContext createDDMFormDisplayContext = createDDMFormDisplayContext(renderRequest); Assert.assertTrue(createDDMFormDisplayContext.isFormShared()); }
@Test public void testIsSharedFormWithPortletSession() throws Exception { MockRenderRequest renderRequest = mockRenderRequest(); PortletSession portletSession = renderRequest.getPortletSession(true); Assert.assertNotNull(portletSession); portletSession.setAttribute("shared", Boolean.TRUE); DDMFormDisplayContext createDDMFormDisplayContext = createDDMFormDisplayContext(renderRequest); Assert.assertTrue(createDDMFormDisplayContext.isFormShared()); }