10-05-2015 07:00 AM
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?
Solved! Go to Solution.
10-05-2015 08:38 AM
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
10-05-2015 08:38 AM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide