/** * INTERNAL: return collection to work with, throw * <code>NavigatorRuntimeException</code> if collection is null. */ protected Collection getInputCollection(ContextManagerIF ctxtMgr) throws NavigatorRuntimeException { if (variableName == null) return ctxtMgr.getDefaultValue(); else return ctxtMgr.getValue(variableName); }
protected Collection getValue(ContextManagerIF ctxtMgr, String var) throws NavigatorRuntimeException { if (var == null) return null; return ctxtMgr.getValue(var); }
/** * If all conditions are matched deliver true, otherwise false. */ protected boolean matchCondition() { return decider.ok(contextTag, collection); }
/** * INTERNAL: Resets MVS settings for given user object. */ private static UserIF setDefaultMVS(NavigatorConfigurationIF navConf, UserIF user) { // get defaults from config and set them if (navConf.getDefaultModel() != null && !navConf.getDefaultModel().equals("")) user.setModel( navConf.getDefaultModel() ); if (navConf.getDefaultView() != null && !navConf.getDefaultView().equals("")) user.setView( navConf.getDefaultView() ); if (navConf.getDefaultSkin() != null && !navConf.getDefaultSkin().equals("")) user.setSkin( navConf.getDefaultSkin() ); return user; }
private String getCharacterEncoding(NavigatorApplicationIF navApp) { // ensure that request character encoding decoded correctly (bug #622) String charEnc = navApp.getConfiguration().getProperty( "defaultCharacterEncoding"); if (charEnc != null && charEnc.trim().equals("")) charEnc = null; return charEnc; }
/** * 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); }
@Override public Object get(Object key) { Collection coll = ctxtMgr.getValue((String) key); if (coll.isEmpty()) throw new VariableNotSetException((String) key); return CollectionUtils.getFirstElement(coll); }
/** * 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); }
/** * INTERNAL: Gets the topic map repository used by the web application. * * @since 3.1 */ public final static TopicMapRepositoryIF getTopicMapRepository(ServletContext servletContext) { return getNavigatorApplication(servletContext).getTopicMapRepository(); }
/** * Actions after the body. */ @Override public int doEndTag() throws JspTagException { // establish old lexical scope, back to outside of the condition ctxtMgr.popScope(); // reset members ctxtMgr = null; return EVAL_PAGE; }
public void setAs(String as) throws NavigatorRuntimeException { if (!as.equals(KIND_SUBJECT) && !as.equals(KIND_INDICATOR) && !as.equals(KIND_SOURCE)) throw new NavigatorRuntimeException("Non-supported value ('" + as + "') given for attribute 'as' in element 'lookup'."); this.lookupAs = as; }
/** * Bind the variables of a result set to the current row. */ protected void bindVariables() throws JspTagException { for (int i = 0; i < columnNames.length; i++) { Object currentValue = queryResult.getValue(columnNames[i]); contextManager.setValue(columnNames[i], currentValue == null ? Collections.EMPTY_LIST : currentValue); } }
/** * INTERNAL: Retrieves the comparator class belonging to the * specified name. */ private Comparator getComparator() throws NavigatorRuntimeException { Object obj = contextTag.getNavigatorApplication() .getInstanceOf(listComparatorClassName); if (obj != null && obj instanceof Comparator) return (Comparator) obj; else return null; }
@Override public Collection getValue(String name) throws VariableNotSetException { // remove prefix (if there) name = cutoffPre(name); Object result = _getValue(name); if (result == null) throw new VariableNotSetException(name); else return (Collection)result; }
/** * 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); }
@Override public boolean containsKey(Object key) { return ctxtMgr.getValue((String)key) != null; } }
/** * Process the end tag. */ @Override public int doEndTag() throws JspException { // establish old lexical scope, back to outside of the loop ctxtMgr.popScope(); // reset members ctxtMgr = null; assocStore = null; // index = 0; return EVAL_PAGE; }
public void setContext(String var) throws NavigatorRuntimeException { context = var; if (!"basename".equals(context) && !"variant".equals(context) && !"occurrence".equals(context) && !"association".equals(context)) throw new NavigatorRuntimeException("Incorrect value ('" + var + "')" + " given for attribute 'context' in" + " element 'getcontext'."); }
@Override public Object get(Object key) { return contextManager.getValue((String) key, null); }
@Override public boolean containsKey(Object key) { return contextManager.getValue((String)key, null) != null; }