/** * Returns the company ID of this group. * * @return the company ID of this group */ @Override public long getCompanyId() { return _group.getCompanyId(); }
protected long getCompanyId(long groupId) throws SettingsException { try { Group group = GroupLocalServiceUtil.getGroup(groupId); return group.getCompanyId(); } catch (PortalException pe) { throw new SettingsException(pe); } }
protected long[] addScopeGroup(long groupId) { try { List<Long> groupIds = new ArrayList<>(); groupIds.add(groupId); Group group = GroupLocalServiceUtil.getGroup(groupId); List<Group> groups = GroupLocalServiceUtil.getGroups( group.getCompanyId(), Layout.class.getName(), group.getGroupId()); for (Group scopeGroup : groups) { groupIds.add(scopeGroup.getGroupId()); } return ArrayUtil.toLongArray(groupIds); } catch (Exception e) { _log.error(e, e); } return new long[] {groupId}; }
group.getCompanyId(), groupId, portletId);
private static LocalRepository _addPortletRepository( long groupId, ServiceContext serviceContext) throws PortalException { Repository repository = RepositoryLocalServiceUtil.fetchRepository( groupId, TempFileEntryUtil.class.getName(), StringPool.BLANK); if (repository != null) { return RepositoryProviderUtil.getLocalRepository( repository.getRepositoryId()); } Group group = GroupLocalServiceUtil.getGroup(groupId); User user = UserLocalServiceUtil.getDefaultUser(group.getCompanyId()); long classNameId = PortalUtil.getClassNameId( "com.liferay.portal.repository.temporaryrepository." + "TemporaryFileEntryRepository"); UnicodeProperties typeSettingsProperties = new UnicodeProperties(); boolean dlAppHelperEnabled = DLAppHelperThreadLocal.isEnabled(); try { DLAppHelperThreadLocal.setEnabled(false); repository = RepositoryLocalServiceUtil.addRepository( user.getUserId(), groupId, classNameId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, TempFileEntryUtil.class.getName(), StringPool.BLANK, StringPool.BLANK, typeSettingsProperties, true, serviceContext); return RepositoryProviderUtil.getLocalRepository( repository.getRepositoryId()); } finally { DLAppHelperThreadLocal.setEnabled(dlAppHelperEnabled); } }
@Override public void onBeforeRemove(Group group) throws ModelListenerException { try { _subscriptionLocalService.deleteSubscriptions( group.getCompanyId(), JournalArticle.class.getName(), group.getGroupId()); } catch (Exception e) { throw new ModelListenerException(e); } }
uuid, originalGroup.getCompanyId());
protected List<Role> getGroupRoles(long groupId, String resourceName) throws PortalException { List<Role> roles = groupRolesMap.get(groupId); if (roles != null) { return roles; } Group group = GroupLocalServiceUtil.getGroup(groupId); roles = ListUtil.copy( ResourceActionsUtil.getRoles( group.getCompanyId(), group, resourceName, null)); Map<Team, Role> teamRoleMap = RoleLocalServiceUtil.getTeamRoleMap( groupId); for (Map.Entry<Team, Role> entry : teamRoleMap.entrySet()) { Team team = entry.getKey(); Role teamRole = entry.getValue(); teamRole.setName( ExportImportPermissionUtil.getTeamRoleName(team.getName())); teamRole.setDescription(team.getDescription()); roles.add(teamRole); } groupRolesMap.put(groupId, roles); return roles; }
private Layout _createAssetDisplayLayout(long groupId) throws PortalException { Group group = _groupLocalService.fetchGroup(groupId); long defaultUserId = _userLocalService.getDefaultUserId( group.getCompanyId()); Locale locale = LocaleUtil.getSiteDefault(); Map<Locale, String> nameMap = new HashMap<>(); nameMap.put(locale, "Asset Display Page"); UnicodeProperties typeSettingsProperties = new UnicodeProperties(); typeSettingsProperties.put("visible", Boolean.FALSE.toString()); ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext(); serviceContext.setAttribute( "layout.instanceable.allowed", Boolean.TRUE); return _layoutLocalService.addLayout( defaultUserId, groupId, false, 0, nameMap, null, null, null, null, "asset_display", typeSettingsProperties.toString(), true, new HashMap<>(), serviceContext); }
public static GroupSoap toSoapModel(Group model) { GroupSoap soapModel = new GroupSoap(); soapModel.setMvccVersion(model.getMvccVersion()); soapModel.setUuid(model.getUuid()); soapModel.setGroupId(model.getGroupId()); soapModel.setCompanyId(model.getCompanyId()); soapModel.setCreatorUserId(model.getCreatorUserId()); soapModel.setClassNameId(model.getClassNameId()); soapModel.setClassPK(model.getClassPK()); soapModel.setParentGroupId(model.getParentGroupId()); soapModel.setLiveGroupId(model.getLiveGroupId()); soapModel.setTreePath(model.getTreePath()); soapModel.setGroupKey(model.getGroupKey()); soapModel.setName(model.getName()); soapModel.setDescription(model.getDescription()); soapModel.setType(model.getType()); soapModel.setTypeSettings(model.getTypeSettings()); soapModel.setManualMembership(model.isManualMembership()); soapModel.setMembershipRestriction(model.getMembershipRestriction()); soapModel.setFriendlyURL(model.getFriendlyURL()); soapModel.setSite(model.isSite()); soapModel.setRemoteStagingGroupCount(model.getRemoteStagingGroupCount()); soapModel.setInheritContent(model.isInheritContent()); soapModel.setActive(model.isActive()); return soapModel; }
/** * @deprecated As of Judson (7.1.x), replaced by {@link * #getManifestSummary(PortletDataContext)} */ @Deprecated @Override public ManifestSummary getManifestSummary( long userId, long groupId, Map<String, String[]> parameterMap, File file) throws Exception { final Group group = _groupLocalService.getGroup(groupId); String userIdStrategy = MapUtil.getString( parameterMap, PortletDataHandlerKeys.USER_ID_STRATEGY); ZipReader zipReader = ZipReaderFactoryUtil.getZipReader(file); PortletDataContext portletDataContext = _portletDataContextFactory.createImportPortletDataContext( group.getCompanyId(), groupId, parameterMap, getUserIdStrategy(userId, userIdStrategy), zipReader); try { return getManifestSummary(portletDataContext); } finally { zipReader.close(); } }
/** * @deprecated As of Judson (7.1.x), replaced by {@link * #validateMissingReferences(PortletDataContext)} */ @Deprecated @Override public MissingReferences validateMissingReferences( long userId, long groupId, Map<String, String[]> parameterMap, File file) throws Exception { Group group = _groupLocalService.getGroup(groupId); String userIdStrategy = MapUtil.getString( parameterMap, PortletDataHandlerKeys.USER_ID_STRATEGY); ZipReader zipReader = ZipReaderFactoryUtil.getZipReader(file); PortletDataContext portletDataContext = _portletDataContextFactory.createImportPortletDataContext( group.getCompanyId(), groupId, parameterMap, getUserIdStrategy(userId, userIdStrategy), zipReader); try { return validateMissingReferences(portletDataContext); } finally { zipReader.close(); } }
protected PortletDataContext getPortletDataContext( ExportImportConfiguration exportImportConfiguration, File file) throws PortalException { Map<String, Serializable> settingsMap = exportImportConfiguration.getSettingsMap(); long userId = MapUtil.getLong(settingsMap, "userId"); long targetGroupId = MapUtil.getLong(settingsMap, "targetGroupId"); boolean privateLayout = MapUtil.getBoolean( settingsMap, "privateLayout"); Map<String, String[]> parameterMap = (Map<String, String[]>)settingsMap.get("parameterMap"); Group group = _groupLocalService.getGroup(targetGroupId); String userIdStrategyString = MapUtil.getString( parameterMap, PortletDataHandlerKeys.USER_ID_STRATEGY); UserIdStrategy userIdStrategy = _exportImportHelper.getUserIdStrategy( userId, userIdStrategyString); ZipReader zipReader = ZipReaderFactoryUtil.getZipReader(file); PortletDataContext portletDataContext = _portletDataContextFactory.createImportPortletDataContext( group.getCompanyId(), targetGroupId, parameterMap, userIdStrategy, zipReader); portletDataContext.setExportImportProcessId( String.valueOf( exportImportConfiguration.getExportImportConfigurationId())); portletDataContext.setPrivateLayout(privateLayout); return portletDataContext; }
protected JournalArticle fetchExistingArticleWithParentGroups( String articleUuid, String articleResourceUuid, long groupId, String articleId, String newArticleId, double version, boolean preloaded) { Group group = _groupLocalService.fetchGroup(groupId); if (group == null) { return null; } long companyId = group.getCompanyId(); while (group != null) { JournalArticle article = fetchExistingArticle( articleUuid, articleResourceUuid, group.getGroupId(), articleId, newArticleId, version, preloaded); if (article != null) { return article; } group = group.getParentGroup(); } Group companyGroup = _groupLocalService.fetchCompanyGroup(companyId); if (companyGroup == null) { return null; } return fetchExistingArticle( articleUuid, articleResourceUuid, companyGroup.getGroupId(), articleId, newArticleId, version, preloaded); }
protected SearchContext buildSearchContext( long groupId, long userId, long creatorUserId, int status, int start, int end) throws PortalException { SearchContext searchContext = new SearchContext(); searchContext.setAttribute(Field.STATUS, status); searchContext.setAttribute("paginationType", "none"); if (creatorUserId > 0) { searchContext.setAttribute( Field.USER_ID, String.valueOf(creatorUserId)); } Group group = groupLocalService.getGroup(groupId); searchContext.setCompanyId(group.getCompanyId()); searchContext.setEnd(end); searchContext.setGroupIds(new long[] {groupId}); searchContext.setSorts(new Sort(Field.MODIFIED_DATE, true)); searchContext.setStart(start); searchContext.setUserId(userId); return searchContext; }
group.getCompanyId(), sourceGroupId, parameterMap, dateRange.getStartDate(), dateRange.getEndDate(), zipWriter);
@Override public JournalContentSearch updateContentSearch( long groupId, boolean privateLayout, long layoutId, String portletId, String articleId, boolean purge) throws PortalException { if (purge) { journalContentSearchPersistence.removeByG_P_L_P( groupId, privateLayout, layoutId, portletId); } Group group = groupLocalService.getGroup(groupId); JournalContentSearch contentSearch = journalContentSearchPersistence.fetchByG_P_L_P_A( groupId, privateLayout, layoutId, portletId, articleId); if (contentSearch == null) { long contentSearchId = counterLocalService.increment(); contentSearch = journalContentSearchPersistence.create( contentSearchId); contentSearch.setGroupId(groupId); contentSearch.setCompanyId(group.getCompanyId()); contentSearch.setPrivateLayout(privateLayout); contentSearch.setLayoutId(layoutId); contentSearch.setPortletId(portletId); contentSearch.setArticleId(articleId); } journalContentSearchPersistence.update(contentSearch); return contentSearch; }
long companyId = group.getCompanyId();
@Override public Void call() throws PortalException { Group group = _groupLocalService.getGroup(_groupId); Layout layout = _layoutLocalService.fetchLayout(_plid); if (group.hasStagingGroup()) { group = group.getStagingGroup(); if (layout != null) { layout = _layoutLocalService.fetchLayoutByUuidAndGroupId( layout.getUuid(), group.getGroupId(), layout.isPrivateLayout()); } } javax.portlet.PortletPreferences jxPortletPreferences = null; if (layout == null) { jxPortletPreferences = PortletPreferencesFactoryUtil.getStrictPortletSetup( group.getCompanyId(), group.getGroupId(), _portletId); } else { jxPortletPreferences = PortletPreferencesFactoryUtil.getStrictPortletSetup( layout, _portletId); } ExportImportDateUtil.updateLastPublishDate( _portletId, jxPortletPreferences, _dateRange, _endDate); return null; }
@Override public ManifestSummary getManifestSummary( long userId, long groupId, Map<String, String[]> parameterMap, FileEntry fileEntry) throws Exception { File file = FileUtil.createTempFile("lar"); ZipReader zipReader = null; ManifestSummary manifestSummary = null; try (InputStream inputStream = _dlFileEntryLocalService.getFileAsStream( fileEntry.getFileEntryId(), fileEntry.getVersion(), false)) { FileUtil.write(file, inputStream); Group group = _groupLocalService.getGroup(groupId); String userIdStrategy = MapUtil.getString( parameterMap, PortletDataHandlerKeys.USER_ID_STRATEGY); zipReader = ZipReaderFactoryUtil.getZipReader(file); PortletDataContext portletDataContext = _portletDataContextFactory.createImportPortletDataContext( group.getCompanyId(), groupId, parameterMap, getUserIdStrategy(userId, userIdStrategy), zipReader); manifestSummary = getManifestSummary(portletDataContext); } finally { if (zipReader != null) { zipReader.close(); } FileUtil.delete(file); } return manifestSummary; }