Skip to Content.
Sympa Menu

grouper-users - Re: [grouper-users] WsSampleAssignAttributesRest_json.txt and values

Subject: Grouper Users - Open Discussion List

List archive

Re: [grouper-users] WsSampleAssignAttributesRest_json.txt and values


Chronological Thread 
  • From: Scott Koranda <>
  • To: Chris Hyzer <>
  • Cc: "" <>
  • Subject: Re: [grouper-users] WsSampleAssignAttributesRest_json.txt and values
  • Date: Fri, 15 Oct 2010 15:26:11 -0500

> Hi,
>
> > I added a sample for assigning an attribute value:
> >
> > https://spaces.internet2.edu/display/GrouperWG/Assign+Attributes
> >
> > Note the attribute def needs to have a value type (e.g. string, integer,
> > etc), and whether or not multi-valued:
> >
> > attributeDef.setValueType(AttributeDefValueType.integer);
> > attributeDef.setMultiValued(true);
> > attributeDef.store();
> >
> > attributeAssignValueOperation is required if passing values to assign.
> > It is the operation to perform for attribute value on attribute
> > assignments: assign_value, add_value, remove_value, replace_values. Like
> > the attribute assign operation, assign_value will assign if not there, or
> > ignore if already there. add_value will add even if assigned. And
> > replace_values will remove orphans not in the assign list.
> > Let me know if you need more...
>
> Thanks.
>
> I am still, however, having problems.
>
> I started a new GSH session and used it to prove to myself
> that the attribute is defined and has the name I gave it:
>
> gsh 1% grouperSession = GrouperSession.startRootSession();
> edu.internet2.middleware.grouper.GrouperSession:
> ab9bcf5e8d344e76a3db165491e7b23f,'GrouperSystem','application'
> gsh 2% a =
> AttributeDefNameFinder.findByName("Communities:LVC:LSC:MOU:mouFullName",
> true);
> edu.internet2.middleware.grouper.attr.AttributeDefName:
> AttributeDefName[name=Communities:LVC:LSC:MOU:mouFullName,uuid=bf42403a350b4649862b776f3dac660f]
>
> I think that means that the attribute is defined and ready to
> use, correct?
>
> So I then sent in this JSON via POST to
>
> grouper-ws/servicesRest/json/v1_6_000/attributeAssignments :
>
> {
> "WsRestAssignAttributesLiteRequest":{
> "actAsSubjectId":"GrouperSystem",
> "attributeAssignOperation":"assign_attr",
> "attributeAssignType":"stem",
> "attributeAssignValueOperation":"assign_value",
> "valueSystem":"University of Wisconsin-Milwaukee",
> "wsAttributeDefNameName":"Communities:LVC:LSC:MOU:mouFullName",
> "wsOwnerStemName":"Communities:LVC:LSC:MOU:UWM"
> }
> }
>
> The idea is to give the stem Communities:LVC:LSC:MOU:UWM the
> attribute Communities:LVC:LSC:MOU:mouFullName with value
> 'University of Wisconsin-Milwaukee'.
>
> I received this (shortened) exception back:
>
> edu.internet2.middleware.grouper.exception.GroupNotFoundException:
> Cant find group by uuid: null
>
> Any idea on what I am doing wrong?
>

Hi,

I repeated the entire exercise of creating an attribute,
giving it a name, and then attempting using WS to assign an
attribute/value combination to a stem and it worked.

Reviewing my work from the first attempt, I think I know what
I did wrong. I accidentally assigned an attribute def name that
was the same as the attribute def. They ended up with
different uuids, but the same "label":

gsh 9% a =
AttributeDefNameFinder.findByName("Communities:LVC:LSC:MOU:mouFullName",
true);
edu.internet2.middleware.grouper.attr.AttributeDefName:
AttributeDefName[name=Communities:LVC:LSC:MOU:mouFullName,uuid=bf42403a350b4649862b776f3dac660f]
gsh 10% b =
AttributeDefFinder.findByName("Communities:LVC:LSC:MOU:mouFullName", true);
edu.internet2.middleware.grouper.attr.AttributeDef:
AttributeDef[name=Communities:LVC:LSC:MOU:mouFullName,uuid=1699c74ba9124509b5dfa5e609a6017f]

So the solution is "don't do that".

Perhaps the API should have thrown an error/warning when I
gave an attribute def name the same 'label' as the attribute
def?

Thanks,

Scott



Archive powered by MHonArc 2.6.16.

Top of Page