Following is the sample code of how to start a JBPM process instance.
/ ** * Start a process instance. * * @ Param name * Process name. * @ Param version * Version number, default is the latest version. * @ Param formID * Business-related form number ,optional field. * The meaning of the parameter is: after filling the form, the process uses the ID as the process instance variable. * It was Saved in the workflow system, so the form data can be obtained from business information with the ID. * @ Param actor * Sponsor of the process. * @ Return instance * ID No. + task instance ID (if any), the format 'ID No.-task instance ID'. * / public String startProcessInstance(String name, int version, String formID, String actor); jbpmContext = jbpmConfiguration.createJbpmContext(); try { ProcessDefinition def; if (version == 0) { def = jbpmContext.getGraphSession().findLatestProcessDefinition(name); } else { def = jbpmContext.getGraphSession().findProcessDefinition(name,version); } ProcessInstance instance = new ProcessInstance(def); TaskInstance taskInstance = instance.getTaskMgmtInstance().createStartTaskInstance(); if ((formID != null) && (!formID.equals(""))) instance.getContextInstance().setVariable( name + "-" + version + "-"+ instance.getId()+ "-Form", formID); jbpmContext.save(instance); String rtn = String.valueOf(instance.getId()); //if any task instance if (taskInstance != null){ taskInstance.setActorId(actor); rtn += "-"+ String.valueOf(taskInstance.getId()); }else{ instance.getRootToken().signal(); } return rtn; } catch (Exception e) { e.printStackTrace(); log.error(e.getMessage()); } finally { jbpmContext.close(); } return ""; }
jBPM, is the full name of the Java Business Process Management, is a lightweight J2EE-based workflow management system. jBPM is an open-source projects, follow the Apache License. On October 18, 2004, jBPM released version 2.0. On the same day it joined the JBoss, and became part the JBoss enterprise middleware platform and named as the JBoss jBPM.
jBPM has two characteristics that made it one of the biggest star. One of the biggest features is its definition of business logic did not use some of the current norms, such as WfMC’s XPDL, BPML, ebXML, BPEL4WS, and so on, but its own definition of the JBoss jBPM Process definition language (jPdl). jPdl a business logic process as a UML state diagram, if you are not familiar with UML state diagram, that learning the language of the computer flow chart you should be familiar with the express ways and means more or less the same. jPdl detailed definition of the status of each part of the map, such as start, end, the conversion between the state and so on; their integration is another feature of Hibernate, said to be the exact binding, the use of Hibernate to manage the database, so jBPM Only focus on his control of business processes.
From the above we can see, jBPM is a business process management engine, a workflow engine. In addition, at the same time it realized its jPDL and BPEL support. It integrates technology to deal with Hibernate database, to create a series of database tables, persistent workflow engine required for the state. Therefore, jBPM supports all Hibernate support of the database, to be able to Java Persistence object to the database, Hibernate to support the Java class object database to save!
24 Sep
Posted by support as Win32/MFC 295 views, 0 Comments
Question:
In some app like WinSpy/Spy++ to make adjustments to list controls. It can correctly set an app’s list control’s modes, alignments,
sorting, styles, and extended styles. It can also get the widths of the columns and count of items.
The problem is that you cannot seem to get the columns’ names or the item text. The app uses code like this, where lc is a pointer to the target app’s list control:
lc->GetColumnWidth();
lc->GetItemCount();
lc->ModifyStyle();
lc->SetExtendedStyle();
lc->GetHeaderCtrl()->GetItemCount();
That all works fine, but when you try something like this, it doesn’t work:
TCHAR colname[256]=_T("");
LVCOLUMN lvcol;
ZeroMemory(&lvcol, sizeof(lvcol));
lvcol.mask=LVCF_TEXT;
lvcol.cchTextMax=sizeof(colname)-1;
lvcol.pszText=colname;
lc->GetColumn(col, &lvcol);
GetColumn may return TRUE or FALSE, but the LVCOLUMN structure remains unchanged. If you tried using that same code in a test app to get the name of a column from that app’s own list control and it worked. It only seems to fail when use it from a different app.
Solution:
Well, there is no surprise here; in fact, if there is any surprise, it is that you did not manage to totally crash the target app (I presume that lc is a CListCtrl::FromHandle of an HWND in another process).
Think about this case:
you are passing the address of a data structure in YOUR process as a LPARAM-sized value to some totally different process, where that LPARAM value is completely and utterly meaningless.
David Ching did a remote-sendmessage DLL some time ago. This essentially does DLL injection of the code so it is running in the target process; you can google for this by looking for SendMessageRemote.
24 Sep
Posted by support as Win32/MFC 56 views, 0 Comments
How to catch the events when you click on the application's icon on the taskbar?
8. Get Item Infomation
TCHAR szBuf[1024];
LVITEM lvi;
lvi.iItem = nItemIndex;
lvi.iSubItem = 0;
lvi.mask = LVIF_TEXT;
lvi.pszText = szBuf;
lvi.cchTextMax = 1024;
m_list.GetItem(&lvi);
More infomation: Q173242: Use Masks to Set/Get Item States in CListCtrl
9. Get the header titile of CListCtrl
LVCOLUMN lvcol;
char str[256];
int nColNum;
CString strColumnName[MAX_COL];
nColNum = 0;
lvcol.mask = LVCF_TEXT;
lvcol.pszText = str;
lvcol.cchTextMax = 256;
while(m_list.GetColumn(nColNum, &lvcol))
{
strColumnName[nColNum] = lvcol.pszText;
nColNum++;
}
10. Scoll the scollbar to ensure item visible
Without a special note,the listctrl has the default view style of report.
1. CListCtrl style
LVS_ICON: for each item displayed great icon
LVS_SMALLICON: for each item displayed on the icon
LVS_LIST: a show with a small icon on the item
LVS_REPORT: Show item details
You can inspect the Windows Explorer, just like “View” tab with “icon, small icon, list details”
2. CListctrl style and expand style
LONG lStyle;
lStyle = GetWindowLong (m_list.m_hWnd, GWL_STYLE); // Get the current window style
lStyle &= ~ LVS_TYPEMASK; // Clear display
lStyle |= LVS_REPORT; // set style
SetWindowLong (m_list.m_hWnd, GWL_STYLE, lStyle); // set style
DWORD dwStyle = m_list.GetExtendedStyle ();
dwStyle |= LVS_EX_FULLROWSELECT; // highlight the selected full row
dwStyle |= LVS_EX_GRIDLINES; // grid lines (with the style of the report)
dwStyle |= LVS_EX_CHECKBOXES; // checkbox controls
m_list.SetExtendedStyle (dwStyle); // set expand style
Note: Please check MSDN for style details.