com.liferay.portal.kernel.model.Group.getCompanyId()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(13.2k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中com.liferay.portal.kernel.model.Group.getCompanyId()方法的一些代码示例,展示了Group.getCompanyId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Group.getCompanyId()方法的具体详情如下:
包路径:com.liferay.portal.kernel.model.Group
类名称:Group
方法名:getCompanyId

Group.getCompanyId介绍

暂无

代码示例

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

/**
* Returns the company ID of this group.
*
* @return the company ID of this group
*/
@Override
public long getCompanyId() {
  return _group.getCompanyId();
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

protected long getCompanyId(long groupId) throws SettingsException {
  try {
    Group group = GroupLocalServiceUtil.getGroup(groupId);
    return group.getCompanyId();
  }
  catch (PortalException pe) {
    throw new SettingsException(pe);
  }
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

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};
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

group.getCompanyId(), groupId, portletId);

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

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);
  }
}

代码示例来源:origin: com.liferay/com.liferay.journal.service

@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);
  }
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

uuid, originalGroup.getCompanyId());

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

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;
}

代码示例来源:origin: com.liferay/com.liferay.asset.publisher.web

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);
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

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;
}

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

/**
 * @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();
  }
}

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

/**
 * @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();
  }
}

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

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;
}

代码示例来源:origin: com.liferay/com.liferay.journal.service

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);
}

代码示例来源:origin: com.liferay/com.liferay.journal.service

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;
}

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

group.getCompanyId(), sourceGroupId, parameterMap,
dateRange.getStartDate(), dateRange.getEndDate(), zipWriter);

代码示例来源:origin: com.liferay/com.liferay.journal.service

@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;
}

代码示例来源:origin: com.liferay/com.liferay.message.boards.web

long companyId = group.getCompanyId();

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

@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;
}

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

@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;
}

相关文章

微信公众号

最新文章

更多