[jBPM Users] - Re: How to get history variables and processInstanceId from
by npirard
[jBPM 4]
hello,
I think I need access to history variables too. Here is my need :
_ I create a process instance that does some stuff, and in particular creates a business object I will need to retrieve (an entity stored somewhere)
_ after the workflow is over, I would like to retrieve what it has created. So my idea was that my workflow would set a variable with the id of my business object, and after the workflow is finished I will search the history and get my variable.
it is easy when my workflow is not ended :
String businessId = (String) executionService.getVariable(processId, "businessId");
but when it is ended there is nothing in the API like I could do:
String businessId = (String) historyService.getVariable(processId, "businessId");
and I have not found any other way
so my question is : does the jBPM team intend to do something like that, so that the variable of history processes can be retrieved via the API ?
or maybe I overlooked something that already exists?
I searched the JIRA, but did not fully understand what was intended, especially with this one :
https://jira.jboss.org/jira/browse/JBPM-2398
the description : "expose the history that is in the database through the api" sounds nice, but then it seems to specialize on tasks, plus it seems a bit dead
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4258338#4258338
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258338
15 years, 3 months
[Security] - Re: Caller unauthorized on using a ejb3 statetlesssessionbea
by praenti
Perhaps you're right I will test that in the next hours. To be complete, this is my LoginFacade:
| /**
| *
| */
| package vwg.audi.cancard.business;
|
| import javax.naming.AuthenticationException;
| import javax.security.auth.login.LoginContext;
| import javax.security.auth.login.LoginException;
|
| import org.apache.log4j.Logger;
| import org.jboss.security.auth.callback.UsernamePasswordHandler;
|
| import vwg.audi.cancard.JAASLoginException;
| import vwg.audi.cancard.ui.JAASConstants;
|
| /**
| * LoginFacade
| *
| * @author Michael Obster (michael.obster(a)epos-cat.de)
| */
| public class LoginFacade {
| private Logger log = Logger.getLogger(this.getClass());
|
| private LoginContext lc = null;
| private String loginContext = "";
| private String clientContext = "";
|
| public LoginFacade(String loginContext, String clientContext) {
| this.loginContext = loginContext;
| this.clientContext = clientContext;
| }
|
| /**
| * Real login, used by GUI.
| *
| * @param username
| * @param strPassword
| * @throws Exception
| */
| public void login(String username, String strPassword) throws Exception{
| char[] password = strPassword != null ? strPassword.toCharArray() : "".toCharArray() ;
| UsernamePasswordHandler handler = new UsernamePasswordHandler(username, password);
|
| lc = null;
| try {
| //Login for usercheck
| lc = new LoginContext(loginContext, handler);
| lc.login();
|
| } catch (Exception e) {
| Throwable t = e;
| while (t.getCause() != null) {
|
| if (t instanceof AuthenticationException) {
| break;
| }
| t = t.getCause();
| }
|
| //Analyse AuthenticationException
| if (t instanceof AuthenticationException) {
| AuthenticationException ex = (AuthenticationException)t;
| String emsg = ex.getExplanation();
| if (!hasValue(emsg)) {
| emsg = "";
| }
| String errorhint = JAASConstants.USER_NOT_AUTHENTICATED;
| if (emsg.indexOf("password expired") > 0) {
| errorhint = JAASConstants.PASSWORD_EXPIRED;
| } else if (emsg.indexOf("error code 49") > 0) {
| errorhint = JAASConstants.PASSWORD_INVALID;
| } else if (emsg.indexOf("error code 19") > 0) {
| errorhint = JAASConstants.USER_REVOKED;
| } else if (emsg.indexOf("error code 32") > 0) {
| errorhint = JAASConstants.USER_INVALID;
| }
| log.debug(username + " " + ex.getExplanation() + " hint: " + errorhint);
| throw new JAASLoginException(errorhint, ex);
|
| } else if (t instanceof LoginException) {
| LoginException ex = (LoginException)t;
| String emsg = ex.getMessage();
| if (!hasValue(emsg)) {
| emsg = "";
| }
| String errorhint = JAASConstants.USER_NOT_AUTHENTICATED;
| if (emsg.indexOf("Password Required") > 0) {
| errorhint = JAASConstants.PASSWORD_INVALID;
| }
| log.debug(username + " " + emsg + " " + errorhint);
| throw new JAASLoginException(errorhint, ex);
| } else {
| log.debug(username + " " + t.getMessage() + " " + JAASConstants.UNEXPECTED_ERROR);
| throw new JAASLoginException(JAASConstants.UNEXPECTED_ERROR, t);
| }
| }
| }
|
| /**
| * Background Login, set user and password from filter.
| */
| public void clientLogin(String username, String strPassword) throws JAASLoginException {
| char[] password = strPassword != null ? strPassword.toCharArray() : "".toCharArray() ;
| UsernamePasswordHandler handler = new UsernamePasswordHandler(username, password);
| try {
| lc = new LoginContext(clientContext, handler);
| lc.login();
| } catch (LoginException e) {
|
| throw new JAASLoginException(JAASConstants.UNEXPECTED_ERROR);
| }
| }
|
| public void logout() throws JAASLoginException {
| if (lc == null)
| return;
|
| try {
| lc.logout();
| } catch (LoginException e) {
| log.error("JAAS-Logout failed!", e);
| throw new JAASLoginException(JAASConstants.UNEXPECTED_ERROR);
| }
| }
|
| /**
| * Helper function tests if Strings have a value.
| *
| * @param s - the String to test.
| * @return true or false
| */
| boolean hasValue(String s) {
| return s != null && s.trim().length() != 0 ? true : false;
| }
| }
|
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4258333#4258333
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258333
15 years, 3 months