Passing List objects through Braid - cordite

I try to invoke a flow through Braid. The flow takes a List<UniqueIdentifier> object as input parameter. When invoking the flow I get the following error:
error: -32000: java.util.LinkedHashMap cannot be cast to net.corda.core.contracts.UniqueIdentifier
Can someone help with this?

This is a deserialisation error of Braid. It might get fixed in a future version. A workaround at the moment is to use Array objects instead of List objects in Corda.
Useful functions are:
List.toTypedArray()
and
Array.asList()

Related

“Error no label add or removes specified” when trying to modify labels using Gmail's Ruby API

I've looked at https://www.rubydoc.info/github/google/google-api-ruby-client/Google/Apis/GmailV1/ModifyThreadRequest and the examples https://developers.google.com/gmail/api/v1/reference/users/labels/update for Python and JS but can't figure out how to format the request properly in ruby.
I'm trying:
service.modify_thread('me',thread_id,{'add_label_ids'=>['UNREAD']})
and various other permutations of the object but can't get anything other than Google::Apis::ClientError: invalidArgument: No label add or removes specified in response.
Any help appreciated
modify_thread expects a Google::Apis::GmailV1::ModifyThreadRequest object as third argument according to the documentation.
In the source of the constructor of ModifyThreadRequest you can see that it looks for a key :add_label_ids in its arguments.
So if modify_thread creates the ModifyThreadRequest object itself then
service.modify_thread('me',thread_id, add_label_ids: ['UNREAD'])
should work.
If that fails I would try
mtr = Google::Apis::GmailV1::ModifyThreadRequest.new(add_label_ids: ['UNREAD'])
service.modify_thread('me', thread_id, mtr)

How to create a Google::Protobuf::Map Instance [Ruby]

I have a protobuf object in ruby, and it has a map as one parameter. How can I create a Google::Protobuf::Map? If I try to enter a standard hash table, I get an Expected Map instance error.
--EDIT--
Found the answer here: https://developers.google.com/protocol-buffers/docs/reference/ruby-generated#map-fields, if anyone needs that.

Rest camel passing objects between endpoints

Overview.
My camel setup calls two service methods. the response of the first one is passed into the second one and then output the final response as json webpage. Fairly simple nothing too complicated.
Further breakdown to give some more context.
Method_1. Takes in scanId. This works ok. It produces an object called ScheduledScan .class
Method_2. Takes in object previous instance of ScheduledScan .class and returns a list of ConvertedScans scans. Then would like to display said list
Description of the code
#Override
public void configure() throws Exception {
restConfiguration().bindingMode(RestBindingMode.json);
rest("/publish")
.get("/scheduled-scan/{scanId}")
.to("bean:SentinelImportService?method=getScheduledScan").outType(ScheduledScan .class)
.to("bean:SentinelImportService?method=convertScheduledScan");
}
The methods that are called look like the following
ScheduledScan getScheduledScan(#Header("scanId") long scanId);
List<ConvertedScans > convertScheduledScan(#Body ScheduledScan scheduledScans);
It is returning the the following error
No body available of type: path. .ScheduledScan but has value:
of type: java.lang.String on: HttpMessage#0x63c2fd04. Caused by: No type converter available
The following runs without the error, i.e. without method 2. So I think im almost there.
rest("/publish")
.get("/scheduled-scan/{scanId}")
.to("bean:SentinelImportService?method=getScheduledScan");
Now from reading the error it looks like im passing in a HttpMessage not the java object? I'm a bit confused about what to do next? Any advice much appreciated.
I have found some similar questions to this message. However I am looking to pass the java object directly into the service method.
camel-rest-bean-chaining
how-to-share-an-object-between-methods-on-different-camel-routes
You should setup the outType as the last output, eg what the REST response is, that is a List/Array and not a single pojo. So use .outTypeList(ConvertedScans.class) instead.

Rally API using Ruby: How do I reference the testcase method (Automated/Manual)?

I am using Ruby to work with the Rally API. I am trying to reference the testcase method. The method being Manual or Automated, but I always get an error. I am using Ruby, so I don’t know if method is a reserved word in Ruby, or what is happening. Could you please let me know how to reference the test case method?
I am able to do:
testcase.objective
testcase.priority
etc.
But I can’t do
testcase.method
I always get this error.
‘method’: wrong number of arguments (0 for 1) (ArgumentError)
Are you using rally_rest_api or rally_api?
If you are using rally_rest_api - Charles is correct. try testcase.elements[:method]
(fieldname downcased and underscored as a symbol)
If you are using rally_api - http://rubygems.org/gems/rally_api -
Getting fields can just be:
testcase["FieldName"]
Hope that helps.
You just need to capitalize the names when trying to access built-in fields (i.e. fields that are not custom). I came across this problem myself and using tc.Method instead of tc.method fixed it.
The reason this error shows up can be seen in the docs for Object#method which, as you've likely figured out by now, causes your code to call the method method instead of access the field named method.

DbLimitExpression requires a collection argument

Does anyone have the faintest idea what this error means please and how to resolve it? All my research is drawing a blank, I can see how to set it on MSDN but it doesn't explain it in a way that explains to me what the issue is. If I remove some of my LINQ queries to set viewbag items then it seems to resolve it but the moment I set new ones and pass them into my view to generate a mail for MVCMailer it comes back. Not sure if its a viewbag issue or simply that I am calling too many linq queries to generate them to pass to the view.
I am very stuck (again)..........
Cheers,
Steve.
DbLimitExpression requires a collection argument.
Parameter name: argument
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: DbLimitExpression requires a collection argument.
Parameter name: argument
An example of the code is:
var VBSalutation = from A in context.Salutations
where A.SalutationId == policytransaction.SalutationId
select A.SalutationName;
ViewBag.Salutation = VBSalutation.FirstOrDefault();
This is repeated for various parameters and then passed to the view.
Well, I faced a similar problem and solved it. Problem was in WHERE clause: data type of left side equal operator (=) sign was not matching with data type of right side. So in your scenario:
where A.SalutationId == policytransaction.SalutationId
SalutationID of A might be an INT and SalutationId of policytransaction might be a string (This is how it was in my case).
I solved it by assigning policytransaction.SalutationId to an Int variable and using it:
int myIntVariable = Convert.ToInt16(policytransaction.SalutationId);
...//some code here
where A.SalutationId == myIntVariable;
Please also note that you cannot directly cast your variables directly in Linq else you'll get an error "LINQ to Entities does not recognize the method". You'll have to use a temp variable and then apply the where clause.
Try ViewBag.Salutation = VBSalutation.SingleOrDefault();

Resources