Skip to content

Instantly share code, notes, and snippets.

@jottley
Created July 16, 2016 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jottley/2534cf4798149c869031acb087a1bfc7 to your computer and use it in GitHub Desktop.
Save jottley/2534cf4798149c869031acb087a1bfc7 to your computer and use it in GitHub Desktop.
Jive Extra Code Snippet
/**
* Copyright (C) 2005-2015 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* Alfresco is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @author Jared Ottley <jared.ottley@alfresco.com>
*/
private Long getCommunityId(String community)
{
Long communityId = null;
List<JiveCommunity> communities = jiveService.getCommunities();
communities:
for (Iterator<JiveCommunity> iterator = communities.iterator(); iterator.hasNext();)
{
JiveCommunity jiveCommunity = iterator.next();
if (jiveCommunity.getName().equals(community))
{
communityId = jiveCommunity.getId();
break communities;
}
List<JiveCommunity> subCommunities = jiveService.getSubCommunities(jiveCommunity.getId());
for (Iterator<JiveCommunity> iterator2 = subCommunities.iterator(); iterator2.hasNext();)
{
JiveCommunity jiveSubCommunity = iterator2.next();
if (jiveSubCommunity.getName().equals(community))
{
communityId = jiveSubCommunity.getId();
break communities;
}
}
}
return communityId;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment