3 Replies Latest reply: Apr 9, 2008 10:15 AM by Pedja RSS

    createRole in OCS

    625707
      hi,

      i was trying to create a role in OCS according to API's javadoc.
      but

      Item role = secumgr.createRole(
      domain.getId(),
      new NamedValue[]{
      new NamedValue(Attributes.NAME, "testrole"),
      new NamedValue(Attributes.DESCRIPTION, "testrole created by java"),
      new NamedValue(Attributes.ACCESS_LEVEL, FdkConstants.CAPABILITY_ADDITEM)
      },
      new AttributeRequest[]{
      new AttributeRequest(null,Attributes.CONFIGURATION_ENABLED)
      }
      );

      returns an ORACLE.FDK.ParameterError
      with error code = {http://schemas.xmlsoap.org/soap/envelope/}Server.userException

      any ideas??
      plz help!
      urgent!
        • 1. Re: createRole in OCS
          Pedja
          I haven't tried this, but here are a couple of things to check:

          - the docs says that Attributes.ACCESS_LEVEL should be supplied with Long, and FdkConstants.CAPABILITY_ADDITEM is long, does new Long(FdkConstants.CAPABILITY_ADDITEM) make any difference?

          - new AttributeRequest(null,Attributes.CONFIGURATION_ENABLED) I think is wrong, it should be new AttributeRequest(Attribute, value), what if you reverse the order? Do you still get the same error when you put null instead of AttributeRequest[]?

          Pedja
          • 2. Re: createRole in OCS
            625707
            thanks for your response.

            does new Long(FdkConstants.CAPABILITY_ADDITEM) make any difference?
            no.

            it should be new AttributeRequest(Attribute, value) ...
            as far as I know first parameter is either a new AttributeRequest[] or null, while the sceond is the atrribute itself ...

            i just can't find the do anymore ... seems to be quite hidden - the official doc does not say a word about how to initialize an attribute request
            • 3. Re: createRole in OCS
              Pedja
              Can you try this code:
              Item role = secumgr.createRole(
              domain.getId(),
              new NamedValue[]{
              new NamedValue(Attributes.NAME, "testrole"),
              new NamedValue(Attributes.DESCRIPTION, "testrole created by java"),
              new NamedValue(Attributes.ACCESS_LEVEL, FdkConstants.CAPABILITY_ADDITEM)
              },
              new AttributeRequest[]{
              new AttributeRequest(Attributes.CONFIGURATION_ENABLED, null)
              }
              );
              or, if it doesn't work, this one:
              Item role = secumgr.createRole(
              domain.getId(),
              new NamedValue[]{
              new NamedValue(Attributes.NAME, "testrole"),
              new NamedValue(Attributes.DESCRIPTION, "testrole created by java"),
              new NamedValue(Attributes.ACCESS_LEVEL, FdkConstants.CAPABILITY_ADDITEM)
              }, null);
              as far as I know first parameter is either a new AttributeRequest[] or null, while the sceond is the atrribute itself ...

              Do you use ContentDB or Content Services, because I think this is true for ContentDB?