Design ideas for this situation... should I use a design pattern of some sorts?

Okay, here is a situation that I have at work. The way it's designed now sucks bad, so i'm trying to re-design it so it's a lot more object oriented. I'm just in need of some opinions. This is purely an architecture question

Here it is:
In our application there are different situations when a user needs to submit data to an attorney. For example, the user might submit sales information, or the user might submit Cure information. There are other situations like this, but we'll take these 2 as an example.

What happens is when the user submits, say, sales information, 4 or 5 values are sent through a web service and that web service calls a stored procedure to store those values into the attorney database. There are 2 or 3 different attorneys that all use instances of this database. So CMS uses this database (it's called FIPS) and HAS also uses FIPS, but these attorneys are in different locales so my web service has to determine which attorney to submit this data to. This is done via a value on the client end. If the value is "CMS" then the IP address for the web service is xxx.xxx.xxx.xxx, but if the value is "HAS" then the web service IP address is yyy.yyy.yyy.yyy There can be any number of attorneys that use this "FIPS" database in the future, so this needs to be flexible. IE: when a new attorney signs up and uses the FIPS database, I don't want to have to go to every client and write some conditional logic to accomidate for the new FIPS user.

There is one other situation. Some attorneys don't want to use FIPS but they want an email to be sent when the client submits data (for example, sales data). So if the value in the database on the client end is "OSB" the an email needs to be sent to that attorney instead of pushing data through a web service.


1.) User clicks Submit Sales Information
2.) Is this an "OSB" attorney?
3.) If so, then generate an email and in that email include the 4 or 5 sales related fields
4.) If not then get the attorney code ("CMS", "HAS"...etc)
5.) Based on the attorney code set the IP in the web service to the correct IP and submit data directly into FIPS (database)

This can all be done rather easily using conditional logic (which is how it's setup right now) But I am aiming for a really flexible solution. One that allows me to submit other data in the future with relative ease (ie: right now we might not submit Withdrawal information to the attorney, but it could happen in the future) Also, when a new attorney uses the FIPS database I want it to be as easy as possible to add this new attorney.

Any ideas on design patterns, or any other suggestions? I am open to anything.

Thanks!
LVL 6
PoeticAudioAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gabesoSolution ArchitectCommented:
Sounds like you need a workflow engine in there to handle asynchronous processes - i.e. fire-and-forget calls to services. Then all of the logic can be re-implented as workflow logic.

e.g. On some service call, check this and that and if this condition is true then send an email here, run this process and exit, otherwise notify accounts department.

Then all of this 'conditional logic' can be centrally managed.

Look at (open-source Java):
http://wfmopen.sourceforge.net/

and (Commercial .Net):
http://www.skelta.com/

and (open-source Java):
http://www.jboss.com/products/jbpm

In fact if you are thinking about doing it 'properly' you may want to start thinking about a jboss based architecture.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.