private boolean knowsAbout (final String fieldName) { return (getPermissions(fieldName) != null); }
/** * Returns true if the filter allows reading the value of the field. */ public boolean allowRead (final String fieldName) { /* if (this.type == TYPE_OPEN && ! knowsAbout(fieldName)) return true; */ return hasPermission(fieldName, 'r'); }
public boolean allowRemove (final String fieldName) { if ( ! removeAllowed) return false; /* if (this.type == TYPE_OPEN && ! knowsAbout(fieldName)) { return true; } return hasPermission(fieldName, 'w'); */ return allowWrite(fieldName); }
protected static Filter extractFilter (final java.sql.ResultSet rs) throws java.sql.SQLException { final Filter f = new Filter(); int i = 2; f.setName(rs.getString(i++)); final char cType = rs.getString(i++).toLowerCase().charAt(0); if (cType == 'o') f.setType(Filter.TYPE_OPEN); else f.setType(Filter.TYPE_CLOSED); final char cAddAllowed = rs.getString(i++).toLowerCase().charAt(0); f.setAddAllowed(cAddAllowed == 't'); final char cRemoveAllowed = rs.getString(i++).toLowerCase().charAt(0); f.setRemoveAllowed(cRemoveAllowed == 't'); return f; }
/** * This method is public because it is used by * openwfe.org.wfibuilder.WorkflowDefinition.outputAsXml() */ public org.jdom.Element encode (final Filter f) { org.jdom.Element elt = null; if (f.getType() == Filter.TYPE_OPEN) elt = new org.jdom.Element(OPEN_FILTER, XMLNS); else elt = new org.jdom.Element(CLOSED_FILTER, XMLNS); WicUtils.setAttribute(elt, NAME, f.getName()); WicUtils.setAttribute(elt, ADD_ALLOWED, ""+f.isAddAllowed()); WicUtils.setAttribute(elt, REMOVE_ALLOWED, ""+f.isRemoveAllowed()); encodeEntryList(elt, f); return elt; }
public Object dispatch (final ApplicationContext context, final WorkItem wi) throws DispatchingException { //final Participant targetParticipant = getParticipantMap() // .get(this.target); final Participant targetParticipant = Definitions.getParticipantMap(context).get(this.target); if (log.isDebugEnabled()) log.debug("dispatch() ref to '"+targetParticipant.getRegex()+"'"); if (wi instanceof InFlowWorkItem) { ((InFlowWorkItem)wi) .setParticipantName(targetParticipant.getRegex()); } return targetParticipant.dispatch(context, wi); }
protected void encodeEntryList (org.jdom.Element result, Filter f) { if (f.getEntries() == null || f.getEntries().size() < 1) { //log.debug("encodePatternList() - list is empty"); return; } java.util.Iterator it = f.getEntries().iterator(); while (it.hasNext()) { FilterEntry entry = (FilterEntry)it.next(); if (entry.getPermissions().trim().equals("")) continue; // do not add 'hidden' fields org.jdom.Element elt = new org.jdom.Element(FIELD, XMLNS); elt.setAttribute(REGEX, entry.getFieldRegex()); elt.setAttribute(PERMISSIONS, entry.getPermissions()); //if (entry.getAttributeType() != null) // elt.setAttribute(TYPE, entry.getAttributeType()); result.addContent(elt); } }
public NoFilter () { this.setName(this.getClass().getName()); this.setType(Filter.TYPE_OPEN); this.setAddAllowed(true); this.setRemoveAllowed(true); this.setEntries(new java.util.ArrayList(0)); } }
protected static FilterEntry extractFilterEntry (final java.sql.ResultSet rs) throws java.sql.SQLException { final FilterEntry fe = new FilterEntry(); int i = 2; fe.setFieldRegex(rs.getString(i++)); fe.setPermissions(rs.getString(i++)); //fe.setAttributeType(rs.getString(i++)); // forget it for the moment, it will perhaps be // reactivated at a later time // (John) return fe; }
private String getPermissionString (final String fieldName) { java.util.Iterator it = this.entries.iterator(); while (it.hasNext()) { final FilterEntry entry = (FilterEntry)it.next(); if (entry.getFieldRegex() == null) continue; // can't remember why this happened... if (fieldName.matches(entry.getFieldRegex())) return entry.getPermissions().toLowerCase().trim(); } return null; }
public Participant getParticipant(String name) { ParticipantMap pm = Definitions.getParticipantMap(getContext()); if (pm == null) { log.error("get participant failed, the map retrieved was null for:" + name); return null; } return pm.get(name); }
public void init (final String regex, final java.util.Map params) { super.init(regex, params); this.dispatcherClassName = MapUtils .getAsString(params, P_DISPATCHER_CLASS); if (this.dispatcherClassName != null) { log.info ("init() '"+getRegex()+ "' uses dispatcher "+this.dispatcherClassName); } this.instantiateDispatcherEachTime = MapUtils.getAsBoolean (params, P_INSTANTIATE_DISPATCHER_EACH_TIME, false); log.info ("init() '"+getRegex()+ "' instantiateDispatcherEachTime ? "+ this.instantiateDispatcherEachTime); }
refreshMap(); if (p.getRegex() != null && participantName.matches(p.getRegex()))
/** * Does the job of regular (not 'else-ref' based dispatching). */ protected void dispatch (final Participant participant, final String participantName, final InFlowWorkItem wi) throws ApplyException, DispatchingException { // identify participant name wi.setParticipantName(participantName); // dispatch participant.dispatch(context(), wi); }
private String getPermissions (final String fieldName) { final String s = getPermissionString(fieldName); if (s != null) return s; if (this.type == TYPE_OPEN) return "rw"; return ""; }
public void init (//final ParticipantMap pMap, final String regex, final java.util.Map params) { //super.init(pMap, regex, params); super.init(regex, params); this.target = MapUtils.getMandatoryString(params, P_REF); }
public void init (//final ParticipantMap pMap, final String regex, final java.util.Map params) { //super.init(pMap, regex, params); super.init(regex, params); //this.smtpServer = MapUtils.getAsString // (params, P_SMTP_SERVER, "127.0.0.1"); //this.smtpPort = MapUtils.getAsInt // (params, P_SMTP_PORT, 25); this.recipientField = MapUtils.getAsString (params, P_RECIPIENT_FIELD, DEFAULT_RECIPIENT_FIELD); this.mailFrom = MapUtils.getAsString (params, P_MAIL_FROM); this.mailEncoding = MapUtils.getAsString (params, P_MAIL_ENCODING); this.templateFileName = MapUtils.getAsString (params, P_TEMPLATE); }
private boolean hasPermission (final String fieldName, final char permissionChar) { if (log.isDebugEnabled()) log.debug("hasPermission() fieldName >"+fieldName+"<"); return (getPermissions(fieldName).indexOf(permissionChar) > -1); }
/** * Returns true if the filter allows to write to the field. */ public boolean allowWrite (final String fieldName) { /* if (this.type == TYPE_OPEN && ! knowsAbout(fieldName)) return true; */ return hasPermission(fieldName, 'w'); }