changeset 86:e3f0613b2f2d

renamed getFullname to make it configurable. fixed Restlet at 2.2.3.
author casties
date Mon, 02 Feb 2015 11:32:53 +0100
parents ed51eadc82c5
children 2beafb8e19e4
files pom.xml src/main/java/de/mpiwg/itgroup/annotations/Person.java src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java src/main/java/de/mpiwg/itgroup/annotations/restlet/BaseRestlet.java src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/PersonsResource.java
diffstat 5 files changed, 26 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/pom.xml	Mon Jan 26 18:51:28 2015 +0100
+++ b/pom.xml	Mon Feb 02 11:32:53 2015 +0100
@@ -9,7 +9,7 @@
     <neo4j-version>2.1.6</neo4j-version>
     <!-- <restlet-version>2.0.15</restlet-version> -->
     <!-- <restlet-version>2.1.7</restlet-version> -->
-    <restlet-version>2.2-SNAPSHOT</restlet-version>
+    <restlet-version>2.2.3</restlet-version>
   </properties>
   <repositories>
     <repository>
--- a/src/main/java/de/mpiwg/itgroup/annotations/Person.java	Mon Jan 26 18:51:28 2015 +0100
+++ b/src/main/java/de/mpiwg/itgroup/annotations/Person.java	Mon Feb 02 11:32:53 2015 +0100
@@ -87,7 +87,7 @@
      */
     public String updateName(BaseRestlet application) {
         if (id != null) {
-            name = application.getFullNameFromLdap(id);
+            name = application.getFullNameForId(id);
         }
         return name;
     }
--- a/src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java	Mon Jan 26 18:51:28 2015 +0100
+++ b/src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java	Mon Feb 02 11:32:53 2015 +0100
@@ -163,7 +163,7 @@
      * mode.
      * 
      * @param entity
-     * @return
+     * @return user-id
      */
     public String checkAuthToken(Representation entity) {
         @SuppressWarnings("unchecked")
@@ -248,7 +248,7 @@
                     String userName = creator.getName();
                     if (userName == null) {
                         BaseRestlet restServer = (BaseRestlet) getApplication();
-                        userName = restServer.getFullNameFromLdap(userId);
+                        userName = restServer.getFullNameForId(userId);
                     }
                     userObject.put("name", userName);
                     // save user object
@@ -624,7 +624,7 @@
         // try to get full name
         if (creator.getName() == null && username != null) {
             BaseRestlet restServer = (BaseRestlet) getApplication();
-            String fullName = restServer.getFullNameFromLdap(username);
+            String fullName = restServer.getFullNameForId(username);
             creator.setName(fullName);
         }
         // userUri should be a URI, if not it will set to the MPIWG namespace
--- a/src/main/java/de/mpiwg/itgroup/annotations/restlet/BaseRestlet.java	Mon Jan 26 18:51:28 2015 +0100
+++ b/src/main/java/de/mpiwg/itgroup/annotations/restlet/BaseRestlet.java	Mon Feb 02 11:32:53 2015 +0100
@@ -20,7 +20,8 @@
  * License along with this program.  If not, see
  * <http://www.gnu.org/licenses/lgpl-3.0.html>.
  * #L%
- * Author: Robert Casties (casties@mpiwg-berlin.mpg.de)
+ * Author: Robert Casties (casties@mpiwg-berlin.mpg.de),
+ *         Dirk Wintergruen (dwinter@mpiwg-berlin.mpg.de)
  */
 
 import java.io.File;
@@ -97,7 +98,13 @@
     protected String ldapServerUrl;
     public static final String LDAP_SERVER_KEY = "annotationmanager.ldapserver.url";
 
+    /**
+     * web frontend admin user name
+     */
     public static final String ADMIN_USER_KEY = "annotationmanager.admin.user";
+    /**
+     * web frontend admin user password
+     */
     public static final String ADMIN_PASSWORD_KEY = "annotationmanager.admin.password";
 
     /**
@@ -276,6 +283,18 @@
     }
 
     /**
+     * Return the full name (String) of the person with the given user-id.
+     * 
+     * Contacts a naming service (currently LDAP).
+     * 
+     * @param userId
+     * @return full-name
+     */
+    public String getFullNameForId(String userId) {
+    	return getFullNameFromLdap(userId);
+    }	
+    
+    /**
      * Hole den vollen Benutzernamen aus dem LDAP
      * 
      * @param creator
--- a/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/PersonsResource.java	Mon Jan 26 18:51:28 2015 +0100
+++ b/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/PersonsResource.java	Mon Feb 02 11:32:53 2015 +0100
@@ -125,7 +125,7 @@
         }
         String name = form.getFirstValue("name");
         if (name == null || name.isEmpty()) {
-            name = ((BaseRestlet) getApplication()).getFullNameFromLdap(id);
+            name = ((BaseRestlet) getApplication()).getFullNameForId(id);
         }
         String uri = form.getFirstValue("uri");
         if (uri != null && uri.isEmpty()) uri = null;