forked from geonetwork/core-geonetwork
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e63d6a
commit acc67c0
Showing
19 changed files
with
558 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
services/src/main/java/org/fao/geonet/api/users/transfer/OwnerResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (C) 2001-2016 Food and Agriculture Organization of the | ||
* United Nations (FAO-UN), United Nations World Food Programme (WFP) | ||
* and United Nations Environment Programme (UNEP) | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or (at | ||
* your option) any later version. | ||
* | ||
* This program 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 | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA | ||
* | ||
* Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2, | ||
* Rome - Italy. email: [email protected] | ||
*/ | ||
|
||
package org.fao.geonet.api.users.transfer; | ||
|
||
import org.fao.geonet.domain.User; | ||
|
||
public class OwnerResponse { | ||
int id; | ||
String name; | ||
int records; | ||
|
||
public OwnerResponse(User u, int size) { | ||
this.id = u.getId(); | ||
this.name = String.format("%s %s (%s)", | ||
u.getName(), u.getSurname(), u.getUsername() | ||
); | ||
this.records = size; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public void setId(int id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public int getRecords() { | ||
return records; | ||
} | ||
|
||
public void setRecords(int records) { | ||
this.records = records; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,14 +21,15 @@ | |
//=== Rome - Italy. email: [email protected] | ||
//============================================================================== | ||
|
||
package org.fao.geonet.services.ownership; | ||
package org.fao.geonet.api.users.transfer; | ||
|
||
import com.google.common.base.Function; | ||
import com.google.common.collect.Lists; | ||
|
||
import jeeves.server.UserSession; | ||
import jeeves.server.context.ServiceContext; | ||
|
||
import org.fao.geonet.ApplicationContextHolder; | ||
import org.fao.geonet.domain.Profile; | ||
import org.fao.geonet.domain.User; | ||
import org.fao.geonet.domain.UserGroup; | ||
|
@@ -68,6 +69,7 @@ public static List<Element> getEditorUsers(ServiceContext context, UserSession u | |
return getUsers(context, us, users); | ||
} | ||
|
||
@Deprecated | ||
public static List<Element> getUsers(ServiceContext context, UserSession us, List<User> users) throws SQLException { | ||
|
||
int id = us.getUserIdAsInt(); | ||
|
@@ -110,13 +112,7 @@ public Element apply(@Nonnull User input) { | |
return newList; | ||
} | ||
|
||
//-------------------------------------------------------------------------- | ||
//--- | ||
//--- Private methods | ||
//--- | ||
//-------------------------------------------------------------------------- | ||
|
||
private static Set<String> getUserGroups(ServiceContext context, int id) throws SQLException { | ||
protected static Set<String> getUserGroups(ServiceContext context, int id) throws SQLException { | ||
HashSet<String> groupIds = new HashSet<String>(); | ||
|
||
final List<UserGroup> users = context.getBean(UserGroupRepository.class).findAll(UserGroupSpecs.hasUserId(id)); | ||
|
@@ -127,6 +123,3 @@ private static Set<String> getUserGroups(ServiceContext context, int id) throws | |
return groupIds; | ||
} | ||
} | ||
|
||
//============================================================================= | ||
|
Oops, something went wrong.