掲示板

Assign Organization to Community

14年前 に Baris Sener によって更新されました。

Assign Organization to Community

Expert 投稿: 278 参加年月日: 09/06/23 最新の投稿
Hello,

When I assign an organization to a community, members of the organization can see the private pages of the community. But the problem is members of the organization do not show up under the members portlet. How can I get them to show up under the members list??

For example I have "Organization Java" and "Organization PHP". They are going to work on a project called "Liferay". So I assign "Organization Java" and "Organization PHP" to "Community Liferay". In "Community Liferay's" private page I add the members portlet and I want to be able to see the members of Organization Java and Organization PHP.

Thanks,
Baris
14年前 に Baris Sener によって更新されました。

RE: Assign Organization to Community

Expert 投稿: 278 参加年月日: 09/06/23 最新の投稿
I guess no one knows
14年前 に Baris Sener によって更新されました。

RE: Assign Organization to Community

Expert 投稿: 278 参加年月日: 09/06/23 最新の投稿
no one?????
thumbnail
14年前 に zahid khan によって更新されました。

RE: Assign Organization to Community

Regular Member 投稿: 116 参加年月日: 08/07/30 最新の投稿
Hi , why dont you write the code yourself t get the organisations or the community and then get the users of all those organization and display them.

Like from community Id get all the belonging organizations and then from organizationIs's get the user's of the respective organizations.
I am also trying to do it , if i get the solution ill post the code .

HTH

Zahid
14年前 に Baris Sener によって更新されました。

RE: Assign Organization to Community

Expert 投稿: 278 参加年月日: 09/06/23 最新の投稿
I thought about that, but it is hard to find the methods. Which methods will return the organization, which methods will return the organization's members.

Thank you for your reply,
Baris
thumbnail
14年前 に Amos Fong によって更新されました。

RE: Assign Organization to Community

Liferay Legend 投稿: 2047 参加年月日: 08/10/07 最新の投稿
Whenever you are trying to get a list of objects, almost always you want to look at the class ObjectLocalServiceUtil.java

For example, if you want to find all the organizations assigned to a community (group), look at OrganizationLocalServiceUtil.java ->which calls OrganizationLocalServiceImpl.java to see the actual code.
thumbnail
14年前 に zahid khan によって更新されました。

RE: Assign Organization to Community

Regular Member 投稿: 116 参加年月日: 08/07/30 最新の投稿
hi there you can the following code to get all the user's of all the organization that belongs to a community(group).

//long groupId = " assign the communities primary key ";

List<User> completeUserList = new ArrayList<User>();

List<Organization> orgList = OrganizationLocalServiceUtil.getGroupOrganizations(groupId);

for (Iterator iterator = orgList.iterator(); iterator.hasNext();) {

Organization organization = (Organization) iterator.next();

List<User> userList = UserLocalServiceUtil.getOrganizationUsers(organization.getOrganizationId());

completeUserList.addAll(userList);

}

the completeUserList arraList of type User contains all the member user's you want.
then you can use search iterator to dispaly all the member user's

HTH

Zahid khan
14年前 に Baris Sener によって更新されました。

RE: Assign Organization to Community

Expert 投稿: 278 参加年月日: 09/06/23 最新の投稿
I've tried the code you posted but I get this error:

An error occurred at line: 32 in the jsp file: /members/view_members.jspf
Duplicate local variable organization
29:
30: List<organization> orgList = OrganizationLocalServiceUtil.getGroupOrganizations(userParams);
31:
32: Organization organization = "";
33:
34: for (Iterator iterator = orgList.iterator(); iterator.hasNext(); organization = (Organization) iterator.next();) {
35:
</organization>


I think there is a problem with the way it iterates through the organizations. And how can I use the search iterator to go through the list of users? Does this make sense?

List resultRows = searchContainer.getResultRows();


for (int i = 0; i &lt; completeUserList.size(); i++) {
	User friend = completeUserList.get(i);

	ResultRow row = new ResultRow(friend, friend.getUserId(), i);

	// User display

	row.addJSP("/members/user_display.jsp", application, request, response);

	// Add result row

	resultRows.add(row);
}



Thanks,
Baris
thumbnail
14年前 に zahid khan によって更新されました。

RE: Assign Organization to Community

Regular Member 投稿: 116 参加年月日: 08/07/30 最新の投稿
hey baris,

it seems that you already have a variable with name organization , just use a different name like memberOrg instead of organization.

and search container looks fine you can use that.

Zahid khan
14年前 に Baris Sener によって更新されました。

RE: Assign Organization to Community

Expert 投稿: 278 参加年月日: 09/06/23 最新の投稿
33:
34: List<organization> orgList = OrganizationLocalServiceUtil.getGroupOrganizations(groupId);
35:
36: for (Iterator iterator = orgList.iterator(); iterator.hasNext(); ) {
37:
38: Organization memberOrg = (Organization) iterator.next();
39:
</organization>



Any ideas about this?

Baris
thumbnail
14年前 に Amos Fong によって更新されました。

RE: Assign Organization to Community

Liferay Legend 投稿: 2047 参加年月日: 08/10/07 最新の投稿
This may be simpler to do:

List<Organization> orgList = OrganizationLocalServiceUtil.getGroupOrganizations(groupId);

for (Organization curOrg : orgList ) {
List<Users> orgUsers = UserLocalServiceUtil.getOrganizationUsers(curOrg.getOrganizationId());
etc.
}
14年前 に Baris Sener によって更新されました。

RE: Assign Organization to Community

Expert 投稿: 278 参加年月日: 09/06/23 最新の投稿
It works like a charm. Thanks a lot for the advice. I was wondering if there is a way to include the organizations name before listing the users. I can probably get the name using "curOrg" variable, but how would I display it?

Baris
thumbnail
14年前 に Amos Fong によって更新されました。

RE: Assign Organization to Community

Liferay Legend 投稿: 2047 参加年月日: 08/10/07 最新の投稿
You have to close the java tag like so:

for (xxxx) {
%>

<b> Hi, my org name is <%= curOrg.getName() %> ! </b>

<%
}
%>

more html
14年前 に Baris Sener によって更新されました。

RE: Assign Organization to Community

Expert 投稿: 278 参加年月日: 09/06/23 最新の投稿
Is there a way to get the community name from the organization?

Let's say I have Organization A and Organization B. They are both members of Community Liferay.

In organization A's page, I want to have a portlet that will check if the organization is a member of any community; if it is, I'll get other organizations from the community, and include the community's link. So in the portlet there will be a link like this;

Organization A and Organization B's Community Page

Baris
12年前 に Michael Harper によって更新されました。

RE: Assign Organization to Community

Junior Member 投稿: 56 参加年月日: 11/08/10 最新の投稿
I know this is a very old post, but I haven't seen anything about it in any other posts.

Is the code to list the user group members of a community similar to this code for the organizations?

If so, is it implemented in the same file, or would there be a different place that I would need to edit.

Thanks!

Mike