Custom view criteria in oracle adf - java

I had created one search page using custom viewcriteria with five parameters.In my search page working perfect.I have one doubt,we are entering the some parameters in the search page to get the details from one table, Here i need that values which we are entered in that boxes for using that values into a one java class.
How get those values?

Maybe ,This link can help you.you should glance
http://www.awasthiashish.com/2013/07/implementing-custom-search-form-in-adf.html

You can read the search value from a custom BC method (either on AM or VO impl level):
ViewCriteriaImpl applyVC =
(ViewCriteriaImpl)myViewObject.getViewCriteria("MyViewCriteriaName")
while(applyVC.hasNext) { Row vcrow = applyVC.next(); .... }

Related

Zkoss-8.5.1 Problem creating data binding programmatically

I'm creating a zk component for mount easy grid from view database. One of its powerful features is the automatic generation of filters by column. These filters appear automatically on the top column inside the auxheader tag and all are generated programmatically in java with the column info. Example of database view TIMESTAMP column (sorry not css right now):
https://prnt.sc/ZK9nMws2l68p
My problem now is that I don't know how to bind these datebox generated programmatically in java with the view for recovering the filter values.
I was searching inside the zkoss wiki and only found this:
create data binding programmatically,
where you can find how bind zk components of the zul, or how bind components generated programatically if the parent has an item render option.
But i need generate N datebox, numberbox, textbox depending on the number and type of the columns and recover the values of it.
Anyone knows how do it?
The component has a loot of code and scrap, but more or less the idea is:
https://pastebin.com/Q5VX472L
cols.setParent(gridDatatable);
// create filters inside AuxHeads
Auxhead auxhead1 = new Auxhead();
// create a line with the same number of AuxHeaders as Columns we have
for (int indexColumn = 0; indexColumn < columnsList
.size(); indexColumn++) {
if (columnsList.get(indexColumn).getVisible()) {
// i have definned the diferent Auxheader with a patron factory
Auxheader auxheader = gridDatatableFilterFactory.generateFilter(
columnsList.get(indexColumn).getTerms().getType(),
columnsList.get(indexColumn).getTerms().getKey());
auxheader.setParent(auxhead1);
}
}
// set the Auxhead line between col names and rows
auxhead1.setParent(gridDatatable);
// we add the rowrender for print the rows
gridDatatable.setRowRenderer(
new DatatableRowRender(columnsList, gridDatatableCellFactory));
search();
Thank you in advance, regards.

Hiding information for a particular user

I am using RESTFUL webservices using Spring framework.Some information is displayed on the user interface using the data returned by webservices. There is a webservice, which gets the usernames and their roles from the database. For a particular user , I would like to have all the webservices display data in the form of ####,#### for first name,lastname ; ##/##/#### for date of birth etc. Since I am using JDBC to connect to the database, here's what I was thinking of doing:
Should I consider passing an additional parameter (maybe sending a value 0 or 1 ; 0 for all other users and 1 for user for which I want to hide the information) to each and every GET webservice so that when it comes to getting data from the database in the JDBC code part,I could check whether the flag is set to 1 or 0 and based on this, I could do something like this in the JDBC code :
// Code for a case when flag is set to `0`. Hence retrieving information from the database.
while(rs.next()) {
EmployeeList empList = new EmployeeList();
empList.setEmpId(empId);
empList.setEmployeeName(rs.getString("name"));
employeeList.add(empList);
}
// Code for a case when flag is set to `1`. Hence hiding information and not retrieving information from the database.
while(rs.next()) {
EmployeeList empList = new EmployeeList();
empList.setEmpId(empId);
empList.setEmployeeName("####,######");
employeeList.add(empList);
}
I am wondering, if this is an appropriate way to achieve my task or is there some other way around?
Edit:More clarifications on my requirements:
I am using jqxWidget in the UI to display the information I am getting from a RESTFUL webservice in JSON format. For example, let's consider this example and the screenshot for better understanding of my requirement:
1) Let's say I am getting all the information from the JSON response which I am populating in the jQXWidget as shown in the screenshot above.
2) In the above widget, I would like to hide say for example, First Name, Last Name and Quantity like the following:
First Name = XXXXX
Last Name = XXXXX
Quantity = ####
In my application, if a user clicks on a particular row , a new page is displayed with some additional information. After click, new sets of web services are called and those web services takes First Name, Last Name and Quantity as input parameters. My concern is that, if I somehow replace the First Name with XXXXX, Last Name with XXXXX and Quantity with #### using any approach, when a user clicks on any of the row of the widget, the next set of web services
are going to get XXXX and #### as input and eventually will fail. Please correct me if my understanding until this point is not correct.
Thanks
I am using Spring 4.2.5 version.
This depends on what sort of information hiding you want to achieve. Typically you shouldn't do this manually.
You can use, for example, role-based authorization. Exact details depends on the web-service framework you are using.
For spring MVC, you can use something similar to this:
Custom authorization in Spring MVC

JSP Multiple SQL Selects

I am getting familiar with Java through involvement on a servlet web service project that is now up and running. But the stakeholders want a front end that will allow them to examine the audit table set up in a SQL server database. I am trying to quickly put one together in JSP with initial success but now stuck.
I want a drop down list to provide a list of all the users (Unique). I have acheived this using a JSTL taglib method following the link below with the following SQL;
"SELECT DISTINCT(USER_ID) FROM AUDIT_MESSAGE".
http://www.apekshit.com/t/205/JSTL-SQL-Query-Tag-Example
Now I want, when the user clicks on one of the users names it automatically populates another drop down list with a list of times that user logged in with the following SQL;
SELECT SESSION_ID, EventTIME FROM dbo.AUDIT_MESSAGE
WHERE OPERATION = 'loginResponse' AND RESULTS = 'OK'
AND USER_ID = 'firstdropdownlistselection'
Then when an item from the second drop down list option is selected a third SQL statement of;
Select * FROM dbo.AUDIT_MESSAGE
WHERE SESSION_ID = 'seconddropdownlistselection'
This is then used to populate a list box of the Users events at the selected time.
I have found the following link below offering another method but I am unsure whether to continue with the method I have started with or is there a better way. Can someone please advise me on what method would work best?
Multiple ResultSets
Thanks in advance
AJF
You could display the whole database table information(minus the ids) if this is what they want.
If you want to do it in these steps (select user, select session, display information) what you are doing is correct.

jqgrid: change value of select

I am developing a web application using JSP & Servlet (IDE: Eclipse, Database: Oracle10). I am using jqGrid to display records in tabular format.
code snippet:
{name:'CITY',index:'CITY', width:70,editable:true,edittype:"select",editoptions: {dataUrl: 'ProfileServ?action=comboCity', dataEvents: [{ type: 'change', fn: function(e) {alert(this.value);city= this.value;}}],}},
{name:'PIN',index:'PIN', width:200,sortable:false,editable:true, edittype:"select",editoptions: {dataUrl: 'ProfileServ?action=comboPin'}},
I want to change values of PIN according to the value selected in CITY. I have used dataEvents and type: 'change' to get the selected value of CITY. I am successfully getting the selected value of CITY.
My question is that how should I update the values of PIN when value of CITY is changed?
Unfortunately there is no easy way to implement dependent selects. One have to update the whole <select> of dependent select manually inside of change callback (update selects of PIN in your case). The only which I can suggest you is examining the code of the demo from the answer. It is not exactly what you need because it don't use dataUrl, but it shows what should be done.

how to delete multiple data using check box in google app engine (JAVA)

In Google app engine, how can i delete multiple data selected in check box. For a sample i had attached the image below. here i had selected the multiple check boxes and the data shown are stored in the Google app engine.
i have my jsp code for check box like this,
<input name="delete" type="checkbox"/>
can anyone suggest me how to select the data and delete it from Google app engine.
Edited:
For storing the data i used,
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Entity employee = new Entity("Employee");
employee.setProperty("First Name", fname);
datastore.put(employee);
For retrieving the data i used,
Query query = new Query("Employee");
List<Entity> emp = datastore.prepare(query).asList(FetchOptions.Builder.withLimit(20));
for (Entity user : emp){
// inside the table
user.getProperty("File Name")}
By this i can retrieve the data.
First of all, I recommend that you use two frameworks to make your life easier:
Stripes
Objectify
OK, here you go: I'm not sure to which degree your question is a basic JSP/Servlet question or a specific Appengine question. However, you have to do the follwoing:
Have a list of checkboxes on your JSP page, like this: <stripes:checkbox name="employees[${loop.index}].id" value="${employee.id}"/> (see: http://www.stripesframework.org/display/stripes/Indexed+Properties)
Pass a list of IDs (of the entities that should be deleted) to the Servlet.
Delete the entities based on these IDs.
Here's the catch: Appengine can terminate the request before all entities are deleted. That can happen if the request takes too long. Therefore you should delete the entities asynchronously, using chunks of data. See this answer for further information.

Categories