Skip to Content.
Sympa Menu

grouper-dev - new attribute api

Subject: Grouper Developers Forum

List archive

new attribute api


Chronological Thread 
  • From: Chris Hyzer <>
  • To: "" <>
  • Subject: new attribute api
  • Date: Tue, 16 Mar 2010 11:18:21 -0400
  • Accept-language: en-US
  • Acceptlanguage: en-US

Hey,

 

Im trying to wrap up the API logic for the new attribute framework as far as multi assigning attributes, assigning values, and assigning multiple values.

There are three delegates that are used to house all the methods (to separate from the business objects).

 

From a high level, you can use the “value delegate” to assign or retrieve attribute values directly from an object.

 

e.g.

 

  group.getAttributeValueDelegate().assignValueInteger("some:attr", 50L);

  //”true” means replace existing values, false means append or replace

  stem.getAttributeValueDelegate().assignValuesFloating("some:attr2", GrouperUtil.toSet(1.23, 2.34), true);

  Member member = membership.getAttributeValueDelegate().retrieveValueMember("some:attr3");

  List<String> values = membership.getAttributeValueDelegate().retrieveValuesString("some:attr4");

 

There is a more powerful delegate but only for attribute assignments (not values):

 

This makes an assignment and gets the assignment object:

 

    AttributeAssignResult attributeAssignResult = group.getAttributeDelegate().assignAttribute(attributeDefName);

    AttributeAssign attributeAssign = attributeAssignResult.getAttributeAssign();

 

Then, ones you have an assignment object, you can deal with the values on a potentially more complicated level than the first delegate:

 

List<Timestamp> timestamps = attributeAssign.getValueDelegate().retrieveValuesTimestamp();

attributeAssign.getValueDelegate().addValuesMember(GrouperUtil.toSet(member3, member4, member5));
attributeAssign.getValueDelegate().deleteValuesString(GrouperUtil.toSet(string4, string5, string6));
               

Note that all the assignment/delete operations return a bean that tells you if anything changed, and gives you references to the underlying objects in case you need them.

 

Next I will work on the web services.  I hope it will be just two operations (sort of like the membership and privilege web operations).  One for retrieving attribute assignments and values, and one for assigning/editing/adding/removing attributes and values.  I hope to have the value part in the same operations as the attribute part (like the first delegate above).

 

Let me know if you have any comments/suggestions

 

Thanks

Chris



  • new attribute api, Chris Hyzer, 03/16/2010

Archive powered by MHonArc 2.6.16.

Top of Page