I am trying to automatically assign a ticket using JRJC 4.0.0.
I am using this:
final Map<String, FieldInput> map = new HashMap<>();
map.put("assignee", new FieldInput("assignee", "XXXX"));
a_conn.getIssueClient().updateIssue(this.m_key, new IssueInput(map)).claim();
But I get this error:
[ErrorCollection{status=400, errors={assignee=data was not an object}, errorMessages=[]}]
Anyone already know the solution? I tried searching here in SO but can't find anything that works.
final IssueInputBuilder is = new IssueInputBuilder();
is.setAssigneeName(a_username);
a_conn.getIssueClient().updateIssue(this.m_key, is.build()).claim();
Related
I am messing around with RapidAPI and i dont undertand the code they give.
Could someone give me a teardown? It says in order to access api i have to write the following code
Map<String, Argument> body = new HashMap<String, Argument>();
body.put("ParameterKey1", new Argument("data", "ParameterValue1"));
body.put("ParameterKey2", new Argument("data", "ParameterValue2"));
try {
Map<String, Object> response = connect.call("APIName", "FunctionName", body);
if(response.get("success") != null) { }
what are parameter keys 1 and 2, the data, and the parameter values
edit1:this is the code snippet i want to use in android studio
HttpResponse<JsonNode> response = Unirest.get("https://spoonacular-recipe-
food-nutrition-v1.p.mashape.com/recipes/search?
diet=vegetarian&excludeIngredients=coconut&instructionsRequired=
false&intolerances=egg%2C+gluten&limitLicense=false&number=
10&offset=0&query=burger&type=main+course")
.header("X-Mashape-Key",
"Xxxxxx")
.header("X-Mashape-Host", "spoonacular-recipe-food-nutrition-
v1.p.mashape.com")
.asJson();
Your example code is using this https://github.com/zeeshanejaz/unirest-android. If you want to use that snippet you could start with that.
How would I convert IniPreferences to a Map in Java?
I currently have
public static Map<String, String> configMap;
Ini ini = new Ini(configIni);
java.util.prefs.Preferences prefs = new IniPreferences(ini);
configMap = new HashMap<>();
configMap.put("Version", prefs.node("Settings").get("Version", null));
However this would require me to insert the key for anything added to the ini making it a pain to maintain.
The prefs.node will always be settings however preferably they would be combined into configMap.
How would I automate this?
I'm simply trying to update a customfield value in jira using java. I had created a method updateCustomField which accepts 3 parameters (customFieldCode, value, jiraId). Had tried using transition but all it did is change the jira status from "Open" to "Resolved 2". I googled everywhere but they suggest to use JSON which I have no idea how to apply.
here's my update method:
public void updateCustomField(String customFieldCode, String value, String jiraId) throws Exception {
final IssueRestClient issueRestClient = jiraClient.getIssueClient();
final Issue issue = issueRestClient.getIssue(jiraId).get();
FieldInput fieldInput = new FieldInput(customFieldCode, value);
List <FieldInput> fields = new ArrayList <FieldInput> ();
fields.add(fieldInput);
TransitionInput transision = new TransitionInput(1, fields);
issueRestClient.transition(issue, transision);
}
For those who want to simply update jira using java, you can try this jira-client library.
I'm building an Nativesctipt app for Android that uses Firebase as backend and I'm using the native Firebase Android library v2.4.0
I can insert objects in Firebase just fine using the following {N} Javascript syntax
var user = new java.util.HashMap();
user.put("name", viewModel.get("name"));
user.put("lastName", viewModel.get("lastName");
var address = new java.util.HashMap();
address.put("address", viewModel.get("address");
address.put("number", viewModel.get("number");
address.put("city", viewModel.get("city");
user.put("address", address);
ref = new Firebase("https://my-firebase-app-url/users");
refUser = ref.child(viewModel.get("username"));
refUser.setValue(user);
The problem with this is that I have to manually convert every javascript object into a java hashSet (and back) and I wanted to do it using a JSON to HashMap library so I have imported the java Jackson library into my {N} app.
According to this site here's the way to convert a JSON to a HashMap in Java using Jackson:
ObjectMapper mapper = new ObjectMapper();
String json = "{\"name\":\"mkyong\", \"age\":29}";
Map<String, Object> map = new HashMap<String, Object>();
// convert JSON string to Map
map = mapper.readValue(json, new TypeReference<Map<String, String>>(){});
I'm looking for a way to translate that into a {N} Javascript code that will do it for me but I'm unable to use generics notation in {N} Javascript. Does anybody know how I could do it? I have tried some ways but all of them crashed the application. Here's an {N} Javascript snippet does not work:
var ObjectMapper = com.fasterxml.jackson.databind.ObjectMapper;
var TypeReference = com.fasterxml.jackson.core.type.TypeReference;
var mapper = new ObjectMapper();
var map = mapper.readValue(JSON.stringify(user), new TypeReference());
refUser.setValue(map);
Any help is greatly appreciated.
I'm trying to invoke RQLQueryForEach droplet from using DUST's DropletInvoker by using below code.
HeadPipelineServlet dynamoHandler = (HeadPipelineServlet) Nucleus.getGlobalNucleus().resolveName("/atg/dynamo/servlet/dafpipeline/DynamoHandler");
DynamoHttpServletRequest request = dynamoHandler.getRequest(null);
ByteBuffer buffer = ByteBuffer.allocate(1024);
TestingDynamoHttpServletRequest wrappedRequest = new TestingDynamoHttpServletRequest(request, buffer);
TestingDynamoHttpServletResponse wrappedResponce = new TestingDynamoHttpServletResponse(request.getResponse());
DynamoServlet droplet = (DynamoServlet) wrappedRequest.resolveName("/atg/dynamo/droplet/RQLQueryForEach");
wrappedRequest.setParameter("repository", "/atg/userprofiling/ProfileAdapterRepository");
wrappedRequest.setParameter("itemDescriptor", "user");
wrappedRequest.setParameter("transactionManager", "/atg/dynamo/transaction/TransactionManager");
wrappedRequest.setParameter("queryRQL", "ALL");
DropletInvoker mDropletInvoker = new DropletInvoker(Nucleus.getGlobalNucleus());
DropletResult result = mDropletInvoker.invokeDroplet(droplet, null, wrappedRequest, wrappedResponce);
assertNotNull("Check that output got rendered",result.getRenderedOutputParameter("output"));
invokeDroplet method is failing with exception "javax.servlet.ServletException: required parameter 'repository' not passed to droplet." Can any one point me in the right direction, what is that I'm doing incorrectly?
Here is the full stack trace...
javax.servlet.ServletException: required parameter 'repository' not passed to droplet
at atg.repository.servlet.RQLQueryForEach.getRangeResults(RQLQueryForEach.java:254)
at atg.repository.servlet.RQLQueryForEach.getResults(RQLQueryForEach.java:220)
at atg.repository.servlet.RQLQueryForEach.service(RQLQueryForEach.java:179)
at atg.servlet.DynamoServlet.service(DynamoServlet.java:152)
I could solve the problem using additional parameters. However the i still couldn't figure out why my original code isn't working.
Workaround I found
HeadPipelineServlet dynamoHandler = (HeadPipelineServlet) Nucleus.getGlobalNucleus().resolveName("/atg/dynamo/servlet/dafpipeline/DynamoHandler");
Map<String,Object> additionalParams = new HashMap<>();
additionalParams.put("repository", "/atg/userprofiling/ProfileAdapterRepository");
additionalParams.put("itemDescriptor", "user");
additionalParams.put("queryRQL", "ALL");
DropletInvoker mDropletInvoker = new DropletInvoker(Nucleus.getGlobalNucleus());
DropletResult result = mDropletInvoker.invokeDroplet("/atg/dynamo/droplet/RQLQueryForEach",additionalParams);
Are you building your dust code properly? The error only suggests that the input parameter repository is not sent in the request.
Was there a point when the below line was not in your code. If you have added it, probably your changes have not been built. Could you clean your project and try again. Other than this I don't see any thing wrong with your code. Also if you are using eclipse, probably your Build Automatically under Projects menu is not checked.
wrappedRequest.setParameter("repository", "/atg/userprofiling/ProfileAdapterRepository");