andyj2ee

java tec sky

统计

留言簿(4)

activemq

aop

design pattern

other blog

spring

workflow

多线程

软件架构师

阅读排行榜

评论排行榜

#

shark 工作流引擎新特性 HistoryRelated assigment

shark 新特性:

* Included new HistoryRelated implementation of Assignment API - great contribution by Rich Robinson.
  You can use it by commenting standard AssignmentManager and uncommenting HistoryRelated assignment
  manager entries 
in Shark.conf (if you are configuring shark this way), and test it with
  Publish Document proces from test
-JavaScript.xpdl.

I've attached the latest HistoryRelatedAssignmentManager class and also an updated
version of test-JavaScript.xpdl.

The class now supports the following extended attributes (the names of which
can be redefined in Shark.conf):

* ReassignToOriginalPerformer
* ReassignToOriginalPerformer
* DoNotAssignToPerformerOfActivity

As mentioned in the comments, one of each extended attribute should be
associated with any single activity definition.  If anybody wishes to
extend/modify this class in any way, one obvious improvment would be to allow
multiple copies of each extended attribute to be assigned to a single 
activity.
I would ideally have liked to do this, but I don't need such functionality at
the moment, and unfortunately don't have any more time to spend on it.

In order to get the class working, the following properties need to be 
specified
in Shark.conf:

#
# HistoryRelated assigment manager
#
AssignmentManagerClassName
=org.enhydra.shark.assignment.HistoryRelatedAssignmentManager
HistoryRelatedAssignmentManager.username
=admin
HistoryRelatedAssignmentManager.password
=enhydra
HistoryRelatedAssignmentManager.extAttrReassignToOriginalPerformer
=ReassignToOriginalPerformer
HistoryRelatedAssignmentManager.extAttrAssignToPerformerOfActivity
=AssignToPerformerOfActivity
HistoryRelatedAssignmentManager.extAttrDoNotAssignToPerformerOfActivity
=DoNotAssignToPerformerOfActivity
The XPDL example is a "publish document" process that describes the workflow that may occur when publishing a web-based document. Note that in the following, a question mark represents either "1" or "2" depending on which moderator we are referring to: * Initially, an author creates a document and submits it to two moderators. The "DoNotAssignToPerformerOfActivity" ext attrib is used for each moderate_document_? activity to ensure that two different moderators moderate the document and that the same moderator cannot moderate it twice. * Each moderator moderates the document and says whether or not it is ok by setting the values of the moderate_?_ok WRD. If OK, the moderator then has to submit the document. Note that the AssignToPerformerOfActivity ext attrib is used to ensure that the moderator who moderated the document is assigned the appropriate submit_document_? activity. * If either moderator rejects the document, then the author has to update it. Again, we use the AssignToPerformerOfActivity ext attrib to ensure that the author who originally created the document has to update it. * When updated, the author has to re-submit the document using the same submit_document activity. We use the ReassignToOriginalPerformer ext attrib to ensure that the author who resubmits the document is the same author that originally submitted it. * Finally, when both the moderators are happy with the document, a publisher reviews it (if he rejects it, we head back to "update document" - in exactly the same way as if a moderator rejects it). When the publisher is happy with the document, he publishes it. We use the AssignToPerformerOfActivity ext attrib to ensure that the publisher who publishes the document is the same publisher that reviewed it. That's it... I've tested both the class and the XPDL to some extent, but both could do with some more testing if anybody would like to do it. Let me know if you have any questions.

posted @ 2005-04-30 14:16 java光环 阅读(539) | 评论 (0)编辑 收藏

Integrating workflow engines with other system modules

Hi all,

This is probably a newbie question so please be tolerant :-)

I am involved in the development of a system that has a business process management component. The system is based on Spring, Hibernate and Web Work 2. The question is, out of all those available BPM engines, which ones can easily be integrated into other infrastructures? My first impression is that BPM engines designed to be the infrastructure itself, so that functions such as data access, business logic and user interface are specified around it. As opposed to using another infrastructure (in our case, Spring + Hibernate + Web Work) where the BPM engine is merely a component.

Is this distinction real? Should BPM engines logically be the center-piece of the system? Or am I grossly misunderstanding the issues?


--->

I feel that the best way to use a Workflow/BPM system is as a database is : something external that you access with some system users.

Sometimes an embedded workflow engine is necessary, but in this case, the application that embeds should dictate the infrastructure

--->

I think it should be implemented as an aspect

I have implemented a workflow engine before. I made it completely independent of the business objects etc. However, I had to modify business facades to call into the workflow engine; for example, to start a new process for a new request. At this point, I am thinking of doing it as an aspect in Spring, and I believe this will work out nicely.

--->

I am currently building a project using Struts, Spring and Hibernate with OSWorkflow. The current development build (2.8) has built-in support for a Spring / Hibernate environment. In this case, performing an action in the workflow can check against a set of pre-conditions, which can refer to logic in the business layer and can then call some functions if the conditions hold, which can also refer to business logic. This is nice because Spring deals with the dependencies for the conditions and functions. The end result is my business logic is protected by the workflow engine, which prevents any action being performed in the wrong stage of the process.

The only downside of OSWorkflow is that you have to call the workflow action by passing the action's id (an int) and a map of all the inputs to the engine. I'm getting around this by writing an abstraction layer that provides nice method signatures (the business facade) for my struts actions (or any other client). These methods will map to an action id, take all the arguments from the signature and wrap them in a map and call the action.

I hope this is helpful.

Adam

http://www.manageability.org/blog/stuff/workflow_in_java/view

posted @ 2005-04-28 18:49 java光环 阅读(528) | 评论 (0)编辑 收藏

工作流引擎Shark配置

 如果在Shark中未定义程序映射,Shark将调用默认的ToolAgent,在Shark.conf中可定义;

RuntimeApplicationToolAgent可执行其它外部程序,比如notepad等,此时,传入的application mode如果为0,则Shark会等待应用程序的执行结束;如果不为0,则Shark在应用程序开始后会继续流程的处理;

JavaScriptToolAgent可用于执行JavaScript,application mode为0,则系统将搜索名为applicationName的文件,执行;

posted @ 2005-04-22 11:37 java光环 阅读(869) | 评论 (0)编辑 收藏

Spring Hibernate Config: mappingDirectoryLocations

 I have seen a bunch of projects which are using Spring and Hibernate, and have something like the following in their applicationContext.xml file.

<property name="mappingResources">
<list>
<value>com/almaer/model/Person.hbm.xml</value>
<value>com/almaer/model/Car.hbm.xml</value>
<value>com/almaer/model/Engine.hbm.xml</value>
<value>com/almaer/model/Toy.hbm.xml</value>
</list>
</property>

 Luckily, you can just point to the directory now, and have Spring work it out for you :)

<property name="mappingDirectoryLocations">
<list>
<value>WEB-INF/mappings</value>
</list>
</property>

posted @ 2005-04-20 13:59 java光环 阅读(1383) | 评论 (0)编辑 收藏

关于cascade 与inverse

看贴记录:

 在绝大多数(100%?)情况下,many-to-many的cascade都会设置为"save-update",
比如User和Role是many-to-many的,你不可能在删除一个Role时,把它的所有User都删除吧,反之也不可能。 

双向的many-to-many维护起来确实比较麻烦,且效率可能比较低。
但我始终还是坚持一个原则:双向关联一定要一边设置为inverse="true",更新时两边一起更新。我从来没有遇到过违反外键的情况。
 

从关系本身来讲,一对多,多对一的关系本身都是由多的一方来维护的,
多对多是由双方来维护的

posted @ 2005-04-15 15:09 java光环 阅读(267) | 评论 (0)编辑 收藏

How do you use findByNamedParam,findByNamedQueryAndNamedParam?

spring  封装了对hibernate 底层操作,现列了一些查询方法:

1,findByNamedParam
code:

public List getRolesByName(String roleName) {
        
return getHibernateTemplate().findByNamedParam("from Role role where role.name=:roleName""roleName",roleName);
    }

2,findByNamedQueryAndNamedParam
code:
getHibernateTemplate().findByNamedQueryAndNamedParam("testeCQuery""idCidade", cidade);
xml code:
<query name="testeCQuery"><![CDATA[
             from br.com.ag2.casarural.vo.Cidade as cidade where cidade.idCidade = :idCidade
        
]]></query>

posted @ 2005-04-14 19:31 java光环 阅读(5809) | 评论 (1)编辑 收藏

appfuse 加入初始化数据

appfuse 在new 一个project  如果直接改了自带的user ,role 表名,没有自动装入数据,原因在SETUP时CREAE TABLE 与 测试脚本中的表名不一致造成的,我们只要再修改一下metadata\sql\sample-data.xml文件,把表名改成与类名中的XDOCLET 一致就行了,然后 执行ant db-load 再次select 一下,就可以了.
//--
ant db-prepare // 重新编译类生成 *.hbm.xml 文件,数据表将重建,原来数据表要被drop 掉。

posted @ 2005-04-11 16:58 java光环 阅读(366) | 评论 (0)编辑 收藏

Avoiding "Do you want to resend information" browser messages

 This might be a minor thing but significantly improves the user experience. The problem usually happens when the update action forwards to the view action. Instead of doing a redirect. This means the user sees /editPerson.action in the address field of the browser. But he is really looking at /viewPerson.action. This means that if he presses reload he will resubmit the data. It also means the user can navigate back to the /editPerson.action by using the back and forward buttons or the browser history. 

To avoid this you can use the PRG (Post, Redirect and Get) Pattern. It can be summarized as follows: 

Never show pages in response to POST
Always load pages using GET
Navigate from POST to GET using REDIRECT

Using the PRG approach removes this possibility by never showing the /editPerson.action to the user. This means he cannot navigate back to the page in any way. In this case it means a redirect between the editPerson action (update action) and the viewPerson action (view action).

It is easily implemented in Webwork by using the redirect result type. The final mapping of editPerson and viewPerson looks like this.
<action name="editPerson" class="example.EditPersonAction">
   
<result name="success" type="redirect">
       
<param name="location">/viewPerson.action?id=${userId}</param>
       
<param name="parse">true</param>
   
</result>
   
<result name="invalid.token">/duplicate_post.vm</result>
   
<interceptor-ref name="defaultStack"/>
   
<interceptor-ref name="token"/>
</action>

<action name="viewPerson" class="example.ViewPersonAction">
   
<result name="success">/view_person.vm</result>
   
<interceptor-ref name="defaultStack"/>
</action>
One thing to notice is the OGNL expression in the location (/viewPerson.action?id=${userId}) This means Webwork will evaluate the expression at runtime and replace ${userId}. In this case it is taken directly from a request parameter.

In Struts you would have to manually code the redirect as far as I know.

posted @ 2005-04-04 16:24 java光环 阅读(321) | 评论 (0)编辑 收藏

Preventing Duplicate Logins with Acegi Security

Acegi Security sure makes things a lot simpler (once you have it setup). Today on the AppFuse mailing list, I noticed a link to how to prevent duplicate logins. No code needed, just some configuration changes. Nice!

Update: I tried this on AppFuse and it does work, but I don't like the default implemementation. If a user is already logged in, you can't log in with that same user until the initial session times out. I'd prefer the first session gets invalidated when the second login is made. What's your preference?

posted @ 2005-03-25 11:42 java光环 阅读(496) | 评论 (0)编辑 收藏

Developing Test-Driven Web Applications with Spring and Hibernate

One of the hardest parts about J2EE development is getting started. There is an immense amount of open source tools for web app development. Making a decision on which technologies to use can be tough--actually beginning to use them can be even more difficult.

Once you've decided to use Struts and Hibernate, how do you go about implementing them? If you look on the Hibernate site or the Struts site, you'll probably have a hard time finding any information on integrating the two. What if you want to throw Spring into the mix? For developers, one of the best ways to learn is by viewing sample apps and tutorials that explain how to extend those applications. In order to learn (and remember) how to integrate open source technologies such as Hibernate, Spring, Struts, and Ant/XDoclet, Raible created AppFuse.

The beauty of AppFuse is you can actually get started with Hibernate, Spring, and Struts without even knowing much about them. Using test-driven development, AppFuse and its tutorials will show you how to develop a J2EE web application quickly and efficiently.

posted @ 2005-03-25 09:43 java光环 阅读(375) | 评论 (0)编辑 收藏

仅列出标题
共5页: 上一页 1 2 3 4 5 下一页