@Test public void relatedUser() throws ParseException { IntAttrName intAttrName = intAttrNameParser.parse("users[bellini].firstname", AnyTypeKind.USER); assertNotNull(intAttrName); assertEquals(AnyTypeKind.USER, intAttrName.getAnyTypeKind()); assertNull(intAttrName.getField()); assertEquals("firstname", intAttrName.getSchema().getKey()); assertEquals(SchemaType.PLAIN, intAttrName.getSchemaType()); assertTrue(intAttrName.getSchema() instanceof PlainSchema); assertEquals("bellini", intAttrName.getRelatedUser()); assertNull(intAttrName.getEnclosingGroup()); assertNull(intAttrName.getMembershipOfGroup()); assertNull(intAttrName.getRelatedAnyObject()); assertNull(intAttrName.getPrivilegesOfApplication()); assertNull(intAttrName.getRelationshipAnyType()); assertNull(intAttrName.getRelationshipType()); }
@Transactional(readOnly = true) public IntAttrName parse(final String intAttrName, final AnyTypeKind provisionAnyTypeKind) throws ParseException { IntAttrName result = new IntAttrName(); Matcher matcher; if (intAttrName.indexOf('.') == -1) { matcher = PRIVILEGE_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.USER); result.setPrivilegesOfApplication(matcher.group(1)); } else { result.setAnyTypeKind(provisionAnyTypeKind); setFieldOrSchemaName(intAttrName, result.getAnyTypeKind(), result); } } else { matcher = ENCLOSING_GROUP_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.GROUP); result.setEnclosingGroup(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = RELATED_ANY_OBJECT_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.ANY_OBJECT); result.setRelatedAnyObject(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = MEMBERSHIP_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.USER); result.setMembershipOfGroup(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = RELATED_USER_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.USER); result.setRelatedUser(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = RELATIONSHIP_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.ANY_OBJECT); result.setRelationshipType(matcher.group(1)); result.setRelationshipAnyType(matcher.group(2)); setFieldOrSchemaName(matcher.group(3), result.getAnyTypeKind(), result); } else { throw new ParseException("Unparsable expression: " + intAttrName, 0); } } } } } } return result; }
IntAttrNameParser { @Transactional(readOnly = true) public IntAttrName parse(final String intAttrName, final AnyTypeKind provisionAnyTypeKind) throws ParseException { IntAttrName result = new IntAttrName(); Matcher matcher; if (intAttrName.indexOf('.') == -1) { matcher = PRIVILEGE_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.USER); result.setPrivilegesOfApplication(matcher.group(1)); } else { result.setAnyTypeKind(provisionAnyTypeKind); setFieldOrSchemaName(intAttrName, result.getAnyTypeKind(), result); } } else { matcher = ENCLOSING_GROUP_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.GROUP); result.setEnclosingGroup(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = RELATED_ANY_OBJECT_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.ANY_OBJECT); result.setRelatedAnyObject(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = MEMBERSHIP_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.USER); result.setMembershipOfGroup(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = RELATED_USER_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.USER); result.setRelatedUser(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = RELATIONSHIP_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.ANY_OBJECT); result.setRelationshipType(matcher.group(1)); result.setRelationshipAnyType(matcher.group(2)); setFieldOrSchemaName(matcher.group(3), result.getAnyTypeKind(), result); } else { throw new ParseException("Unparsable expression: " + intAttrName, 0); } } } } } } return result; } }
IntAttrNameParser { @Transactional(readOnly = true) public IntAttrName parse(final String intAttrName, final AnyTypeKind provisionAnyTypeKind) throws ParseException { IntAttrName result = new IntAttrName(); Matcher matcher; if (intAttrName.indexOf('.') == -1) { matcher = PRIVILEGE_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.USER); result.setPrivilegesOfApplication(matcher.group(1)); } else { result.setAnyTypeKind(provisionAnyTypeKind); setFieldOrSchemaName(intAttrName, result.getAnyTypeKind(), result); } } else { matcher = ENCLOSING_GROUP_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.GROUP); result.setEnclosingGroup(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = RELATED_ANY_OBJECT_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.ANY_OBJECT); result.setRelatedAnyObject(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = MEMBERSHIP_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.USER); result.setMembershipOfGroup(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = RELATED_USER_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.USER); result.setRelatedUser(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = RELATIONSHIP_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.ANY_OBJECT); result.setRelationshipType(matcher.group(1)); result.setRelationshipAnyType(matcher.group(2)); setFieldOrSchemaName(matcher.group(3), result.getAnyTypeKind(), result); } else { throw new ParseException("Unparsable expression: " + intAttrName, 0); } } } } } } return result; }  }
IntAttrNameParser { @Transactional(readOnly = true) public IntAttrName parse(final String intAttrName, final AnyTypeKind provisionAnyTypeKind) throws ParseException { IntAttrName result = new IntAttrName(); Matcher matcher; if (intAttrName.indexOf('.') == -1) { matcher = PRIVILEGE_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.USER); result.setPrivilegesOfApplication(matcher.group(1)); } else { result.setAnyTypeKind(provisionAnyTypeKind); setFieldOrSchemaName(intAttrName, result.getAnyTypeKind(), result); } } else { matcher = ENCLOSING_GROUP_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.GROUP); result.setEnclosingGroup(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = RELATED_ANY_OBJECT_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.ANY_OBJECT); result.setRelatedAnyObject(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = MEMBERSHIP_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.USER); result.setMembershipOfGroup(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = RELATED_USER_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.USER); result.setRelatedUser(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = RELATIONSHIP_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.ANY_OBJECT); result.setRelationshipType(matcher.group(1)); result.setRelationshipAnyType(matcher.group(2)); setFieldOrSchemaName(matcher.group(3), result.getAnyTypeKind(), result); } else { throw new ParseException("Unparsable expression: " + intAttrName, 0); } } } } } } return result; }  @Transactional(readOnly = true) IntAttrName parse(final String intAttrName, final AnyTypeKind provisionAnyTypeKind); }
IntAttrNameParser { @Transactional(readOnly = true) public IntAttrName parse(final String intAttrName, final AnyTypeKind provisionAnyTypeKind) throws ParseException { IntAttrName result = new IntAttrName(); Matcher matcher; if (intAttrName.indexOf('.') == -1) { matcher = PRIVILEGE_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.USER); result.setPrivilegesOfApplication(matcher.group(1)); } else { result.setAnyTypeKind(provisionAnyTypeKind); setFieldOrSchemaName(intAttrName, result.getAnyTypeKind(), result); } } else { matcher = ENCLOSING_GROUP_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.GROUP); result.setEnclosingGroup(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = RELATED_ANY_OBJECT_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.ANY_OBJECT); result.setRelatedAnyObject(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = MEMBERSHIP_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.USER); result.setMembershipOfGroup(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = RELATED_USER_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.USER); result.setRelatedUser(matcher.group(1)); setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result); } else { matcher = RELATIONSHIP_PATTERN.matcher(intAttrName); if (matcher.matches()) { result.setAnyTypeKind(AnyTypeKind.ANY_OBJECT); result.setRelationshipType(matcher.group(1)); result.setRelationshipAnyType(matcher.group(2)); setFieldOrSchemaName(matcher.group(3), result.getAnyTypeKind(), result); } else { throw new ParseException("Unparsable expression: " + intAttrName, 0); } } } } } } return result; }  @Transactional(readOnly = true) IntAttrName parse(final String intAttrName, final AnyTypeKind provisionAnyTypeKind);  }