acl/src/main/java/org/springframework/security/acls/jdbc/JdbcMutableAclService.java
protected Long createOrRetrieveSidPrimaryKey(Sid sid, boolean allowCreate) {
		Assert.notNull(sid, "Sid required");

		String sidName;
		boolean sidIsPrincipal = true;

		if (sid instanceof PrincipalSid) {
			sidName = ((PrincipalSid) sid).getPrincipal();
		}
		else if (sid instanceof GrantedAuthoritySid) {
			sidName = ((GrantedAuthoritySid) sid).getGrantedAuthority();
			sidIsPrincipal = false;
		}
		else {
			throw new IllegalArgumentException("Unsupported implementation of Sid");
		}

		return createOrRetrieveSidPrimaryKey(sidName, sidIsPrincipal, allowCreate);
	}
protected Long createOrRetrieveSidPrimaryKey(Sid sid, boolean allowCreate) {
		Assert.notNull(sid, "Sid required");

		String sidName;
		boolean sidIsPrincipal = true;

		if (sid instanceof PrincipalSid) {
			sidName = ((PrincipalSid) sid).getPrincipal();
		}
		else if (sid instanceof GrantedAuthoritySid) {
			sidName = ((GrantedAuthoritySid) sid).getGrantedAuthority();
			sidIsPrincipal = false;
		}
		else {
			throw new IllegalArgumentException("Unsupported implementation of Sid");
		}

		return createOrRetrieveSidPrimaryKey(sidName, sidIsPrincipal, allowCreate);
	}
protected Long createOrRetrieveSidPrimaryKey ( Sid sid , boolean allowCreate ) { Assert . notNull ( sid , "Sid required" ) ; String sidName ; boolean sidIsPrincipal = true ; if ( sid instanceof PrincipalSid ) { sidName = ( ( PrincipalSid ) sid ) . getPrincipal ( ) ; } else if ( sid instanceof GrantedAuthoritySid ) { sidName = ( ( GrantedAuthoritySid ) sid ) . getGrantedAuthority ( ) ; sidIsPrincipal = false ; } else { throw new IllegalArgumentException ( "Unsupported implementation of Sid" ) ; } return createOrRetrieveSidPrimaryKey ( sidName , sidIsPrincipal , allowCreate ) ; }
Retrieves the primary key from acl_sid, creating a new row if needed and the
allowCreate property is true.

@param sid to find or create
@param allowCreate true if creation is permitted if not found

@return the primary key or null if not found

@throws IllegalArgumentException if the <tt>Sid</tt> is not a recognized
implementation.
Retrieves the primary key from acl_sid creating a new row if needed and the allowCreate property is true .