cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

composite application framework tool for customization

Former Member
0 Likes
579

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?

Accepted Solutions (0)

Answers (6)

Answers (6)

Austin
Product and Topic Expert
Product and Topic Expert
0 Likes

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.

Former Member
0 Likes

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

Former Member
0 Likes

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

Former Member
0 Likes

Yes I have three properties only but they can have a set of values. like right now A and B can take values X and Y. But in future, they can take P and Q also as values and accordingly C can also take different values.

Hope you understand my point

Former Member
0 Likes

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

Former Member
0 Likes

it is good but putting rules in the code is not easy to maintain. Because I may need to add more rules in future.

Former Member
0 Likes

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

Former Member
0 Likes

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.

Austin
Product and Topic Expert
Product and Topic Expert
0 Likes

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.

Former Member
0 Likes

But property file has a standard syntax propertyName value. How can I define my rules in this format?

Austin
Product and Topic Expert
Product and Topic Expert
0 Likes

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.

Former Member
0 Likes

Thanks Austin

Yes, It will work but i am not able to visualize these properties as entities.

Former Member
0 Likes

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