/** * Initializes one or all managed contexts to their default state. * * @param item Managed context to initialize or, if null, initializes all managed contexts. * @param callback Callback to report subscriber responses. */ public void init(IManagedContext<?> item, ISurveyCallback callback) { contextItems.clear(); if (ccowIsActive()) { contextItems.addItems(ccowContextManager.getCCOWContext()); } if (item != null) { initItem(item, callback); } else { SurveyResponse response = new SurveyResponse(); initItem(managedContexts.iterator(), response, callback); } }
/** * Joins the CCOW common context, if available. * * @return True if the operation was successful. */ public boolean ccowJoin() { if (ccowIsActive()) { return true; } if (ccowContextManager == null && ccowEnabled) { ccowContextManager = new CCOWContextManager(); ccowContextManager.subscribe(this); ccowContextManager.run("CareWebFramework#", "", true, "*"); } if (ccowContextManager != null) { if (!ccowContextManager.isActive()) { ccowContextManager.resume(); } if (!init()) { ccowContextManager.suspend(); } } updateCCOWStatus(); return ccowIsActive(); }
/** * Initializes one or all managed contexts to their default state. * * @param item Managed context to initialize or, if null, initializes all managed contexts. * @return True if the operation was successful. */ public boolean init(IManagedContext item) { contextItems.clear(); boolean result = true; if (ccowIsActive()) { contextItems.addItems(ccowContextManager.getCCOWContext()); } if (item != null) { result = initItem(item); } else { for (IManagedContext managedContext : managedContexts) { result &= initItem(managedContext); } } return result; }
/** * Joins the CCOW common context, if available. */ public void ccowJoin() { if (ccowIsActive()) { return; } if (ccowContextManager == null && ccowEnabled) { ccowContextManager = new CCOWContextManager(); ccowContextManager.subscribe(this); ccowContextManager.run("CareWebFramework#", "", true, "*"); } if (ccowContextManager != null) { if (!ccowContextManager.isActive()) { ccowContextManager.resume(); } init(response -> { if (response.rejected()) { ccowContextManager.suspend(); } updateCCOWStatus(); }); } }