/** * Returns the group with the primary key. * * @param groupId the primary key of the group * @return the group * @throws PortalException if a group with the primary key could not be found */ @Override public com.liferay.portal.kernel.model.Group getGroup(long groupId) throws com.liferay.portal.kernel.exception.PortalException { return _groupLocalService.getGroup(groupId); }
/** * Returns the group with the matching group key. * * @param companyId the primary key of the company * @param groupKey the group key * @return the group with the group key * @throws PortalException if a portal exception occurred */ @Override public com.liferay.portal.kernel.model.Group getGroup(long companyId, String groupKey) throws com.liferay.portal.kernel.exception.PortalException { return _groupLocalService.getGroup(companyId, groupKey); }
/** * Returns the group with the primary key. * * @param groupId the primary key of the group * @return the group * @throws PortalException if a group with the primary key could not be found */ public static com.liferay.portal.kernel.model.Group getGroup(long groupId) throws com.liferay.portal.kernel.exception.PortalException { return getService().getGroup(groupId); }
/** * Returns the group with the matching group key. * * @param companyId the primary key of the company * @param groupKey the group key * @return the group with the group key * @throws PortalException if a portal exception occurred */ public static com.liferay.portal.kernel.model.Group getGroup( long companyId, String groupKey) throws com.liferay.portal.kernel.exception.PortalException { return getService().getGroup(companyId, groupKey); }
Group group = _groupLocalService.getGroup(model.getGroupId());
private Group _getGroup(long groupId) { try { return groupLocalService.getGroup(groupId); } catch (PortalException pe) { throw new SystemException(pe); } }
@Override public Boolean hasPermission( PermissionChecker permissionChecker, long groupId, String className, long classPK, String portletId, String actionId) { try { Group group = _groupLocalService.getGroup(groupId); return doHasPermission( permissionChecker, group, className, classPK, portletId, actionId); } catch (Exception e) { _log.error(e, e); } return null; }
@Override public ManifestSummary getManifestSummary( PortletDataContext portletDataContext) throws Exception { XMLReader xmlReader = SecureXMLFactoryProviderUtil.newXMLReader(); Group group = _groupLocalService.getGroup( portletDataContext.getGroupId()); ManifestSummary manifestSummary = new ManifestSummary(); ElementHandler elementHandler = new ElementHandler( new ManifestSummaryElementProcessor(group, manifestSummary), new String[] {"header", "portlet", "staged-model"}); xmlReader.setContentHandler(elementHandler); xmlReader.parse( new InputSource( portletDataContext.getZipEntryAsInputStream("/manifest.xml"))); return manifestSummary; }
@Override public void unschedulePublishToLive(PortletRequest portletRequest) throws PortalException { long stagingGroupId = ParamUtil.getLong( portletRequest, "stagingGroupId"); Group stagingGroup = _groupLocalService.getGroup(stagingGroupId); long liveGroupId = stagingGroup.getLiveGroupId(); String jobName = ParamUtil.getString(portletRequest, "jobName"); String groupName = getSchedulerGroupName( DestinationNames.LAYOUTS_LOCAL_PUBLISHER, liveGroupId); _layoutService.unschedulePublishToLive(liveGroupId, jobName, groupName); }
/** * @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 JournalArticle fetchLatestLiveArticle(JournalArticle article) throws PortalException { Group group = groupLocalService.getGroup(article.getGroupId()); long liveGroupId = group.getLiveGroupId(); if (liveGroupId == 0) { return null; } JournalArticleResource articleResource = journalArticleResourceLocalService. fetchJournalArticleResourceByUuidAndGroupId( article.getArticleResourceUuid(), liveGroupId); if (articleResource == null) { return null; } return journalArticleLocalService.fetchLatestArticle( articleResource.getResourcePrimKey(), WorkflowConstants.STATUS_ANY, false); }
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; }
@Override public long publishPortlet( long userId, long sourceGroupId, long targetGroupId, long sourcePlid, long targetPlid, String portletId, Map<String, String[]> parameterMap) throws PortalException { User user = _userLocalService.getUser(userId); Map<String, Serializable> publishPortletSettingsMap = _exportImportConfigurationSettingsMapFactory. buildPublishPortletSettingsMap( userId, sourceGroupId, sourcePlid, targetGroupId, targetPlid, portletId, parameterMap, user.getLocale(), user.getTimeZone()); Group sourceGroup = _groupLocalService.getGroup(sourceGroupId); int type = ExportImportConfigurationConstants.TYPE_PUBLISH_PORTLET_LOCAL; if (sourceGroup.isStagedRemotely()) { type = ExportImportConfigurationConstants.TYPE_PUBLISH_PORTLET_REMOTE; } ExportImportConfiguration exportImportConfiguration = _exportImportConfigurationLocalService. addDraftExportImportConfiguration( userId, type, publishPortletSettingsMap); return publishPortlet(userId, exportImportConfiguration); }
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; }
@Override public void scheduleCopyFromLive(PortletRequest portletRequest) throws PortalException { long targetGroupId = ParamUtil.getLong( portletRequest, "stagingGroupId"); Group targetGroup = _groupLocalService.getGroup(targetGroupId); long sourceGroupId = targetGroup.getLiveGroupId(); boolean privateLayout = getPrivateLayout(portletRequest); long[] layoutIds = _exportImportHelper.getLayoutIds( portletRequest, targetGroupId); Map<String, String[]> parameterMap = _exportImportConfigurationParameterMapFactory.buildParameterMap( portletRequest); ScheduleInformation scheduleInformation = getScheduleInformation( portletRequest, targetGroupId, false); String name = ParamUtil.getString(portletRequest, "name"); _layoutService.schedulePublishToLive( sourceGroupId, targetGroupId, privateLayout, layoutIds, parameterMap, scheduleInformation.getGroupName(), scheduleInformation.getCronText(), scheduleInformation.getStartDate(), scheduleInformation.getSchedulerEndDate(), name); }
@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 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; }
@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; }