]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/nature/CoworkerUserNatureMapper.java
815170a6a8bece078aaabf3fb014682b7cf8c158
1 package org
.argeo
.security
.ldap
.nature
;
3 import org
.argeo
.security
.UserNature
;
4 import org
.argeo
.security
.ldap
.UserNatureMapper
;
5 import org
.argeo
.security
.nature
.CoworkerNature
;
6 import org
.springframework
.ldap
.core
.DirContextAdapter
;
7 import org
.springframework
.ldap
.core
.DirContextOperations
;
9 public class CoworkerUserNatureMapper
implements UserNatureMapper
{
11 public UserNature
mapUserInfoFromContext(DirContextOperations ctx
) {
12 CoworkerNature nature
= new CoworkerNature();
13 nature
.setMobile(ctx
.getStringAttribute("mobile"));
14 nature
.setTelephoneNumber(ctx
.getStringAttribute("telephoneNumber"));
16 if (nature
.getMobile() == null
17 && nature
.getTelephoneNumber() == null)
23 public void mapUserInfoToContext(UserNature userInfoArg
,
24 DirContextAdapter ctx
) {
25 CoworkerNature nature
= (CoworkerNature
) userInfoArg
;
26 if (nature
.getMobile() == null || !nature
.getMobile().equals("")) {
27 ctx
.setAttributeValue("mobile", nature
.getMobile());
29 if (nature
.getTelephoneNumber() == null
30 || !nature
.getTelephoneNumber().equals("")) {
31 ctx
.setAttributeValue("telephoneNumber", nature
32 .getTelephoneNumber());
36 public Boolean
supports(UserNature userNature
) {
37 return userNature
instanceof CoworkerNature
;