/** * @throws Exception Exception * @see zws.pen.policy.op.PENDataOpBase#execute() */ public void execute() throws Exception { { } // Logwriter.printOnConsole("CompareAttributeOP execute...."); String finalString = null; String metaDataAttrValue = null; try { finalString = new Boolean(false).toString(); Metadata metaData = getMetaData(); // printValues(metaData); { } // Logwriter.printOnConsole("Attribute name .... " + getAttributeName()); { } // Logwriter.printOnConsole("Attribute value .... " + getAttributeValue()); metaDataAttrValue = metaData.get(getAttributeName()); if (metaDataAttrValue != null) { if (metaDataAttrValue.startsWith(getAttributeValue())) { finalString = new Boolean(true).toString(); { } // Logwriter.printOnConsole("Attribute value matches.... "); } else { { } // Logwriter.printOnConsole("Attribute value not matched.... "); } } { } // Logwriter.printOnConsole("finalString in CompareAttributeOP.... " + finalString); setResult(finalString); } catch (Exception e) { e.printStackTrace(); throw e; } }
private String defineCriteria(Metadata data) { StringTokenizer tokens = new StringTokenizer(criteriaSpec, Names.VALUE_REF_START); StringBuffer c = new StringBuffer(); String fieldRef, token, value = null; int idx; if (tokens.hasMoreTokens()) c.append(tokens.nextToken()); while (tokens.hasMoreTokens() && null != value) { // parameterize rule for what to do if the value is null token = tokens.nextToken(); idx = token.indexOf(Names.VALUE_REF_END); fieldRef = (token.substring(0, idx)); value = data.get(fieldRef); if ("".equals(value)) value = null; c.append(value); c.append(token.substring(idx + 1)); } if (null == value) return null; return c.toString(); }