House urgent send the item of day notes! (Interceptor and JBPM Workflow application in Project) _ Home Rush Project

Source: Internet
Author: User
Tags in domain jbpm
The Rights management function has been completed
1, module Add, List query
2, Function point Add, query
3, role Add, grant permissions to the role
4. Give the User a role

----------------full test. will return JSON exception fix
The BOS function permission information. SQL Import to Database
Functional paths, referencing Menu.json, action-enabled business methods

<constant name= "Struts.devmode" value= "true"/> When an exception occurs, returns a specific page status code----set false after the line

====================================================================================
First, the use of interceptors, all the action to control the rights
Fine-grained permission control, added, requires a full functional re-test

Filter: Block all URLs
Interceptor intercepts all action accesses
Spring AOP intercepts all service

Block access Path (name) for action
1 The user does not log in the case: Open login function login.jsp, user_login.action (login)
2 If the user has logged in, without any authorization, development change Password: page_common_index.action (homepage), user_editpassword.action (change password)
3 function Other. Action does not have permission to access
4 Super Admin Admin password admin-----development function

First to determine whether the other visit is landing----if it is released
Again to determine whether the user landed------if not logged (to login)
Then determine if the user is Administrator admin-----if it is released
To determine if the user access function is to modify the password or home-----If it is released
Finally determine whether the access function is consistent with the current login----if inconsistent (insufficient authority), if consistent release

<interceptors>
<!--registered Interceptor-->
<interceptor name= "Privilegeinterceptor" class= "Cn.itcast.bos.web.interceptor.PrivilegeInterceptor" ></ Interceptor>

<!--Custom Interceptor Stack-->
<interceptor-stack name= "Privilegestack" >
<!--introduce default stack-->
<interceptor-ref name= "Defaultstack" ></interceptor-ref>
<!--introduction of permission interception-->
<interceptor-ref name= "Privilegeinterceptor" ></interceptor-ref>
</interceptor-stack>
</interceptors>
<!--all action uses custom stack-->
<default-interceptor-ref name= "Privilegestack"/>
If the action introduces the interceptor itself, the default stack will fail

If the user can access the path information after the login, put the session
Practice One: Add a method at the business layer to return list<string> findfunctionsbyuser (user user); Query users can access the feature path
Practice two: In domain user list<string> functions, in the login query, the List is encapsulated in, save to session
If the query is there, encapsulate the related functional path into user functionpaths
Role role = User.getrole ();
if (role!= null) {
User already has a role
For (Function function:role.getFunctions ()) {
User.getfunctionpaths (). Add (Function.getpage ());//Save the feature path to the list of user
}
}

Insert Administrator
Insert into users (Username,password) VALUES (' admin ', MD5 (' admin '));

====================================================================================
Second, the JBPM workflow in the project application
JBPM learning = Business Process Flow + API

Because business processes are different (jbpm business flowcharts, very similar to UML activity diagrams)

* There are many active nodes in the business flowchart The start End State task decision Fork/join (most important task node)


Api:processengine, Repositoryservice, Executionservice, Taskservice

Embedding in projects: JBPM workflow processes and business processes together
* When operating a business process. Operation of the business table, while jbpm workflow table

Workflows can be well managed regardless of the complexity of the process (see the whole process at any time, see which link the current operation is in)

Common practice: Manual (Graphics Designer)----XML Process definition file------published into Workflow Framework---Start this process through business modules

customizing workflows
Management system, in the system administrator can add start node, task node, end node through form for input----generate workflow XML

Third, the design of transit jbpm process. Deploy to Project
Through the JBPM designer to complete the Flowchart four task task nodes, a decision Judge node

Specify the owner of the task for each task node (three individual task designations, three Group task designations)
1. Tasks are performed by a group of people rather than personal tasks (using Group task Settings)
2, if the determination of the owner Candidate-users attribute fixed-------The actual development of the owner is not sure (dynamic designated responsible) Handler
Customize a handler specify group owner
Customize a Handler:roleassignmenthandler, the same handler for different four tasks designated responsible person

3, decision judgment also to specify Handler:arrivedecisionhandler
* According to the variable isarrive judge whether to transit or to the storage

Through the test environment

Iv. deployment of Transit JBPM process (management process)-----------Admin
Process List query: View all processes that have been uploaded
Upload process Zip compressed file: After uploading, the process deploy
View flowchart
Delete the process definition, which can be used at test time. When the process is officially enabled)

processdefinition_list.jsp List
processdefinition_deploy.jsp Upload Release
Admin.json Add menu point to Process List


Query the entire process definition information Repositoryservice provide createprocessdefinitionquery ()
Java.util.list<processdefinition> List () results list<processdefinition>

Direct query to show list of business processes by directly executing query action with Admin.json menu

View flowchart
String Deploymentid = "90001"; Publish ID
String resourcename = "Test.png"; Same as Business process name png
InputStream in = Processengine.getrepositoryservice ()
. getResourceAsStream (Deploymentid, resourcename);


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.