@Test public void ownFields() throws ParseException { IntAttrName intAttrName = intAttrNameParser.parse("key", AnyTypeKind.USER); assertNotNull(intAttrName); assertEquals(AnyTypeKind.USER, intAttrName.getAnyTypeKind()); assertNotNull(intAttrName.getField()); assertEquals("key", intAttrName.getField()); assertNull(intAttrName.getSchema()); assertNull(intAttrName.getSchemaType()); assertNull(intAttrName.getEnclosingGroup()); assertNull(intAttrName.getMembershipOfGroup()); assertNull(intAttrName.getRelatedAnyObject()); assertNull(intAttrName.getPrivilegesOfApplication()); assertNull(intAttrName.getRelationshipAnyType()); assertNull(intAttrName.getRelationshipType()); assertNull(intAttrName.getRelatedUser()); intAttrName = intAttrNameParser.parse("name", AnyTypeKind.GROUP); assertNotNull(intAttrName); assertEquals(AnyTypeKind.GROUP, intAttrName.getAnyTypeKind()); assertNotNull(intAttrName.getField()); assertEquals("name", intAttrName.getField()); assertNull(intAttrName.getSchema()); assertNull(intAttrName.getSchemaType()); assertNull(intAttrName.getEnclosingGroup()); assertNull(intAttrName.getMembershipOfGroup()); assertNull(intAttrName.getRelatedAnyObject()); assertNull(intAttrName.getPrivilegesOfApplication()); assertNull(intAttrName.getRelationshipAnyType()); assertNull(intAttrName.getRelationshipType()); assertNull(intAttrName.getRelatedUser()); intAttrName = intAttrNameParser.parse("userOwner", AnyTypeKind.GROUP); assertNotNull(intAttrName); assertEquals(AnyTypeKind.GROUP, intAttrName.getAnyTypeKind()); assertNotNull(intAttrName.getField()); assertEquals("userOwner", intAttrName.getField()); assertNull(intAttrName.getSchema()); assertNull(intAttrName.getSchemaType()); assertNull(intAttrName.getEnclosingGroup()); assertNull(intAttrName.getMembershipOfGroup()); assertNull(intAttrName.getRelatedAnyObject()); assertNull(intAttrName.getPrivilegesOfApplication()); assertNull(intAttrName.getRelationshipAnyType()); assertNull(intAttrName.getRelationshipType()); assertNull(intAttrName.getRelatedUser()); intAttrName = intAttrNameParser.parse("name", AnyTypeKind.USER); assertNotNull(intAttrName); assertEquals(AnyTypeKind.USER, intAttrName.getAnyTypeKind()); assertNull(intAttrName.getField()); Object nullObj = null; int expected = new HashCodeBuilder(). append(AnyTypeKind.USER).append(nullObj).append(nullObj).append(nullObj).append(nullObj). append(nullObj).append(nullObj).append(nullObj).append(nullObj).append(nullObj).append(nullObj). build(); assertEquals(expected, intAttrName.hashCode()); IntAttrName intAttrName2 = intAttrNameParser.parse("email", AnyTypeKind.USER); assertFalse(intAttrName.equals(intAttrName2)); assertFalse(intAttrName.equals(nullObj)); assertTrue(intAttrName.equals(intAttrName)); String toString = intAttrName.toString(); assertTrue(toString.startsWith("org.apache.syncope.core.provisioning.api.IntAttrName")); assertTrue(toString.endsWith("[USER,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>]")); }
@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);  }