public BusinessProcessContext() { Init init = Init.instance(); if (init == null) { enabled = false; } else { enabled = init.isJbpmInstalled(); } }
public ConverterLocator(Class targetClass) { converters = Init.instance().getConvertersByClass(); this.targetClass = targetClass; }
private static boolean isDebugPage(String viewId) { return Init.instance().isDebugPageAvailable() && viewId.startsWith("/debug."); }
protected void afterInvokeApplication() { if ( Init.instance().isTransactionManagementEnabled() ) { raiseTransactionFailedEvent(); } }
public static Jbpm instance() { if ( !Contexts.isApplicationContextActive() ) { throw new IllegalStateException("No application context active"); } if ( !Init.instance().isJbpmInstalled() ) { throw new IllegalStateException("jBPM support is not installed (use components.xml to install it)"); } return (Jbpm) Component.getInstance(Jbpm.class, ScopeType.APPLICATION); }
private void beginNavigation(String pageflowName) { if ( !pageflowName.equals("") ) { if ( !Init.instance().isJbpmInstalled() ) { throw new IllegalArgumentException("attempting to begin pageflow but required org.jboss.seam.bpm.jbpm component is not installed"); } Pageflow.instance().begin(pageflowName); } }
public boolean isInterceptorEnabled() { return Contexts.isApplicationContextActive() && Init.instance().isJbpmInstalled(); }
public boolean isInstalled() { if (installed != null) { return installed; } Install install = componentClass.getAnnotation(Install.class); if (install == null) { return true; } return install.debug() ? Init.instance().isDebug() : install.value(); }
public static boolean isDebugPage() { return Init.instance().isDebugPageAvailable() && getCurrentViewId() != null && getCurrentViewId().startsWith("/debug."); }
@Override public Validator createValidator(String validatorId) throws FacesException { if ( Contexts.isApplicationContextActive() ) { String name = Init.instance().getValidators().get(validatorId); if (name!=null) { return (Validator) Component.getInstance(name); } } return application.createValidator(validatorId); }
/** * Add a new listener for a given event type * * @param type the event type * @param methodBindingExpression a method binding, expressed in EL * @param argTypes the argument types of the method binding */ public void addListener(String type, String methodBindingExpression, Class... argTypes) { MethodExpression methodBinding = Expressions.instance().createMethodExpression(methodBindingExpression, Object.class, argTypes); Init.instance().addObserverMethodExpression(type, methodBinding); }
@Override public Converter createConverter(String converterId) { if ( Contexts.isApplicationContextActive() ) { String name = Init.instance().getConverters().get(converterId); if (name!=null) { return (Converter) Component.getInstance(name); } } return application.createConverter(converterId); }
protected void handleTransactionsAfterPageActions(FacesContext facesContext) { if ( Init.instance().isTransactionManagementEnabled() ) { commitOrRollback("after invoking page actions"); if ( !facesContext.getResponseComplete() ) { begin("before continuing render"); } } }
public Asynchronous() { if ( Init.instance().isJbpmInstalled() ) { BusinessProcess businessProcess = BusinessProcess.instance(); processId = businessProcess.getProcessId(); taskId = BusinessProcess.instance().getTaskId(); } }
/** * Get the view id to be rendered * * @return the JSF view id */ protected String getRenderedViewId() { if (Init.instance().isJbpmInstalled() && Pageflow.instance().isInProcess()) { return Pageflow.instance().getPageViewId(); } else { // TODO: not working right now, 'cos no mock navigation handler! return getFacesContext().getViewRoot().getViewId(); } }
public void handleTransactionsBeforePhase(PhaseEvent event) { if ( Init.instance().isTransactionManagementEnabled() ) { PhaseId phaseId = event.getPhaseId(); boolean beginTran = phaseId == PhaseId.RENDER_RESPONSE || phaseId == ( Transaction.instance().isConversationContextRequired() ? PhaseId.APPLY_REQUEST_VALUES : PhaseId.RESTORE_VIEW ); //( phaseId == PhaseId.RENDER_RESPONSE && !Init.instance().isClientSideConversations() ); if (beginTran) { begin(phaseId); } } }
public void handleTransactionsAfterPhase(PhaseEvent event) { if ( Init.instance().isTransactionManagementEnabled() ) { PhaseId phaseId = event.getPhaseId(); boolean commitTran = phaseId == PhaseId.INVOKE_APPLICATION || event.getFacesContext().getRenderResponse() || //TODO: no need to commit the tx if we failed to restore the view event.getFacesContext().getResponseComplete() || phaseId == PhaseId.RENDER_RESPONSE; //( phaseId == PhaseId.RENDER_RESPONSE && !Init.instance().isClientSideConversations() ); if (commitTran) { commitOrRollback(phaseId); //we commit before destroying contexts, cos the contexts have the PC in them } } }
private ResolverChain createDefaultResolverChain() { ResolverChain chain = (ResolverChain) Contexts.getSessionContext().get(DEFAULT_RESOLVER_CHAIN); if (chain == null) { chain = new ResolverChain(); for (String resolverName : Init.instance().getPermissionResolvers()) { chain.getResolvers().add((PermissionResolver) Component.getInstance(resolverName, true)); } Contexts.getSessionContext().set(DEFAULT_RESOLVER_CHAIN, chain); if (Events.exists()) Events.instance().raiseEvent(DEFAULT_RESOLVER_CHAIN_CREATED, chain); } return chain; }
private void postRestorePage(FacesContext facesContext, Map parameters, boolean conversationFound) { if ( !Pages.isDebugPage() ) { // Only redirect to no-conversation-view if a login redirect isn't required if (!conversationFound && !Pages.instance().isLoginRedirectRequired(facesContext)) { Pages.instance().redirectToNoConversationView(); } Manager.instance().handleConversationPropagation(parameters); if ( Init.instance().isJbpmInstalled() && !isExceptionHandlerRedirect() ) { Pageflow.instance().validatePageflow(facesContext); } Pages.instance().postRestore(facesContext); } }
@Override public void handleNavigation(FacesContext context, String fromAction, String outcome) { if ( !context.getResponseComplete() ) //workaround for a bug in MyFaces { if ( isOutcomeViewId(outcome) ) { FacesManager.instance().interpolateAndRedirect(outcome); } else if ( Init.instance().isJbpmInstalled() && Pageflow.instance().isInProcess() && Pageflow.instance().hasTransition(outcome) ) { Pageflow.instance().navigate(context, outcome); } else if ( !Pages.instance().navigate(context, fromAction, outcome) ) { baseNavigationHandler.handleNavigation(context, fromAction, outcome); } } }