public String getLockUserIdLocalized() { if (namedLock == null) // throw new OntopiaRuntimeException("Attempted to get name of null NamedLock."); return bundle.getString("unknown"); if (namedLock.getUser() == null) throw new OntopiaRuntimeException("No user found on NamedLock"); String lockName = namedLock.getUser().getId(); if (lockName.equals("defaultUser")) lockName = bundle.getString("unknown"); return lockName; }
@Override public String generate(ContextTag contextTag, TopicMapReferenceIF tmRefObj, String template) throws NavigatorRuntimeException { String link = template; // replace topicmap id placeholder with real value if (tmRefObj != null) { String topicmapId = tmRefObj.getId(); link = StringUtils.replace(link, LINK_TOPICMAP_KEY, topicmapId); } // replace model placeholder with real value UserIF user = FrameworkUtils.getUser(contextTag.getPageContext()); String model = user.getModel(); link = StringUtils.replace(link, LINK_MODEL_KEY, model); return link; }
public void addMessage(String message) { UserIF user = (UserIF) request.getSession().getAttribute(NavigatorApplicationIF.USER_KEY); user.addLogMessage(message); }
private static ActionDataSet getActionDataSet(PageContext pageContext, boolean create) { UserIF user = FrameworkUtils.getUser(pageContext); String requestId = TagUtils.getRequestId(pageContext); if (requestId == null) throw new OntopiaRuntimeException("No request id assigned. Binding action " + "outside <webed:form> tag?"); ActionDataSet ads = (ActionDataSet) user.getWorkingBundle(requestId); if (ads == null && create) { ads = new ActionDataSet(requestId); log.debug("Adding ActionDataSet to request id: " + requestId); user.addWorkingBundle(requestId, ads); } else if (ads == null && !create) throw new OntopiaRuntimeException("No action data set. Binding action " + "outside <webed:form> tag?"); return ads; }
/** * 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 List getTopicNameContext() throws NavigatorRuntimeException { UserIF user = FrameworkUtils.getUser(pageContext); UserFilterContextStore filterContext = user.getFilterContext(); if (filterContext == null) { return Collections.EMPTY_LIST; } else{ TopicMapIF topicmap = contextTag.getTopicMap(); if (topicmap == null) throw new NavigatorRuntimeException("SetTag found no topic map."); return new ArrayList(filterContext.getScopeTopicNames(topicmap)); } }
private Collection getFieldValidationRules() { ArrayList rules = new ArrayList(); UserIF user = FrameworkUtils.getUser(pageContext); String requestId = TagUtils.getRequestId(pageContext); if (requestId != null) { ActionDataSet ads = (ActionDataSet) user.getWorkingBundle(requestId); for (Iterator iter = ads.getAllActionData().iterator(); iter.hasNext();) { ActionData data = (ActionData) iter.next(); if (data.getMatchExpression() != null) { rules.add(new ValidationRule(data)); } } } return rules; }
if (user != null) user.removeWorkingBundle(requestId);
/** * Sets (according to attribute 'template') a path to the template * page. <br><p> * * Note: You can use a special placeholder <code>%view%</code> if * you want to insert the name of the current view of the user * session. This is a work-around, because JSP does not allow you * to use a custom tag inside another custom tag */ public void setTemplate(String templateString) { template = templateString; // special extension for the needs of the MVS support // replace view placeholder with current view value if (template.indexOf(VIEW_PLACEHOLDER) >= 0) { UserIF user = FrameworkUtils.getUser(pageContext); String view = user.getView(); template = StringUtils.replace(template, VIEW_PLACEHOLDER, view); } }
/** * Process the start tag for this instance. */ @Override public int doStartTag() throws JspTagException { // only do anything if valid user object exists UserIF user = FrameworkUtils.getUser(pageContext); HistoryMap history = user.getHistory(); if (history != null) { Object obj = pageContext.findAttribute(objectName); // log.debug("Found object " + obj ); if (obj != null) { if (opName.equals(OP_ADD)) history.add(obj); else history.removeEntry(obj); } else log.info("Could not find object by name '" + objectName + "'."); } else log.info("No history attached to user object"); // empty tag has not to eval anything return SKIP_BODY; }
int scopeType) { UserIF user = FrameworkUtils.getUser(pageContext); UserFilterContextStore filterContext = user.getFilterContext(); TopicMapIF tm = contextTag.getTopicMap();
public Collection getAllActions() { String request_id = params.get(Constants.RP_REQUEST_ID); if (request_id == null) throw new OntopiaRuntimeException("No request id parameter included in ProcessServlet request"); log.debug("Found request id: " + request_id); Object bundle = user.getWorkingBundle(request_id); if (bundle == null) throw new NoActionDataFoundException("No action data found for request " + request_id + ", request either corrupt or expired."); if (bundle instanceof ActionData) return Collections.singleton(bundle); else return ((ActionDataSet)bundle).getAllActionData(); }
user.removeWorkingBundle(params.get(Constants.RP_REQUEST_ID));
@Override public String generate(ContextTag contextTag, TMObjectIF tmObj, String topicmapId, String template) throws NavigatorRuntimeException { String link = template; // replace object id placeholder with real value if (tmObj != null) { String objectId = NavigatorUtils.getStableId(tmObj); link = StringUtils.replace(link, LINK_ID_KEY, objectId); } // replace topicmap id placeholder with real value if (topicmapId != null) link = StringUtils.replace(link, LINK_TOPICMAP_KEY, topicmapId); // replace model placeholder with real value UserIF user = FrameworkUtils.getUser(contextTag.getPageContext()); String model = user.getModel(); link = StringUtils.replace(link, LINK_MODEL_KEY, model); return link; }
/** * INTERNAL: Create new user object in given scope. */ public static UserIF createUserSession(PageContext pageContext, int scope) { NavigatorConfigurationIF navConf = NavigatorUtils.getNavigatorApplication(pageContext).getConfiguration(); // try to retrieve the user name from the request, otherwise null String username = null; if (pageContext.getRequest() instanceof HttpServletRequest) username = ((HttpServletRequest) pageContext.getRequest()).getRemoteUser(); // create new user object UserIF user = new User(username, navConf); // set MVS settings user = setDefaultMVS(navConf, user); // set user object to session scope pageContext.setAttribute(NavigatorApplicationIF.USER_KEY, user, scope); log.debug("New user object ('" + user.getId() + "') created and bound in scope ( " + scope + ")."); return user; }
public void perform(ActionParametersIF params, ActionResponseIF response) { String message = (String) params.get(0); params.getRequest().getUser().addLogMessage(message); }
TopicMapIF topicmap = context.getTopicMap(); UserIF user = FrameworkUtils.getUser(context.getPageContext()); UserFilterContextStore filterContext = user.getFilterContext(); if ((filterContext == null || (filterContext.getScopeTopicNames(topicmap).isEmpty() &&
String requestId = TagUtils.getRequestId(pageContext); if (requestId != null && name != null) { ActionDataSet ads = (ActionDataSet) user.getWorkingBundle(requestId); ActionData data = ads.getActionData(name); data.setMatchExpression(regex);
public String generate(ContextTag contextTag, TopicMapReferenceIF tmRefObj, String template) throws NavigatorRuntimeException { String link = template; // replace topicmap id placeholder with real value if (tmRefObj != null) { String topicmapId = tmRefObj.getId(); link = StringUtils.replace(link, LINK_TOPICMAP_KEY, topicmapId); } // replace model placeholder with real value UserIF user = FrameworkUtils.getUser(contextTag.getPageContext()); String model = user.getModel(); link = StringUtils.replace(link, LINK_MODEL_KEY, model); return link; }
(bnscope.containsAll(scope) && scope.containsAll(bnscope))) { params.getRequest().getUser().addLogMessage("The name '" + value + "' is already in use");