Parameter issue in WSO2DSS - wso2-data-services-server

I am using DSS 3.5.0 and have following issue while passing parameters.
Here is my resource definition looks like
<resource method="GET" path="v1.1/EMPLOYEE">
<call-query href="Q_Employee">
<with-param name="ENumber" query-param="ENumber"/>
<with-param name="DepartmentNumber" query-param="DepartmentNumber"/>
<with-param name="Type" query-param="Type"/>
</call-query>
I am able to invoke this using
..<endpoint>/v1.1/EMPLOYEE/?ENumber=xx&DepartmentNumber=xx&Type=xx
But I want to invoke it without that extra / after EMPLOYEE i.e like
..<endpoint>/v1.1/EMPLOYEE?ENumber=xx&DepartmentNumber=xx&Type=xx
If I try to use the second URL I get this error
The endpoint reference (EPR) for the Operation not found is ..HTTPEndpoint/v1.1/EMPLOYEE?ENumber=xx&DepartmentNumber=xx&Type=xx and the WSA Action = null.
Appreciate any help.

I tried this in 3.5.1 and it works i.e I can access the resource using query parameters without that extra / like below
..<endpoint>/v1.1/EMPLOYEE?ENumber=xx&DepartmentNumber=xx&Type=xx
So it must be a bug in the earlier release.

Related

TYPO3 Symfony Expression: isset() for Query Parameters?

I am using several Symfony expressions in my TypoScript checking for query parameters such as this:
[request.getQueryParams()['tx_news_pi1']['news'] > 0]
do something
[END]
This is working well – as long as the query parameter exists. If it doesn’t, the following error message is written into the log file:
Unable to get an item on a non-array.
In PHP I would use isset() to check whether the query parameter exists – but I could not find a similar way for Symfony expressions in TypoScript. I have tried
[request.getQueryParams()['tx_news_pi1']['news']]
which works the same, meaning: it does what it’s supposed to do, but logs an error message if the query parameter does not exist.
Is there anything like isset() for the Symfony Expression Language in TYPO3?
The is_defined() or isset() I was looking for will be returned by the condition
[request.getQueryParams()['tx_news_pi1']]
instead of
[request.getQueryParams()['tx_news_pi1']['news']]
In my use case this would even be enough. If you need to be more precise (e.g. to differentiate between different query parameters within the same plugin), go for
[request.getQueryParams()['tx_news_pi1'] && request.getQueryParams()['tx_news_pi1']['news'] > 0]
The solution was provided as a reply to a bug report on forge.typo3.org
Try this:
[request.getQueryParams()['tx_news_pi1']['news'] = ]
do something
[END]

Custom dictionary is not working in endeca

I am trying to add a custom dictionary in stemming but found no luck.
Steps I tried:
1) I have added the following lines in /config/script/DataIngest.xml:
<dgidx id="Dgidx" host-id="ITLHost">
<args>
.....
<arg>--stemming-updates</arg>
<arg>C:/Endeca/Apps/CRS/config/script/stemmingExtension.en.xml</arg>
</args>
</dgidx>
And added following lines in stemmingExtension.en.xml:
<word_forms_collection_updates>
<WORD_FORMS>
<WORD_FORM>shuts</WORD_FORM>
<WORD_FORM>shirts</WORD_FORM>
</WORD_FORMS>
</word_forms_collection_updates>
Ran a baseline update and then tried to search for "shuts" and expected to get "shirts" results, but not.
What's the correct way of setting up custom dictionary words in stemming?
Thanks in advance for your help.
Basavaraj
What version of the etl salience component are you using? I remember of a similar bug in oeid 3.0 bundle, and unluckily the answer is that the component used in clover etl doesn't call the appropriate method from java's api to get the stemmed word. You can build a mockup, directly calling java api's, to see the different methods used
For Endeca 3.1.2 version, try adding it to /MDEX/<version>/conf/stemming/en_word_forms_collection.xml (for English)
Example:
<WORD_FORMS_COLLECTION>
...
<WORD_FORMS>
<WORD_FORM>shuts</WORD_FORM>
<WORD_FORM>shirts</WORD_FORM>
</WORD_FORMS>
<WORD_FORMS_COLLECTION>

Objectify Ofy() is not finding the "query" method

I am new to objectify, and reading a tutorial on how to query. For some reason when I type the following code:
Query q = ofy().query(UserChoice.class).filter("email", email);
My Eclipse gives me a error saying "The method query(Class) is undefined for the type Objectify"
I'm not sure what this means? I imported Objectify correctly by using the following:
import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyService;
ObjectifyService.register(UserChoice.class);
Objective doesn't have an actual query method. In their API you can see all the calls you can make on the Objectify object, query() isn't one of those.
It looks like there may be an older version of Objectify that has a query method. The newest one (Build version: 4.0a3) doesn't have it, but an older version (Build version: 2.2.1) does. It looks like the class paths are the same, com.googlecode.objectify.Objectify. Make sure to load in the correct one or you are using the proper version with the `query() call.
The ObjectifyService you are using looks to be in the older version (2.2.1).

How to rspec mock open-uri?

I have this simple code where I am sending http request and reading all the response.
Here is my rails code
open("http://stackoverflow.com/questions/ask")
How can I write spec for this line of code. I dont have the option to use mocha and webmock. I can only use mocking framework of Rpsec.
I have tried to use this statement
OpenURI.stub!(:open_uri).should_receive(:open).with("http://stackoverflow.com/questions/ask")
but i keep getting this error
RSpec::Mocks::MockExpectationError: (#<RSpec::Mocks::MessageExpectation:0xd1a7914>).open("http://stackoverflow.com/questions/ask")
expected: 1 time
received: 0 times
I thought that the open method is defined on the level of the Kernel, but I was wrong.
If you would like to mock the open, you should do it on the level of your object like this:
it "should do something" do
object_under_test = ObjectUnderTest.new
object_under_test.should_receive(:open).with("http://example.org")
end
I did:
my_object.stub_chain(:open, :read) { "my return value" }
According to this link http://distillations.2rye.com/2011/08/mock-the-web-openuri/ the open function is defined on the Kernel module, but mixed into your controller. Therefore you need to stub the call at that level. This solution works well for RSpec controller tests:
html_content = <<-EOS
<html><head>
<title>Some Title</title>
</head>
<body>Some Content</body></html>
EOS
YourController.any_instance.stub(:open).and_return html_content
To stub open-uri you can use this syntax RSpec 3+
file = double('file')
expect(OpenURI).to receive(:open_uri).and_return(file)

add button in show.jspx in a spring roo mvc project

I've created a spring roo project using 'Getting started with spring roo' as a starting point. The project is created in STS using roo 1.1.5. I've added neo4j graph and is able to create nodes with simple edges and create the web-part issuing 'controller all --package ~.web'.
The project is a simple web-app with a Person and Race node and a Participant-edge with start-time, end-time, total-time and race-id. Since the edge Participant is a #RelatedToVia it becomes a #RelationshipEntity and I want to add a button to save Participant.
I found WEB-INF/tags/form/field/table.tagx where the add-, modify-, delete-buttons and friends are defined, ie.:
<c:if test="${update}">
<td class="utilbox">
..
But where do I set the variable update? I've looked through the code that is created by STS, but unable to find it. Pardon if this is obvious.
regards
Claus
Edit:
I found out that WEB-INF/tags/form/show.tagx have the knobs to enable/disable for instance the update-button:
<c:if test="${empty update}">
<c:set var="update" value="true" />
</c:if>
So I will add my new button in this file. The spring framework seems so well laid out. Just have to find the various places.
regards
Claus
The value for update is obtained from attributes you specify when you use the tag created using the tagx.
For an example,
If form:table was used as in a jspx and if the following was set, you will recieve true in your update variable if it was assigned using a directive. However it seems that the true is set as default in the form:table tag within Spring Roo.
If you want to set it to false, when using you have to set the value to the attribute as following.
<form:table update="false" />
If you want to go deeper into this, look in to the table.tagx file you have mentioned you will find the following line which explains it.
<jsp:directive.attribute name="update" type="java.lang.Boolean" required="false" rtexprvalue="true" description="Include 'update' link into table (default true)" />
Cheers.

Resources