New Posts New Posts RSS Feed: Where to place Business rules
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Where to place Business rules

 Post Reply Post Reply
Author
rbautistaole View Drop Down
Newbie
Newbie


Joined: 01-Apr-2011
Posts: 37
Post Options Post Options   Quote rbautistaole Quote  Post ReplyReply Direct Link To This Post Topic: Where to place Business rules
    Posted: 01-Apr-2011 at 6:42pm
Hi.
I´m evaluating DevForce and i have any questions about the place for some business rules.
 
Imagine an use case to place a purchase order. In the process when a product is selected to the order, i want to verify the existences for the product (how you suggest implement this calidation rule?) , later when the order is placed, in the server i want to make the same validation BUT WITH FRESH stock items, since the stock may be changed in the interim, and if all is correct, then the existences must be updated maybe creating a stock object, or updating a field in the product object.
 
Can you give to me a suggest to implement ths use cas with devforce?
 
With RIA SERVICES I think isolated the business rules in a Domain Service to purchase orders.
 
Excuse my bad english.
 
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 667
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 04-Apr-2011 at 7:57pm
Hi rbautistaole;

If I understand correctly, you want to do the following:

1. You have a customer who wants to purchase a product.

2. You present the customer with the product.

3. When the customer commits the purchase order, you want to check whether the product is still in stock because it's possible for another customer to buy the last product.

For this use case, I believe the appropriate way to handle it is using concurrency.

This is quite a broad topic in DevForce. See if this can get you started.


I hope I've understood your requirement correctly. If not, please feel free to let me know.
Back to Top
Hunter View Drop Down
Newbie
Newbie
Avatar

Joined: 11-Nov-2010
Location: Texas
Posts: 1
Post Options Post Options   Quote Hunter Quote  Post ReplyReply Direct Link To This Post Posted: 08-Apr-2011 at 9:35am

DenisK,

I have the same question, but it is not related to concurrency.
 
I have other subprocesses related to system-to-system communication that I want to execute.
 
So, I save a transaction and the state of that transaction changes to a state that lets the system know that it now needs to send send a message to another system. I like being able to just change the state of a field on a record and save it, but I do not see how to make DevForce have a server side process that inspects this save and then does other work based on the state and possible reject the state if the other system is down. (I know this last part can be debated, but in the current architecture there is no middleware that can be used to store the message if the other system is down.) 
 
I look forward to learning how to do this in DevForce.
 
Take care...
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 667
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 11-Apr-2011 at 11:56am
Hi Hunter;

Based on this statement,

"how to make DevForce have a server side process that inspects this save......."

it sounds like you want to intercept and inspect the save. We can do this by using EntityServerSaveInterceptor. Please see the following links for further details.



I hope this is what you're looking for. If not, please let me know.
Back to Top
rbautistaole View Drop Down
Newbie
Newbie


Joined: 01-Apr-2011
Posts: 37
Post Options Post Options   Quote rbautistaole Quote  Post ReplyReply Direct Link To This Post Posted: 11-Apr-2011 at 6:48pm
Hi again.
 
My requeriments is more like Hunter described. I have many scenarios for this, as example:
1.- I have a multilevel net of objects where the cost of an object is the sum of the previous level of objects, in such case i want to make persistent the cost of the object as the sum of your object components to avoid load the full net when i need the cost of a object in top levels. For this, in legacy implementation when a object in low level is saved i recalculate the cost of the parent level as cost += objectchild.cost - objectchild.originalcost.
2.- When i save a purchase order item, i need to CREATE an object to save the  stock for the associated product, i need intercept the save of purchase order item an as part of the same transaction create the stock item.
 
I dont like the save interceptor because i think that the onsaving event should be an "as class" event to encapsulate the logic by each class and not for all class entities. (I have used XPOBJECT ORM by DevExpress and using the Onsaving event in my object to ths business rules)
 
Do you have another alternative to my requeriments?
thanks.
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 667
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 12-Apr-2011 at 12:20pm
Hi rbautistaole;

It sounds like you want a better separation of concerns and granularity with EntityServerSaveInterceptor. This has been added as a feature request. According to the lead developer, this is planned for 6.1.1 release. As of now, another alternative could be the Remote Server Methods. http://drc.ideablade.com/xwiki/bin/view/Documentation/rsmc-query




Edited by DenisK - 12-Apr-2011 at 12:21pm
Back to Top
s_tristan View Drop Down
Newbie
Newbie
Avatar

Joined: 10-Mar-2011
Location: Ukraine
Posts: 18
Post Options Post Options   Quote s_tristan Quote  Post ReplyReply Direct Link To This Post Posted: 13-Apr-2011 at 6:04am
Is there an estimate when release 6.1.1 will be available?
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 667
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 13-Apr-2011 at 10:26am
Hi s_tristan;

6.1.1 will be released around mid June.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down