public static Transition instance() { if ( !Contexts.isApplicationContextActive() ) { throw new IllegalStateException("No active application context"); } return (Transition) Component.getInstance(Transition.class, ScopeType.CONVERSATION); }
public static Validators instance() { if (!Contexts.isApplicationContextActive()) { throw new IllegalStateException("No active application scope"); } return (Validators) Component.getInstance(Validators.class, ScopeType.APPLICATION); }
public static java.util.Locale instance() { if ( Contexts.isApplicationContextActive() ) { return (java.util.Locale) Component.getInstance(Locale.class, ScopeType.STATELESS); } else { return java.util.Locale.getDefault(); //for unit tests } } }
public static LocaleStartup instance() { if (!Contexts.isSessionContextActive()) { return null; } return (LocaleStartup) Component.getInstance(LocaleStartup.class, ScopeType.SESSION); }
public static RendererFacesContextFactory instance() { if (!Contexts.isApplicationContextActive()) { throw new IllegalStateException("Application context is not active"); } return (RendererFacesContextFactory) Component.getInstance(RendererFacesContextFactory.class, APPLICATION); }
public static Dispatcher instance() { if ( !Contexts.isApplicationContextActive() ) { throw new IllegalStateException("no application context active"); } return (Dispatcher) Component.getInstance("org.jboss.seam.async.dispatcher"); }
public static ConversationPropagation instance() { if ( !Contexts.isEventContextActive() ) { throw new IllegalStateException("No active event context"); } return (ConversationPropagation) Component.getInstance(ConversationPropagation.class, ScopeType.EVENT); }
public static Pageflow instance() { if ( !Contexts.isConversationContextActive() ) { throw new IllegalStateException("No active conversation context"); } return (Pageflow) Component.getInstance(Pageflow.class, ScopeType.CONVERSATION); }
public static Object getInstance(String name, boolean create, boolean allowAutocreation) { Object result = Contexts.lookupInStatefulContexts(name); result = getInstance(name, create, allowAutocreation, result, null); return result; }
public static SafeActions instance() { if ( !Contexts.isApplicationContextActive() ) { throw new IllegalStateException("No active application context"); } return (SafeActions) Component.getInstance(SafeActions.class, ScopeType.APPLICATION); }
public void init() { if (persistenceProvider == null) { persistenceProvider = (PersistenceProvider) Component.getInstance(PersistenceProvider.class, true); } if (entityManager == null) { entityManager = Expressions.instance().createValueExpression("#{entityManager}", EntityManager.class); } }
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); }
public DocumentModel getSelectedCollection() { if (selectedCollection == null && StringUtils.isNotBlank(selectedCollectionUid) && !isCreateNewCollection()) { try { final CoreSession session = (CoreSession) Component.getInstance("documentManager", true); selectedCollection = session.getDocument(new IdRef(selectedCollectionUid)); } catch (DocumentNotFoundException e) { log.error("Cannot fetch collection"); } } return selectedCollection; }
public static Interpolator instance() { if (Contexts.isApplicationContextActive()) { return (Interpolator) Component.getInstance(Interpolator.class, ScopeType.APPLICATION); } else { return new Interpolator(); // for unit testing } }
public static org.jbpm.graph.exe.ProcessInstance instance() { if ( !Contexts.isConversationContextActive() || !BusinessProcess.instance().hasCurrentProcess() ) return null; //so we don't start a txn return (org.jbpm.graph.exe.ProcessInstance) Component.getInstance(ProcessInstance.class, ScopeType.STATELESS); } }
public boolean canRemoveFromCollection() { final DocumentsListsManager documentsListsManager = getDocumentsListsManager(); final List<DocumentModel> doccumentListToBeRemoved = documentsListsManager.getWorkingList(COLLECTION_CURRENT_SELECTION); if (doccumentListToBeRemoved == null || doccumentListToBeRemoved.isEmpty()) { return false; } final NavigationContext navigationContext = (NavigationContext) Component.getInstance("navigationContext", true); final DocumentModel currentDocument = navigationContext.getCurrentDocument(); return canAddToCollection(currentDocument); }
public boolean isCurrentDocumentCollection() { final NavigationContext navigationContext = (NavigationContext) Component.getInstance("navigationContext", true); final DocumentModel currentDocument = navigationContext.getCurrentDocument(); if (currentDocument == null) { return false; } final CollectionManager collectionManager = Framework.getService(CollectionManager.class); return collectionManager.isCollection(currentDocument); }
public static FacesMessages instance() { Component component = Component.forName(StatusMessages.COMPONENT_NAME); if(component != null && !component.getScope().isContextActive()) { throw new IllegalStateException("No active "+component.getScope().name()+" context"); } //Attempting to get the instance anyway for backwards compatibility with some potential hack situations. return (FacesMessages) Component.getInstance(StatusMessages.COMPONENT_NAME); } }
public void removeCurrentSelectionFromCollection() { final DocumentsListsManager documentsListsManager = getDocumentsListsManager(); final List<DocumentModel> doccumentListToBeRemoved = documentsListsManager.getWorkingList(COLLECTION_CURRENT_SELECTION); final NavigationContext navigationContext = (NavigationContext) Component.getInstance("navigationContext", true); final DocumentModel collection = navigationContext.getCurrentDocument(); removeFromCollection(collection, doccumentListToBeRemoved); documentsListsManager.resetWorkingList(COLLECTION_CURRENT_SELECTION); }
public void in() { Object object = getScope()==null ? Component.getInstance( getName() ) : getScope().getContext().get( getName() ); getValue().setValue( object ); }