/** * Returns the user in the current context. * * @return User in current context. */ public static IUser getActiveUser() { return getUserContext().getContextObject(false); }
/** * Compares by priority, with higher priorities collating first. */ @Override public int compareTo(IManagedContext<DomainClass> o) { int pri1 = o.getPriority(); int pri2 = getPriority(); return this == o ? 0 : pri1 < pri2 ? -1 : 1; }
@Override public void defer() { if (silent) { throw new ContextException("May not defer a response in silent mode"); } updateState(ResponseState.DEFERRED); }
/** * @see org.carewebframework.api.context.IManagedContext#getContextItems(boolean) */ @Override public ContextItems getContextItems(boolean pending) { contextItems.clear(); DomainClass domainObject = getContextObject(pending); return domainObject == null ? contextItems : toCCOWContext(domainObject); }
/** * Returns the marshaled context representing the state of all shared contexts. * * @return A ContextItems object representing the current state of all shared contexts. */ public ContextItems getMarshaledContext() { ContextItems marshaledContext = new ContextItems(); for (IManagedContext<?> managedContext : managedContexts) { marshaledContext.addItems(managedContext.getContextItems(false)); } return marshaledContext; }
/** * Enables or disables CCOW support. * * @param ccowEnabled True enables CCOW support if it is available. */ public void setCCOWEnabled(boolean ccowEnabled) { this.ccowEnabled = ccowEnabled; if (!ccowEnabled && ccowContextManager != null) { ccowContextManager.suspend(); ccowContextManager = null; } updateCCOWStatus(); }
@Override public void onUnload() { UserContext.getUserContext().removeListener(userChangeListener); }
private void initItem(Iterator<IManagedContext<?>> iter, SurveyResponse response, ISurveyCallback callback) { if (iter.hasNext()) { IManagedContext<?> managedContext = iter.next(); initItem(managedContext, aresponse -> { response.merge(aresponse); initItem(iter, response, callback); }); } else if (callback != null) { callback.response(response); } }
/** * @see org.carewebframework.api.context.IManagedContext#init() */ @Override public void init() { reset(); }
/** * Register an object as a subscriber if it implements the callback interface. * * @see org.carewebframework.api.IRegisterEvent#registerObject(Object) * @param object Object to register. */ @Override public void registerObject(Object object) { if (object instanceof IContextEvent) { addSubscriber((IContextEvent) object); } }
/** * Remove an object as a subscriber if it implements the callback interface. * * @see org.carewebframework.api.IRegisterEvent#unregisterObject(Object) * @param object Object to unregister. */ @Override public void unregisterObject(Object object) { if (object instanceof IContextEvent) { removeSubscriber((IContextEvent) object); } }
@Override public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException { if (bean instanceof ISerializer) { unregister((ISerializer<?>) bean); } }
/** * Callback to handle canceled context change request from the CCOW context manager. */ @Override public void ccowCanceled(CCOWContextManager sender) { commitContexts(false, false); }
/** * Performs a case-insensitive lookup of the item name + suffix in the index. * * @param itemName Item name * @param suffix Item suffix * @param autoAdd If true and item name not in index, add it. * @return Item name with suffix as stored internally */ private String lookupItemName(String itemName, String suffix, boolean autoAdd) { return lookupItemName(itemName + "." + suffix, autoAdd); }
private void execCallback(ISurveyCallback callback, ISurveyResponse response) { if (callback != null) { callback.response(response); } }
/** * Returns the user in the current context. * * @return User in current context. */ public static IUser getActiveUser() { return getUserContext().getContextObject(false); }
/** * @see org.carewebframework.api.context.IManagedContext#getContextItems(boolean) */ @Override public ContextItems getContextItems(boolean pending) { contextItems.clear(); DomainClass domainObject = getContextObject(pending); return domainObject == null ? contextItems : toCCOWContext(domainObject); }
/** * Returns the marshaled context representing the state of all shared contexts. * * @return A ContextItems object representing the current state of all shared contexts. */ public ContextItems getMarshaledContext() { ContextItems marshaledContext = new ContextItems(); for (IManagedContext managedContext : managedContexts) { marshaledContext.addItems(managedContext.getContextItems(false)); } return marshaledContext; }
/** * Compares by priority, with higher priorities collating first. */ @Override public int compareTo(IManagedContext o) { int pri1 = o.getPriority(); int pri2 = getPriority(); return this == o ? 0 : pri1 < pri2 ? -1 : 1; }
/** * Enables or disables CCOW support. * * @param ccowEnabled True enables CCOW support if it is available. */ public void setCCOWEnabled(boolean ccowEnabled) { this.ccowEnabled = ccowEnabled; if (!ccowEnabled && ccowContextManager != null) { ccowContextManager.suspend(); ccowContextManager = null; } updateCCOWStatus(); }