com.alogient.cameleon.sdk.membership.MembershipModelToVoConverter Maven / Gradle / Ivy
The newest version!
package com.alogient.cameleon.sdk.membership;
import com.alogient.cameleon.sdk.membership.dao.model.CustomuserfieldUservalue;
import com.alogient.cameleon.sdk.membership.dao.model.Users;
import com.alogient.cameleon.sdk.membership.vo.AuthenticationVo;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MembershipModelToVoConverter {
/**
* An utility class should not hava a visible ctor. This private one is used
* to hide the default public ctor.
*/
private MembershipModelToVoConverter() {
}
/**
* Convert a user model to an authentication vo
* @param user the user
* @param customUserValues the custom user values
* @return an authentication vo
*/
public static AuthenticationVo convertUserToAuthenticationVo(Users user, List customUserValues) {
AuthenticationVo authenticationVo = new AuthenticationVo();
authenticationVo.setUserId(user.getPkid());
authenticationVo.setUsername(user.getUsername());
authenticationVo.setComment(user.getComment());
authenticationVo.setEmail(user.getEmail());
authenticationVo.setPasswordQuestion(user.getPasswordquestion());
Map customUserValuesMap = new HashMap();
for (CustomuserfieldUservalue customUserValue : customUserValues) {
Object value = null;
if (customUserValue.getDatevalue() != null) {
value = customUserValue.getDatevalue();
} else if (customUserValue.getFloatvalue() != null) {
value = customUserValue.getFloatvalue();
} else if (customUserValue.getIntvalue() != null) {
value = customUserValue.getIntvalue();
} else if (customUserValue.getTextvalue() != null) {
value = customUserValue.getTextvalue();
}
customUserValuesMap.put(customUserValue.getPk().getCustomuserfieldname(), value);
}
authenticationVo.setCustomUserValues(customUserValuesMap);
return authenticationVo;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy