How can i set current date using expression builder in oracle adf? - weblogic

How can i set current date using expression builder in oracle adf?
i am using jdeveloper 11.1.1.3.0 and using Input Date(ADF faces.common.component)

The expression builder is used to build EL expressions that reference a method or a value property. Its not meant to set a value but to make it available for editing. One option would be to use a method expression to invoke an action on a manage bean that then sets the value. However, in JSF 1.2 you cannot pass arguments to an EL method and for this reason you would need a work around for setting a date. The work around is that the method expression (and thus the press of a button) invokes a method, which then creates the current date (or whatever date you want to pass in) and sets it on the component directly (though setting it on the component model works much better IMO).
Frank

Another option is to have your datasource field have a default value defined for it in the business service layer. So for example if you are using ADF BC then your field can have a default of adf.currentDate.

Related

Can I use filters in Intellij structural search to reference variable counts?

I am trying to create a custom inspection in IntelliJ using structural search. The idea is to find all methods that have one or more parameters, of which at least one is not annotated. Bonus: Only hit non-primitive types of parameters.
So far, I have created the following Search Template:
$MethodType$ $Method$(#$ParamAnnotation$ $ParameterType$ $Parameter$);
using these filters and the search target "complete match":
$Parameters$: count[1,∞]
$ParamAnnotation$: count[0,0]
However, this only hits methods without any parameters annotated. I want it to also match methods where only some parameters have an annotation but others don't.
Is it possible to reference the count of one variable in the filter of another, e.g. by using script filters? If so, how?
You can do this by creating a Search Template like this:
$MethodType$ $Method$($TypeBefore$ $before$,
#$ParamAnnotation$ $ParameterType$ $Parameter$,
$TypeAfter$ $after$);
Filters:
$Parameters$: count=[1,1] // i.e. no filter
$ParamAnnotation$: count=[0,0]
$before$: count=[0,∞]
$after$: count=[0,∞]
This will find all method with at least one parameter without annotation.

How can I make parameters optional?

I need some help with pentaho report designer.
I've used some parameters to filter my data, but, it seems that I'm obliged to filter on these parameters to show data on my charts.
So, this is what I want, I need to make my parameters optional. It means that I want to show global views even if I don't select a parameter.
Any thoughts?
Untick the mandatory checkbox in the parameter settings dialog.
You must create a hidden parameter; Let's call it "Flag" that tests whether the parameter are set, by using this post-processing formula.
=OR(ISNA([date_from]); ISNA([date_to]))
and then in your query reference that new parameter:
Select .....
where ${Flag} = TRUE OR (date between ${date_from} and ${date_to})

How to use variable value in live templates in Intellij IDEA?

I want to create live template for setter.
I've created this template
How can I use value of par variable to generate value of var variable? Basically, I want to avoid redundancy here and put name of variable only once and other one will be generated automatically by some algorithm.
UPDATE
I want to clarify a little bit what I want to achieve.
Suppose I want to create setter with name setTime which has parameter time.
public void setTime(long time)
{
// ...
}
I don't want to type "time" twice - capitalized and non-capitalized. I want to type just parameter name so method name will be generated automatically.
UPDATE (Answer)
Turned out that variable order is important. This is final result of what I want
You can use the soutv as an example, notice how it defines a copy of a variable:
It's also possible to define custom expression for live templates via plugins or Groovy code:
How can i add custom expression functions for Live templates in Intellij.

How can I print a servlet context attribute in EL?

Is there a way I can get a attribute set in ServletContext in EL so that it ends up as a JavaScript variable?
I am setting it as
context.setAttribute("testing.port", "9000");
I tried retrieving it like
alert("port" +'${testing.port}');
I am just getting a blank.
The problem is the period (.) in the key name. EL interprets the period as a call to an accessor method named getPort1 on whatever object testing references. Fetch the value from the appropriate implicit object:
${applicationScope['testing.port']}
or just use a different key:
${testingPort}
1Yes, this is a simplification of what really happens. It may also look for a predicate getter named isPort, or try Map#get("port").

Execute a program via SUBMIT, with GUI suppression

I want to expose the functionality of an SAP program (transaction) as a BAPI.
I need to call a report and supply range filters such that the GUI is bypassed.
Does anyone have a working example of the SUBMIT ... WITH ... ABAP construct, or other suggestions on how to accomplish what I need to do?
Here is a working example:
SUBMIT SAPF140
TO SAP-SPOOL "optional"
SPOOL PARAMETERS print_parameters "optional"
WITHOUT SPOOL DYNPRO "optional (hides the spool pop-up)"
VIA JOB jobname NUMBER l_number "optional"
AND RETURN "optional - returns to the calling prog"
WITH EVENT = REVENT
WITH BUKRS IN RBUKRS
WITH BELNR IN lRBELNR
WITH GJAHR IN RGJAHR
WITH USNAM = SY-UNAME
WITH DATUM = SAVE_DATUM
WITH UZEIT = SAVE_UZEIT
WITH DELDAYS = RDELDAYS
WITH KAUTO = 'X'
WITH RPDEST = SAVE_PDEST
WITH TITLE = TITLE.
All the "WITH" statements relates to selection fields on the called program where I use = it is a PARAMETER statement (single field), where I use IN it is a SELECT_OPTIONS statement (range)
Here is a simple example of how to fill a range:
REFRESH lrbelnr.
lrbelnr-sign = 'I'.
lrbelnr-option = 'EQ'.
lrbelnr-low = HBKORM-belnr.
CLEAR lrbelnr-high.
append lrbelnr.
If you want to suppress this functionality as a BAPI you have to wrap the functionality in a Remote Function Call (RFC) module. Just implement a RFC function module. Depending how the report is implemented, it may use ABAP objects, which can also be called from your RFC implementation. Given that case you have a quite good solution. Whenever the report is adjusted, also your BAPI will reflect the changes. In case it's a standard programm from SAP which cannot be wrapped, think about copying it into your namespace and adjusting it. Nevertheless this might give some hassle, when SAP performs an update via Support Package Stack and you won't realize it. The output of the two methods is different. Apart from that, if you want to call it from outside, there is nothing else possible than implementing a RFC module.
A submit report can not return the values outside. Reports are always only for GUI functionalities and not for exchanging data. In case your report uses select options, you somehow have to implement this feature "by hand" in your RFC, as this statements can not be used inside RFC modules. I would generally try to rework the report, modularize it and put the selection information in a central class or maybe another function module wich can be called from the report and your BAPI function module. The filters you are talking about can not be implemented in RFCs automatically. You have to implement those ranges manually. The warning which comes up cannot be suppressed, if you do a RFC call from a remote system and the popup with the warning comes up you'll end with a shortdump. Therefore, you have to rework the report and to re-implement it for your needs.
If you are just looking for bypassing it via job scheduling, create a variant and schedule the report with that variant but I suppose that's not the solution you're looking for.
You can use inbuilt BAPI also just write "Range" and press F4.
You can wrap your report in an BATCH INPUT session and execute it inside a function. The only drawback is that you need to rewrite the BATCH INPUT every time you change the report.