List of usage examples for com.liferay.portal.kernel.model Organization getPreferences
public javax.portlet.PortletPreferences getPreferences();
From source file:com.liferay.users.admin.web.internal.portlet.action.EditOrganizationMVCActionCommand.java
License:Open Source License
protected Organization updateOrganization(ActionRequest actionRequest) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long organizationId = ParamUtil.getLong(actionRequest, "organizationId"); long parentOrganizationId = ParamUtil.getLong(actionRequest, "parentOrganizationSearchContainerPrimaryKeys", OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID); String name = ParamUtil.getString(actionRequest, "name"); long statusId = ParamUtil.getLong(actionRequest, "statusId"); String type = ParamUtil.getString(actionRequest, "type"); long regionId = ParamUtil.getLong(actionRequest, "regionId"); long countryId = ParamUtil.getLong(actionRequest, "countryId"); String comments = ParamUtil.getString(actionRequest, "comments"); boolean deleteLogo = ParamUtil.getBoolean(actionRequest, "deleteLogo"); byte[] logoBytes = null; long fileEntryId = ParamUtil.getLong(actionRequest, "fileEntryId"); if (fileEntryId > 0) { FileEntry fileEntry = _dlAppLocalService.getFileEntry(fileEntryId); logoBytes = FileUtil.getBytes(fileEntry.getContentStream()); }//w w w.j av a 2s.c o m boolean site = ParamUtil.getBoolean(actionRequest, "site"); List<Address> addresses = UsersAdminUtil.getAddresses(actionRequest); List<EmailAddress> emailAddresses = UsersAdminUtil.getEmailAddresses(actionRequest); List<OrgLabor> orgLabors = UsersAdminUtil.getOrgLabors(actionRequest); List<Phone> phones = UsersAdminUtil.getPhones(actionRequest); List<Website> websites = UsersAdminUtil.getWebsites(actionRequest); ServiceContext serviceContext = ServiceContextFactory.getInstance(Organization.class.getName(), actionRequest); Organization organization = null; if (organizationId <= 0) { // Add organization organization = _organizationService.addOrganization(parentOrganizationId, name, type, regionId, countryId, statusId, comments, site, addresses, emailAddresses, orgLabors, phones, websites, serviceContext); } else { // Update organization organization = _organizationService.updateOrganization(organizationId, parentOrganizationId, name, type, regionId, countryId, statusId, comments, !deleteLogo, logoBytes, site, addresses, emailAddresses, orgLabors, phones, websites, serviceContext); } // Layout set prototypes long publicLayoutSetPrototypeId = ParamUtil.getLong(actionRequest, "publicLayoutSetPrototypeId"); long privateLayoutSetPrototypeId = ParamUtil.getLong(actionRequest, "privateLayoutSetPrototypeId"); boolean publicLayoutSetPrototypeLinkEnabled = ParamUtil.getBoolean(actionRequest, "publicLayoutSetPrototypeLinkEnabled", publicLayoutSetPrototypeId > 0); boolean privateLayoutSetPrototypeLinkEnabled = ParamUtil.getBoolean(actionRequest, "privateLayoutSetPrototypeLinkEnabled", privateLayoutSetPrototypeId > 0); Group organizationGroup = organization.getGroup(); if (GroupPermissionUtil.contains(themeDisplay.getPermissionChecker(), organizationGroup, ActionKeys.UPDATE)) { SitesUtil.updateLayoutSetPrototypesLinks(organizationGroup, publicLayoutSetPrototypeId, privateLayoutSetPrototypeId, publicLayoutSetPrototypeLinkEnabled, privateLayoutSetPrototypeLinkEnabled); } // Reminder queries String reminderQueries = actionRequest.getParameter("reminderQueries"); PortletPreferences portletPreferences = organization.getPreferences(); LocalizationUtil.setLocalizedPreferencesValues(actionRequest, portletPreferences, "reminderQueries"); portletPreferences.setValue("reminderQueries", reminderQueries); portletPreferences.store(); return organization; }