Skip to content

Instantly share code, notes, and snippets.

Created January 3, 2013 16:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4444548 to your computer and use it in GitHub Desktop.
Save anonymous/4444548 to your computer and use it in GitHub Desktop.
Sketch of an attribute DAO that computes a new attribute value from the input. One would wrap this up in a parent DAO that merges with an echo of the input, or something, to ensure the resulting user attribute map returned from the whole attributes subsystem retains the username mapped as an attribute as well, as well as any other attributes col…
package net.unicon.cas.addons.persondir;
import java.util.List;
import java.util.Map;
...
/**
* Sketch of an attribute DAO that computes a new attribute value from the input.
*/
public class AttributeGeneratingDAO extends AbstractDefaultPersonAttributeDao {
String inputUserName = "username";
String outputUserName = "mail";
String suffix = "@oakland.edu";
public JsonBackedComplexStubPersonAttributeDao(final String inputUserName, final String outputUserName, final String suffix) {
// capture the constructor configuration, or use setter methods instead
}
public Map<String, List<Object>> getMultivaluedUserAttributes(String uid) {
Map attributesMap = new Map<String, List<Object>>();
List<Object> newAttributeValue = new List<Object>();
newAttributeValue.add( uid.append(suffix));
attributesMap.put(outputUserName, newAttributeValue);
return attributesMap;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment