Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Creative commons Attribution-NonCommercial license. 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;
import static base.jee.api.cassandra.util.UpdatePersonTokenRoleString.updatePersonTokenRoleString;
Grant personId a new role against a specific resource uid. ie Grant "John Smith" permission to update "Document" with uid "401".
public class UpsertResourceRole {
	public static void upsertResourceRole(Session sUUID personUuidString resourceString uidString roleUser updator) {
		PreparedStatement p = s.prepare("select person_uuid from role where resource=? and uid=? and person_uuid=? and role=?");
		ResultSet r = s.execute(p.bind(resourceuidpersonUuidrole));
		if(r.iterator().hasNext()) {
			p = s.prepare("insert into role (resource,uid,person_uuid,role) values(?,?,?,?)");
			log(s"INFO"updator"Added role " + role + " for person " + personUuidnew ResourceUid("Person"personUuid.toString()), new ResourceUid(resourceuid));
New to GrepCode? Check out our FAQ X