Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Creative commons Attribution-NonCommercial license. http://creativecommons.org/licenses/by-nc/2.5/au/deed.en_GB NO WARRANTY IS GIVEN OR IMPLIED, USE AT YOUR OWN RISK.
 
 package base.jee.api.cassandra.util;
 
import static base.jee.api.cassandra.util.Log.log;
public class UpdatePersonFromLdap {
	public static void updatePersonFromLdap(Session sUser userString firstNameString lastNameString emailthrows IOException {
		if(email != null && email.length() < 4) {
			log(s"FINEST"user"LDAP Update: LDAP server sends invalid email: " + emailnew ResourceUid("Person"user.getPersonUuid()));
			email = null;
		}
		if(firstName != null) {
			PreparedStatement p = s.prepare("update person set first_name=? where uuid=?");
			s.execute(p.bind(firstNameuser.getPersonUuid()));
			log(s"INFO"user"LDAP Update: First name updated to: " + firstNamenew ResourceUid("Person"user.getPersonUuid()));
		}
		if(lastName != null) {
			PreparedStatement p = s.prepare("update person set last_name=? where uuid=?");
			s.execute(p.bind(lastNameuser.getPersonUuid()));
			log(s"INFO"user"LDAP Update: Last name updated to: " + lastNamenew ResourceUid("Person"user.getPersonUuid()));
		}
		if(email != null) {
			PreparedStatement p = s.prepare("update person set email=? where uuid=?");
			s.execute(p.bind(emailuser.getPersonUuid()));
			log(s"INFO"user"LDAP Update: Email updated to: " + lastNamenew ResourceUid("Person"user.getPersonUuid()));
		}
	}
New to GrepCode? Check out our FAQ X