public String fillParamWithEventAttrib(String paramData,Event event){
  if (!database.isOpen()) {
    throw new IllegalStateException(TAG + " is already closed.");
  }
  StringBuilder retVal=new StringBuilder();
  int cursor=0;
  while (cursor < paramData.length()) {
    int openBracketIdx=paramData.indexOf('<',cursor);
    int closeBracketIdx=paramData.indexOf('>',cursor);
    if (openBracketIdx == -1 || closeBracketIdx == -1 || openBracketIdx + 1 >= closeBracketIdx) {
      retVal.append(paramData.substring(cursor));
      break;
    }
    String attr=paramData.substring(openBracketIdx + 1,closeBracketIdx);
    String param=paramData.substring(openBracketIdx,closeBracketIdx + 1);
    String paramAttr;
    try {
      paramAttr=event.getAttribute(attr);
    }
 catch (    IllegalArgumentException e) {
      paramAttr=param;
    }
    retVal.append(paramData.substring(cursor,openBracketIdx));
    retVal.append(paramAttr);
    cursor=closeBracketIdx + 1;
  }
  Log.d("fillParamWithEventAttrib",paramData + " -> " + retVal.toString());
  return retVal.toString();
}

public String fillParamWithEventAttrib ( String paramData , Event event ) { if ( ! database . isOpen ( ) ) { throw new IllegalStateException ( TAG + " is already closed." ) ; } StringBuilder retVal = new StringBuilder ( ) ; int cursor = 0 ; while ( cursor < paramData . length ( ) ) { int openBracketIdx = paramData . indexOf ( '<' , cursor ) ; int closeBracketIdx = paramData . indexOf ( '>' , cursor ) ; if ( openBracketIdx == - 1 || closeBracketIdx == - 1 || openBracketIdx + 1 >= closeBracketIdx ) { retVal . append ( paramData . substring ( cursor ) ) ; break ; } String attr = paramData . substring ( openBracketIdx + 1 , closeBracketIdx ) ; String param = paramData . substring ( openBracketIdx , closeBracketIdx + 1 ) ; String paramAttr ; try { paramAttr = event . getAttribute ( attr ) ; } catch ( IllegalArgumentException e ) { paramAttr = param ; } retVal . append ( paramData . substring ( cursor , openBracketIdx ) ) ; retVal . append ( paramAttr ) ; cursor = closeBracketIdx + 1 ; } Log . d ( "fillParamWithEventAttrib" , paramData + " -> " + retVal . toString ( ) ) ; return retVal . toString ( ) ; }
this method checks the parameter data to see if it already has value or it should extract value from the event . the paramdata should contain valid tags like " < phone ring time > " in order to retrieve related information .
