on ‎2006 Oct 04 9:00 AM
Hi all
I am making an application using CAF. My application has some properties which are used to control the application.
I can store these properties and their values in XML file and can use it in my application. Is there any other way to handle this in CAF?
Request clarification before answering.
Its starting to sound like you need a <a href="http://java-source.net/open-source/rule-engines">Rules Engine</a>.
You could also try the <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/44/3d3936c5c14a8fe10000000a1553f6/frameset.htm">Business Logic Callable Object</a> if your solution uses Guided Procedures.
Thanks,
Austin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, I try to explain my one example.
We have to give bonus to employees on different countries. Like for Indian employee, I will give 10% bonus , for Germany employee, it is 15% like this. Now we can do more countries in our list. We can change bonus values within a year like this.
For this, I need some solution in CAF.
Thanks for reply
That's not clear:
You have 3 properties which you use in your application: A, B, C. And defined one rule for them: if A=X and B=Y then C=Z. You say that you want to add additional rule in the future. Please demonstrate possible additional rule for these properties with an example.
Best regards,
Aliaksei
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In this case "C" is not configurable parameter, but just calculatable. So, implement additional method for this parameter, like this:
public static String getC()
{
if (A.equals(X) && B.equals(Y))
{
return CONSTANT_Z ;
}
else if (A.equals(Y) && B.equals(X))
{
return CONSTANT_U ;
}
else ....
}
Best regards,
Aliaksei
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Using Application Configuration functionality you can easily handle your properties in user safe way: Visual Admin -> Server -> Services -> Configuration Adapter -> Configurations -> apps -> sap.com -> <your_caf_app> -> appcfg -> Propertysheet application.global.properies. Also you can import/export configurations.
Using CAF entity for configuration storage requires additional implementation effort.
Also, main disadvantage of this approach in my view is default configuration values support. Surely, you can create additional project with type dbcontent but that is unjustified effort in comparison with Application Configuration functionality.
Finally, ejb usage for application configuration storage in the same application looks like a workaround but not a solution.
Best reagrds,
Aliaksei
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think i need to explain my requirement little more. In my application, I have some set of rules which are used to control application. These rules can be changed over a time. So I need some way to maintain them easily.
Rules are like this:
Assume I have Three property say A,B and C.
now if A = X and B = Y then C = Z
I can make a database table with A and B as key fields. But I don't know whether it is an efficient way to handle this.
Yes, there are some disadvantages to using the Entity Service for this. One advantage of using an Entity Service over a properties file is that you can easily build a CAF ui pattern or VC UI on top of it (also the default service browser). This could be more user friendly than the J2EE Visual Admin and be incorporated into your application. True, you could build a custom UI on top of the j2ee properties, but this would be extra effort.
You could also create an Entity Service to store these values. This way you would not have to worry about another file on the file system and you could leverage the CAF data transport / deploy mechanisms.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Saurabh,
J2EE application service has generic support for application properties handling. Please read the <a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/2ce854ed-0701-0010-deb5-ffd61d73fd9f">Application Configuration</a> chapter (page 7). This short overview of this feature.
use the following coding in order to retrieve properties:
Context ctx = new InitialContext();
ApplicationConfigHandlerFactory chf =
(ApplicationConfigHandlerFactory) ctx.lookup("ApplicationConfiguration");
Properties props = chf.getApplicationProperties();
Compartment: SAP_J2EE
DC: configuration
PP: default
One hint: you can even put configuration listener in order to effect changed configuration data without server instance restart.
Best regards,
Aliaksei
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.