Changeset 9:b2bfc3bc9ba8 in AnnotationManagerN4J for src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java
r5 r9 5 5 6 6 import java.io.UnsupportedEncodingException; 7 import java.net.URLDecoder;8 import java.net.URLEncoder;9 7 import java.security.InvalidKeyException; 10 8 import java.security.SignatureException; … … 36 34 import org.restlet.resource.ServerResource; 37 35 36 import de.mpiwg.itgroup.annotations.Actor; 38 37 import de.mpiwg.itgroup.annotations.Annotation; 39 38 import de.mpiwg.itgroup.annotations.Annotation.FragmentTypes; … … 194 193 // make short user id 195 194 String userId = annot.getCreatorUri(); 195 // remove namespace from user uri to get id 196 196 if (userId != null && userId.startsWith(NS.MPIWG_PERSONS_URL)) { 197 userId = userId.replace(NS.MPIWG_PERSONS_URL, ""); // entferne 198 // NAMESPACE 199 } 200 // save as id 197 userId = userId.replace(NS.MPIWG_PERSONS_URL, ""); 198 } 199 // set as id 201 200 userObject.put("id", userId); 202 201 // get full name … … 390 389 * } authUser = httpUser.getIdentifier(); 391 390 */ 391 } 392 // get or create creator object 393 Actor creator = annot.getCreator(); 394 if (creator == null) { 395 creator = new Actor(false, null, null); 396 annot.setCreator(creator); 392 397 } 393 398 // username not required, if no username given authuser will be used … … 414 419 } 415 420 // try to get full name 416 if ( username != null) {421 if (creator.getName() == null && username != null) { 417 422 RestServer restServer = (RestServer) getApplication(); 418 423 String fullName = restServer.getFullNameFromLdap(username); 419 annot.setCreatorName(fullName);424 creator.setName(fullName); 420 425 } 421 426 // userUri should be a URI, if not it will set to the MPIWG namespace … … 428 433 } 429 434 // TODO: should we overwrite the creator? 430 if ( annot.getCreatorUri() == null) {431 annot.setCreatorUri(userUri);435 if (creator.getUri() == null) { 436 creator.setUri(userUri); 432 437 } 433 438
Note: See TracChangeset
for help on using the changeset viewer.