protected void parseQueries() throws InvalidQueryException { // check that query has been parsed if (query == null) query = processor.parse(querystr, context.getDeclarationContext()); }
protected NavigatorDeciderIF getDeciderInstance(String classname) throws NavigatorRuntimeException { Object obj = null; try { // Create decider instance obj = contextTag.getNavigatorApplication().getInstanceOf(classname); // if instance of DeciderIF we need to wrap in NavigatorDeciderWrapper if (obj instanceof NavigatorDeciderIF) return (NavigatorDeciderIF) obj; else if (obj instanceof DeciderIF) return new DeciderIFWrapper((DeciderIF)obj); } catch (NavigatorRuntimeException e) { log.warn("Unable to retrieve instance of " + classname); } // We weren't able to create an instance so let's return null. return null; }
/** * EXPERIMENTAL: Get the topic map object the context tag is working * with. This method will give direct access to the same transaction * as the context tag is using. * * @since 3.4 */ public static TopicMapIF getTopicMap(ServletRequest request) { NavigatorPageIF ctxt = (NavigatorPageIF) request.getAttribute(NavigatorApplicationIF.CONTEXT_KEY); if (ctxt == null) throw new OntopiaRuntimeException("Could not find navigator context."); return ctxt.getTopicMap(); }
nameStringifier = (StringifierIF) context.getNavigatorApplication() .getInstanceOf(nameStringifierCN); else nameGrabber = (GrabberIF) context.getNavigatorApplication() .getInstanceOf(nameGrabberCN); TopicMapIF topicmap = context.getTopicMap(); UserIF user = FrameworkUtils.getUser(context.getPageContext()); UserFilterContextStore filterContext = user.getFilterContext(); if ((filterContext == null || basenameScope.addAll(context.getContextManager().getValue(basenameScopeVarName)); variantScope.addAll(context.getContextManager().getValue(variantScopeVarName)); NavigatorConfigurationIF navConf = context.getNavigatorApplication() .getConfiguration(); String str = null;
if (topicmap_id == null && contextTag != null) { NavigatorApplicationIF navApp = contextTag.getNavigatorApplication(); TopicMapIF tm = contextTag.getTopicMap(); if (tm != null) topicmap_id = navApp.getTopicMapRefId(tm);
ContextManagerIF ctxtMgr = contextTag.getContextManager(); contextTag.getNavigatorApplication().getConfiguration(); String dcn = navConf.getProperty(NavigatorConfigurationIF.DEF_DECIDER, NavigatorConfigurationIF.DEFVAL_DECIDER);
/** * PUBLIC: Sets the value of the named variable to a collection * consisting only of the single value given. */ public static void setSingleValue(String name, PageContext pageContext, Object value) { NavigatorPageIF ctxt = (NavigatorPageIF) pageContext.getAttribute(NavigatorApplicationIF.CONTEXT_KEY, PageContext.REQUEST_SCOPE); if (ctxt == null) throw new OntopiaRuntimeException("Could not find navigator context."); Collection coll = new ArrayList(1); coll.add(value); ctxt.getContextManager().setValue(name, coll); }
/** * INTERNAL: Constructor which tries to retrieve the PSI for the * related topic types from the navigator configuration */ public TypeDecider(NavigatorPageIF contextTag, String type) throws MalformedURLException { if (hierUtils == null) hierUtils = new TypeHierarchyUtils(); // get URIs of reference types NavigatorConfigurationIF navConf = contextTag.getNavigatorConfiguration(); // typingTopic String refTypingTopicURL = null; if (type.equals(OCC_METADATA)) refTypingTopicURL = navConf .getProperty(NavigatorConfigurationIF.OCCTYPE_METADATA, NavigatorConfigurationIF.DEFVAL_OCCTYPE_METADATA); if (type.equals(OCC_DESCRIPTION)) refTypingTopicURL = navConf .getProperty(NavigatorConfigurationIF.OCCTYPE_DESCRIPTION, NavigatorConfigurationIF.DEFVAL_OCCTYPE_DESCRIPTION); refTypingTopicLocator = new URILocator(refTypingTopicURL); }
/** * PUBLIC: Returns the first value in the collection bound to a * specific variable in the current scope. The value returned will * be null if the variable is unknown or if the collection is empty. * @since 2.2.1 */ public static Object getSingleValue(String name, ServletRequest request) { NavigatorPageIF ctxt = (NavigatorPageIF) request.getAttribute(NavigatorApplicationIF.CONTEXT_KEY); if (ctxt == null) throw new OntopiaRuntimeException("Could not find navigator context."); Collection coll = ctxt.getContextManager().getValue(name); return CollectionUtils.getFirst(coll); }
pageContext.getAttribute(NavigatorApplicationIF.CONTEXT_KEY, PageContext.REQUEST_SCOPE); ParseContextIF pctxt = (ParseContextIF) ctxt.getDeclarationContext();
/** * EXPERIMENTAL: Get the topic map object the context tag is working * with. This method will give direct access to the same transaction * as the context tag is using. * * @since 3.2.1 */ public static TopicMapIF getTopicMap(PageContext pageContext) { NavigatorPageIF ctxt = (NavigatorPageIF) pageContext.getAttribute(NavigatorApplicationIF.CONTEXT_KEY, PageContext.REQUEST_SCOPE); if (ctxt == null) throw new OntopiaRuntimeException("Could not find navigator context."); return ctxt.getTopicMap(); }
Collection collection2 = contextTag.getContextManager().getValue(equalsVariableName);
pageContext.getAttribute(NavigatorApplicationIF.CONTEXT_KEY, PageContext.REQUEST_SCOPE); ParseContextIF pctxt = (ParseContextIF) ctxt.getDeclarationContext();
/** * Process the end tag. */ @Override public int doEndTag() throws JspException { // establish old lexical scope, back to outside of the condition contextTag.getContextManager().popScope(); // pass received collections further upwards ValueAcceptingTagIF acceptingTag = (ValueAcceptingTagIF) findAncestorWithClass(this, ValueAcceptingTagIF.class); if (acceptingTag != null) for (int ix = 0; ix < inputs.size(); ix++) acceptingTag.accept((Collection) inputs.get(ix)); // Reset members contextTag = null; collection = null; decider = null; return EVAL_PAGE; }
query = processor.parse(querystr, context.getDeclarationContext());
/** * PUBLIC: Returns the value bound to a specific variable in the * current scope. The value returned will be defaultValue if the variable is * unknown. */ public static Collection getValue(String name, PageContext pageContext, Collection defaultValue) { NavigatorPageIF ctxt = (NavigatorPageIF) pageContext.getAttribute(NavigatorApplicationIF.CONTEXT_KEY, PageContext.REQUEST_SCOPE); if (ctxt == null) throw new OntopiaRuntimeException("Could not find navigator context."); return ctxt.getContextManager().getValue(name, defaultValue); }
protected TopicTreeNode buildTree() throws InvalidQueryException { TopicTreeNode root = new TopicTreeNode(null); QueryResultIF result = processor.execute(topquery, context .getDeclarationContext()); while (result.next()) { TopicIF topic = (TopicIF) result.getValue(0); TopicTreeNode group = new TopicTreeNode(topic); group.setParent(root); group.setAttribute("id", getId(topic)); if (openNodes.contains(topic)) { ancestors = new ArrayList(); process(group); if (group.getChildren().isEmpty()) group.setAttribute("action", null); else group.setAttribute("action", "close"); openNodes.add(topic); } else { // check if there are children QueryResultIF leaves = getChildren(topic); if (leaves.next()) group.setAttribute("action", "open"); else group.setAttribute("action", null); } } return root; }
/** * PUBLIC: Returns the value bound to a specific variable in the * current scope. The value returned will be null if the variable is * unknown. */ public static Collection getValue(String name, PageContext pageContext) { NavigatorPageIF ctxt = (NavigatorPageIF) pageContext.getAttribute(NavigatorApplicationIF.CONTEXT_KEY, PageContext.REQUEST_SCOPE); if (ctxt == null) throw new OntopiaRuntimeException("Could not find navigator context."); return ctxt.getContextManager().getValue(name); }
.getDeclarationContext()); while (result.next()) { TopicIF topic = (TopicIF) result.getValue(0);
/** * PUBLIC: Sets the value of the named variable to the collection * given. The value can be null, which effectively unsets the variable. */ public static void setValue(String name, PageContext pageContext, Collection value) { NavigatorPageIF ctxt = (NavigatorPageIF) pageContext.getAttribute(NavigatorApplicationIF.CONTEXT_KEY, PageContext.REQUEST_SCOPE); if (ctxt == null) throw new OntopiaRuntimeException("Could not find navigator context."); ctxt.getContextManager().setValue(name, value); }