JPOS remove zero padding IFB_NUMERIC - java

the problem is in the fourth field (and maybe 11):
<field id="4" value="000000010000"/>
it should be:
<field id="4" value="10000"/>
I used IFB_NUMERIC isoFieldPackager for this field. Does correct isofieldpackager exist for my case? Or I need to some other decision...
thanks in advance!

jPOS doesn't perform content manipulation like unpadding. The packager just put what it reads and is the responsibility of the higher-level logic to make the unpadding.
You can use ISOUtil.zeroUnpad(m.getString(4)) method for that.

Related

New Test Run using REST API - ALM 14

I am trying to update the test results using REST API for ALM Saas
http://targetserver:targetport/qcbin/rest/domains/ALMDomain/projects/ALMProject/runs - EndPoint
Below are the body(payload):
<Entity Type='run'>
<Fields>
<Field Name='name'><Value>testnamegoeshere</Value></Field>
<Field Name='test-instance'><Value>1</Value></Field>
<Field Name='cycle-id'><Value>cycleidgoeshere</Value></Field>
<Field Name='test-id'><Value>testidgoeshere</Value></Field>
<Field Name='subtype-id'><Value>hp.qc.run.MANUAL</Value></Field>
<Field Name='status'><Value>Failed</Value></Field>
<Field Name='owner'><Value>testownergoeshere</Value></Field>
</Fields>
</Entity>
Getting response is like this.
false
here is my question: I need to know if am passing correct parameter or not and please let me know, is API got changed or anything else??
URL you mentioned is for creating a new run. You have mentioned that you are going to update the test run. For that you need to append /{id} (id of run). Make sure you are making put call and not post for this operation.
Also probably you wont require to give cycle-id, test-id, test-instance details with update because those are now constants. If you are creating new run then it is mandatory.
Hope this helps you to solve.

How give submit on selecting drop down in moqui Framework?

I've implemented an application using Moqui Framework.I have form-single like this
<transition name="languagesUptade">
<service-call name="org.moqui.impl.UserServices.update#searchLanguage"
in-map="[locale:locale]"/>
<default-response url="."/></transition>
<form-single name="languageslist" map="languages" transition="languagesUptade">
<field name="locale" columnSize="col-sm-12"><default-field>
<drop-down allow-empty="false"><list-options list="localeStringList" key="${locale}" text="${locale} - ${name}"/></drop-down>
</default-field></field>
<field name="submitButton" columnSize="col-sm-12"><default-field title="Update"><submit/></default-field></field>
</form-single>
I am trying to remove field submit-button and i need get submitted on selecting drop down and it need to call the transition. How can i achieve that ?
Write some JavaScript to do it, and put it in a render-mode.text element. There is an example of this in the QuickSearch screen in HiveMind:
https://github.com/moqui/HiveMind/blob/master/screen/HiveMindRoot/dashboard/QuickSearch.xml

How to give weight to the specific field?

I am using Apache Solr for indexing and searching. I have to give weight to the specific field so that If I make search then search has to perform on that field which is most weighted and then on others.
I am using SolrJ, Java, and GWT for development.
To boost at index time you need to supply a boost statement in your update doc.
<add overwrite="true">
<doc boost="2.0">
<field name="id">1234</field>
<field name="type">type1</type>
</doc>
<doc>
<field name="id">2345</field>
<field name="type" boost="0.5">type2</type>
</doc>
</add>
The above example demonstrates how to boost a complete document (elevation) as well as how to boost a specific field.
For more documentation look here and here
Using the dismax (or edismax) query handler, you can set the qf (Query Fields) parameter to assign boosts to different fields. It uses this format:
field1^boost_val field2^boost_val....etc.
There are other good parameters to help you control your result ranking as well.
http://wiki.apache.org/solr/ExtendedDisMax

file descriptor written in xml

I am looking to parse log files (text files usually delimited by certain characters), and I want to make the job easier by making a parser that can take in an xml file which describes the format of the log file coming in. This way I can feed my parser any type of log file and with my xml description my parser and extract the useful information. I am not sure how to generically describe the log file format in xml. Also I am unsure about how to then match lines in my log file with the descriptions given. I would greatly appreciate any help and guidance on this. Thank you very much to anyone who replies.
<logfile location="/usr/local/logs/logfile.log">
<delimiter>#</delimiter>
<format>
<field index="1" length="10">
<target>Date</target>
</field>
<field index="2">
<target>Message</target>
</field>
<field index="3" length="20">
<target>Component</target>
</field>
<field index="5" length="20">
<target>Details</target>
</field>
</format>
</logfile>
Your code will read this XML and parse each line in the log file dynamically according to the rules defined here. The program will then store the values in appropriate 'target' fields.
log file:
2012/12/12 10.10.10#Critical application state#Error in component XYZ#Useless information#Useful information
Output:
Date: 2012/12/12
Message: Critical application state
Component: Error in component XYZ
Details: Useful information

JAXB multiple mappings for attribute

I'm just changing design errors made in the past, but want to keep backwards compatibility of my software. For this I would need some way to map two flavors of an xml file into one java bean. Can this be done using two JAXB annotations on one attribute/element? I understand the marshalling would be ambiguous, but the unmarshalling could work. Is there some nice way of doing this?
p.s.: I don't care about marshalling.
You can map twice:
the first time using annotations
the second time using XML resources.
Or just two XML mappings instead of annotations.
For XML resource mappings, there's a number of options:
Annox: http://confluence.highsource.org/display/ANX/JAXB+User+Guide (I wrote it so it comes first :))
EclipseLink Moxy: http://eclipse.org/eclipselink/moxy.php
JAXB Intoductions: http://community.jboss.org/wiki/JAXBIntroductions
With Annox you can easily map twice using XML mapping resources with different extensions like MyClass.ann1.xml or MyClass.ann2.xml. (It's MyClass.ann.xml per default, but the adjustment is trivial.)
Here's a sample of what mappings look like:
<class xmlns="http://annox.dev.java.net" xmlns:annox="http://annox.dev.java.net" xmlns:jaxb="http://annox.dev.java.net/javax.xml.bind.annotation">
<jaxb:XmlAccessorType value="FIELD"/>
<jaxb:XmlType name="" propOrder="productName quantity usPrice comment shipDate"/>
<field name="productName">
<jaxb:XmlElement required="true"/>
</field>
<field name="usPrice">
<jaxb:XmlElement name="USPrice" required="true"/>
</field>
<field name="shipDate">
<jaxb:XmlSchemaType name="date"/>
</field>
<field name="partNum">
<jaxb:XmlAttribute required="true"/>
</field>
</class>

Categories

Resources