cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
365
Views
0
Helpful
1
Replies
Highlighted
Cisco Employee

Setting and adding Contributors to a POD

Both the API and the runtime allows me to add a Contributor to a POD successfully. However, there seems to be a discrepancy with multiple Contributors.

Note that the following API suggests the ability to set a List of Contributors to a POD:

public void setContributors(List<Contributor> contributors)

And, the following API suggest the ability to add another Contributor to a POD:

public void addContributor(Contributor newContributor)

However, the runtime seems to always reject the second contributor with the following error:

Exception in thread "main" ApiError with errorType: invalidInput, errorData: contributors, errorMessage: Only 1 contributor at a time is allowed.

I have tried to add a second Contributor to a POD before the encryptAndCreate and afterward using encryptAndUpdate with both strategies failing. Here is a snippet of my code where it fails:

        final Pod pod = new Pod ();

        final Contributor u = new Contributor (ContributorType.USER, "Joe");

        final Contributor m = new Contributor (ContributorType.MACHINE, "jkh.desktop.com");

        // Fails

        // pod.setContributors (Arrays.asList (u, m));

        pod.addContributor (u);

        // Fails

        // pod.addContributor (m);

        pod.setCustomerId (customer1.getCustomerId ());

        pod.setFieldsets (new ArrayList < String > (Arrays.asList ("cisco.base.pod")));

        final String webActivityLink = "web";

        final Map < String, Object > podMetadata1_validDictionary = new TreeMap < String, Object > ()

        {

            {

                put ("Context_Notes", "Enter Collected data here. ");

                put ("Context_POD_Activity_Link", webActivityLink);

            }

        };

        Set < DataElement > dataElements = DataElementUtils.convertDataMapToSet (podMetadata1_validDictionary);

        pod.setDataElements (dataElements);

        contextServiceClient.encryptAndCreate (pod);

        // Fails

        // pod.addContributor (m);

        // contextServiceClient.encryptAndUpdate (pod);

Am I using this incorrectly?

Everyone's tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Beginner

Re: Setting and adding Contributors to a POD

Hi Joseph,

You can add only a single contributor per encryptAndCreate or encryptAndUpdate operation. As you point out, the structure of the method is misleading, as it requires a list for contributors. However, the methods currently only accept a list with a single item in it, or returns an error if there is more than one item in the list.

The team is still looking at how to best utilize the contributor field and how it should be updated.  Once it is finalized we'll use arguments that are more intuitive.

-Chris

View solution in original post

1 REPLY 1
Highlighted
Beginner

Re: Setting and adding Contributors to a POD

Hi Joseph,

You can add only a single contributor per encryptAndCreate or encryptAndUpdate operation. As you point out, the structure of the method is misleading, as it requires a list for contributors. However, the methods currently only accept a list with a single item in it, or returns an error if there is more than one item in the list.

The team is still looking at how to best utilize the contributor field and how it should be updated.  Once it is finalized we'll use arguments that are more intuitive.

-Chris

View solution in original post