Getting the AttributeDefName for an attribute, or sometimes even calculating the name of it to look it up, varies for different attributes. Sometimes, a getter method returns the AttributeDefName directly. Sometimes it returns a string, and another query is needed to fetch the object. Sometimes, there is no method to return the full attribute path, but there is a method to return the folder name, and static fields for all the attribute names, so the path string can be calculated. In a few cases, there is nothing defined, so the caller needs to assume a hard-coded path.
This is the gold standard, as the callers don't need multiple calls to get the AttributeDefName, or compute the paths. Attribute classes covered in this include:
- Example hook MembershipOneInFolderMaxHook
- Permission limits
Here, methods return the full path of attributes, and then another call to AttributeDefNameFinder(name) returns the AttributeDefName. This requires one extra call, but at least doesn't require paths to be computed.
- External Subject Invite (a few attributes do have an AttributeDefName method)
- RuleUtils (a few attributes do have an AttributeDefName method)
Here, there is one method to get the folder name. Then, the caller must construct a string with folder + ":" + static string attribute name
- Grouper Attribute Loader (but I could not find a static field for the base attribute, so a hard-coded ":attributeLoader" must be used in callers?) (also, the stem name method is in the GrouperCheckConfig class, not a loader class)
- Loader Metadata (stem method name is in GrouperCheckConfig class)
- Object types
For PSPNG, the attribute extensions provision_to and do_not_provision_to are in static fields. But the stem paths are always calculated in private methods, so there is no standard way to retrieve them. So the only way to determine a pspng attribute def name is to use the same calculations:
This should be refactored into a public method to save calculations as well as caller assumptions on hardcoded names. It would be preferable to put this in a grouper package and not the pspng jar, since the attribute will exist even when called from an app where the pspng jar isn't loaded.
In contrast to LDAP Loader, SQL Loader attributes are legacy group types. The way to get these definitions is by either GroupTypeFinder (which is marked deprecated even though it's the only way to access it without hardcoding a full path), or a GrouperDAOFactory chain.