本文整理汇总了Java中com.liferay.portal.model.Group类的典型用法代码示例。如果您正苦于以下问题:Java Group类的具体用法?Java Group怎么用?Java Group使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Group类属于com.liferay.portal.model包,在下文中一共展示了Group类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeToShite
import com.liferay.portal.model.Group; //导入依赖的package包/类
public void changeToShite(long workingUnitIdOld,long workingUnitId, User user) throws PortalException, SystemException{
WorkingUnit work = WorkingUnitLocalServiceUtil.getWorkingUnit(workingUnitId);
WorkingUnit workold = WorkingUnitLocalServiceUtil.getWorkingUnit(workingUnitIdOld);
long userId = user.getUserId();
//Group group = GroupLocalServiceUtil.getG(companyId, userId);
List<Group> groups = user.getGroups();
boolean f = false;
for (int i = 0; i < groups.size(); i++){
if (groups.get(i).getGroupId() == workold.getLocalSiteId() ){
f = true;
break;
}
}
if (work.getLocalSiteId() != workold.getLocalSiteId() || !f){
if (workold.getLocalSiteId() != PortletKeys.LONG_DEFAULT && f) {
GroupLocalServiceUtil.deleteUserGroup(userId,
workold.getLocalSiteId());
}
if (work.getLocalSiteId() != PortletKeys.LONG_DEFAULT) {
System.out.println(" changeToShite " + workingUnitId + " " + work.getLocalSiteId() + " " + userId);
GroupLocalServiceUtil.addUserGroup(userId,
work.getLocalSiteId());
System.out.println(" changeToShite " + workingUnitId + " " + work.getLocalSiteId() + " " + userId);
}
}
}
示例2: myCourses
import com.liferay.portal.model.Group; //导入依赖的package包/类
@JSONWebService
public java.util.List<Course> myCourses() throws PortalException, SystemException
{
User usuario= this.getUser();
java.util.List<Group> groups= GroupLocalServiceUtil.getUserGroups(usuario.getUserId());
java.util.List<Course> results=new java.util.ArrayList<Course>();
for(Group groupCourse:groups)
{
Course course=courseLocalService.fetchByGroupCreatedId(groupCourse.getGroupId());
if(course!=null)
{
results.add(course);
}
}
return results;
}
示例3: getUserCourses
import com.liferay.portal.model.Group; //导入依赖的package包/类
public List<Course> getUserCourses(long userId) throws PortalException, SystemException
{
User usuario= userLocalService.getUser(userId);
List<Group> groups= GroupLocalServiceUtil.getUserGroups(usuario.getUserId());
List<Course> results=new java.util.ArrayList<Course>();
for(Group groupCourse:groups)
{
Course course=courseLocalService.fetchByGroupCreatedId(groupCourse.getGroupId());
if(course!=null)
{
results.add(course);
}
}
return results;
}
示例4: importLayouts
import com.liferay.portal.model.Group; //导入依赖的package包/类
private void importLayouts(long userId,Group grupo,LayoutSetPrototype lsProto) throws PortalException, SystemException
{
LayoutSet ls = lsProto.getLayoutSet();
Map<String, String[]> parameterMap =getLayoutSetPrototypeParameters();
File fileIni= layoutLocalService.exportLayoutsAsFile(ls.getGroupId(), true,
null,parameterMap, null, null);
try
{
layoutLocalService.importLayouts(userId, grupo.getPublicLayoutSet().getGroupId(),
grupo.getPublicLayoutSet().isPrivateLayout(),
parameterMap, fileIni);
}
catch(Exception e)
{
}
FileUtil.delete(fileIni);
}
示例5: existsCourseName
import com.liferay.portal.model.Group; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public boolean existsCourseName(Long companyId, Long courseId, String groupName) throws SystemException, PortalException {
DynamicQuery consulta = DynamicQueryFactoryUtil.forClass(Group.class, PortalClassLoaderUtil.getClassLoader());
consulta.add(PropertyFactoryUtil.forName("name").eq(groupName));
consulta.add(PropertyFactoryUtil.forName("companyId").eq(companyId));
if (courseId != null) {
Course course = CourseLocalServiceUtil.getCourse(courseId);
consulta.add(PropertyFactoryUtil.forName("groupId").ne(course.getGroupCreatedId()));
}
List<Group> list = (List<Group>)GroupLocalServiceUtil.dynamicQuery(consulta);
if(!list.isEmpty() && list.size() > 0){
return true;
}
return false;
}
示例6: checkgroups
import com.liferay.portal.model.Group; //导入依赖的package包/类
@ProcessAction(name="checkgroups")
public void checkgroups(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
List<Course> courses = CourseLocalServiceUtil.findByCompanyId(themeDisplay.getCompanyId());
int counter = 0;
for(Course course: courses){
if(log.isDebugEnabled())log.debug("Course::"+course.getCourseId());
Group group = GroupLocalServiceUtil.getGroup(course.getGroupCreatedId());
ClassName cn = ClassNameLocalServiceUtil.getClassName(Course.class.getName());
if(!group.getClassName().equals(Course.class.getName())){
if(log.isDebugEnabled())log.debug("Change!"+group.getGroupId());
group.setClassNameId(cn.getClassNameId());
group.setClassPK(course.getCourseId());
GroupLocalServiceUtil.updateGroup(group);
counter++;
}
}
actionResponse.setRenderParameter("counter", String.valueOf(counter));
SessionMessages.add(actionRequest, "ok");
}
示例7: isVisible
import com.liferay.portal.model.Group; //导入依赖的package包/类
public boolean isVisible(
Portlet portlet, String category, ThemeDisplay themeDisplay)
throws Exception {
Group group = themeDisplay.getScopeGroup();
if (category.equals(PortletCategoryKeys.CONTENT) && group.isUser()) {
return false;
}
// mas ainda restaram: páginas, enquetes, configuração de workflow, equidade social
// Extender (classe e liferay-portlet.xml ext):
// com.liferay.portlet.polls.PollsControlPanelEntry
// com.liferay.portal.workflow.WorkflowControlPanelEntry
// com.liferay.portlet.socialequityadmin.SocialEquityAdminControlPanelEntry
// com.liferay.portlet.grouppages.GroupPagesControlPanelEntry
return super.isVisible(portlet, category, themeDisplay);
}
示例8: criaArtigo
import com.liferay.portal.model.Group; //导入依赖的package包/类
/**
* Cria um artigo no nó especificado
*
* @param groupId
* @param estruturaId
* @param texto
* @param legislacaoVigente
* @param ordem
*
* @throws SystemException
* @throws PortalException
*
* @return Artigo artigo recém-criado
*/
@Override
public Artigo criaArtigo(long groupId, long estruturaId,
long anteriorArtigoId, String texto, String legislacaoVigente)
throws SystemException, PortalException {
// Formata
Group group = GroupServiceUtil.getGroup(groupId);
long companyId = group.getCompanyId();
// Insere o artigo na posição correta
int ordem = atualizaPosicaoArtigos(groupId, estruturaId,
anteriorArtigoId);
Artigo artigo = artigoPersistence.create(counterLocalService
.increment());
artigo.setCompanyId(companyId);
artigo.setGroupId(groupId);
artigo.setEstruturaId(estruturaId);
artigo.setOrdem(ordem);
artigo.setTexto(texto);
artigo.setLegislacaoVigente(legislacaoVigente);
return artigoPersistence.update(artigo, true);
}
示例9: getComunidadesDisponiveis
import com.liferay.portal.model.Group; //导入依赖的package包/类
/**
* Lista todas as comunidades públicas, privadas e restritas da companhia
*
* @throws SystemException
*/
@SuppressWarnings("unchecked")
public List<Group> getComunidadesDisponiveis(final long companyId) throws SystemException {
final long groupClassNameId = ClassNameLocalServiceUtil.getClassNameId(Group.class);
final DynamicQuery query = DynamicQueryFactoryUtil.forClass(Group.class, PortalClassLoaderUtil.getClassLoader());
query.add(RestrictionsFactoryUtil.eq("companyId", companyId));
query.add(RestrictionsFactoryUtil.eq("classNameId", groupClassNameId));
query.add(RestrictionsFactoryUtil.in("type", new Object[] { GroupConstants.TYPE_SITE_OPEN, GroupConstants.TYPE_SITE_PRIVATE,
GroupConstants.TYPE_SITE_RESTRICTED }));
query.add(RestrictionsFactoryUtil.eq("parentGroupId", GroupConstants.DEFAULT_PARENT_GROUP_ID));
query.add(RestrictionsFactoryUtil.eq("active", true));
query.add(RestrictionsFactoryUtil.ne("name", GroupConstants.CONTROL_PANEL));
query.addOrder(OrderFactoryUtil.asc("name"));
return (List<Group>) GroupLocalServiceUtil.dynamicQuery(query);
}
示例10: getDadosForumExportacao
import com.liferay.portal.model.Group; //导入依赖的package包/类
/**
* Retorna os dados para exportação
*
* @param groupId
* @return
* @throws SystemException
* @throws PortalException
*/
public List<DadosForumWrapper> getDadosForumExportacao(final Long groupId) throws SystemException, PortalException {
List<DadosForumWrapper> dadosRetorno = new ArrayList<DadosForumWrapper>();
for (Group group : getGroups(groupId)) {
List<MBCategory> categorias = MBCategoryUtil.filterFindByGroupId(group.getGroupId());
if(!categorias.isEmpty()) {
for(MBCategory categoria : categorias){
addCategoryMessages(group.getGroupId(), categoria, dadosRetorno);
}
}
//Categoria para obter mensagens da raiz do fórum
MBCategory rootCategory = MBCategoryUtil.create(0l);
rootCategory.setGroupId(group.getGroupId());
addCategoryMessages(group.getGroupId(), rootCategory, dadosRetorno);
}
return dadosRetorno;
}
示例11: getDadosForumAdminExportacao
import com.liferay.portal.model.Group; //导入依赖的package包/类
/**
* Retorna os dados para exportação para administradores
*
* @param groupId
* @return
* @throws SystemException
* @throws PortalException
*/
public List<DadosForumAdminWrapper> getDadosForumAdminExportacao(final Long groupId) throws SystemException, PortalException {
List<DadosForumAdminWrapper> dadosRetorno = new ArrayList<DadosForumAdminWrapper>();
for (Group group : getGroups(groupId)) {
List<MBCategory> categorias = MBCategoryUtil.filterFindByGroupId(group.getGroupId());
if (!categorias.isEmpty()) {
for (MBCategory categoria : categorias) {
addCategoryMessagesAdmin(group.getGroupId(), categoria,
dadosRetorno);
}
}
// Categoria para obter mensagens da raiz do fórum
MBCategory rootCategory = MBCategoryUtil.create(0l);
rootCategory.setGroupId(group.getGroupId());
addCategoryMessagesAdmin(group.getGroupId(), rootCategory,dadosRetorno);
}
return dadosRetorno;
}
示例12: assinaturasThreadForum
import com.liferay.portal.model.Group; //导入依赖的package包/类
/**
* @param userId
* @throws SystemException
*/
private void assinaturasThreadForum(long userId) throws SystemException {
List<Subscription> subscricoes;
// Threads de forum
subscricoes = SubscriptionLocalServiceUtil.getUserSubscriptions(userId,
MBThread.class.getName());
for (Subscription subscricao : subscricoes) {
try {
MBThread thread = MBThreadLocalServiceUtil
.getMBThread(subscricao.getClassPK());
MBMessage mensagemRaiz = MBMessageLocalServiceUtil
.getMBMessage(thread.getRootMessageId());
if (mensagemRaiz.getClassPK() != 0)
continue;
Group grupo = GroupLocalServiceUtil.getGroup(thread
.getGroupId());
adicionaAssinatura(assinaturas, subscricao,
TipoAssinatura.FORUM_THREAD, grupo,
mensagemRaiz.getSubject());
} catch (PortalException e) {
// TODO log
}
}
}
示例13: assinaturasNoWiki
import com.liferay.portal.model.Group; //导入依赖的package包/类
/**
* @param userId
* @throws SystemException
*/
private void assinaturasNoWiki(long userId) throws SystemException {
List<Subscription> subscricoes;
// Nós de wiki
subscricoes = SubscriptionLocalServiceUtil.getUserSubscriptions(userId,
WikiNode.class.getName());
for (Subscription subscricao : subscricoes) {
try {
WikiNode noWiki = WikiNodeLocalServiceUtil
.getWikiNode(subscricao.getClassPK());
Group grupo = GroupLocalServiceUtil.getGroup(noWiki
.getGroupId());
adicionaAssinatura(assinaturas, subscricao,
TipoAssinatura.WIKI_NODE, grupo,
noWiki.getDescription());
} catch (PortalException e) {
// TODO log
}
}
}
示例14: assinaturasPaginaWiki
import com.liferay.portal.model.Group; //导入依赖的package包/类
/**
* @param userId
* @throws SystemException
*/
private void assinaturasPaginaWiki(long userId) throws SystemException {
List<Subscription> subscricoes;
// Páginas wiki
subscricoes = SubscriptionLocalServiceUtil.getUserSubscriptions(userId,
WikiPage.class.getName());
for (Subscription subscricao : subscricoes) {
try {
WikiPage paginaWiki = WikiPageLocalServiceUtil
.getWikiPage(subscricao.getClassPK());
Group grupo = GroupLocalServiceUtil.getGroup(paginaWiki
.getGroupId());
adicionaAssinatura(assinaturas, subscricao,
TipoAssinatura.WIKI_PAGE, grupo, paginaWiki.getTitle());
} catch (PortalException e) {
// TODO log
}
}
}
示例15: doView
import com.liferay.portal.model.Group; //导入依赖的package包/类
@Override
public void doView(RenderRequest renderRequest,
RenderResponse renderResponse) throws IOException, PortletException {
ThemeDisplay td = (ThemeDisplay) renderRequest
.getAttribute(WebKeys.THEME_DISPLAY);
List<Group> comunidades = getComunidades(renderRequest, td);
int pageSize = getPageSize(renderRequest);
int pageTotal = getPageTotal(comunidades, pageSize);
int currentPage = getCurrentPage(renderRequest, pageTotal);
List<ElementoComunidade> page = getPage(comunidades, td,
pageSize, currentPage);
String titulo = getTitulo();
renderRequest.setAttribute("comunidades", page);
renderRequest.setAttribute("pageSize", pageSize);
renderRequest.setAttribute("currentPage", currentPage);
renderRequest.setAttribute("pageTotal", pageTotal);
renderRequest.setAttribute("titulo", titulo);
super.doView(renderRequest, renderResponse);
}