Package org.milyn.function

Examples of org.milyn.function.StringFunctionExecutor


                 // Field name local to the loop
                  String fieldName = fields[i].getName();
                  // Field length local to the loop
                  int fieldLength = fields[i].getLength();
 
                  StringFunctionExecutor stringFunctionExecutor = fields[i].getStringFunctionExecutor();
 
                  if(!fields[i].ignore()) {
                    if(indent) {
                          contentHandler.characters(INDENT_LF, 0, 1);
                          contentHandler.characters(INDENT_2, 0, 2);
                      }
 
                    // Check that there are enough characters in the string
                    boolean truncated = fieldLengthTotal + fieldLength > flRecord.length();
 
                    AttributesImpl recordAttrs = EMPTY_ATTRIBS;
 
                    //If truncated then set the truncated attribute
                    if(truncated) {
                      recordAttrs = new AttributesImpl();
                          recordAttrs.addAttribute(XMLConstants.NULL_NS_URI, truncatedAttributeName, truncatedAttributeName, "xs:boolean", Boolean.TRUE.toString());
                    }
 
                      contentHandler.startElement(XMLConstants.NULL_NS_URI, fieldName, StringUtils.EMPTY, recordAttrs);
 
                      // If not truncated then set the element data
                      if(!truncated) {
                        if(stringFunctionExecutor == null) {
                          contentHandler.characters(recordChars, fieldLengthTotal, fieldLength);
                        } else {
                          String value = flRecord.substring(fieldLengthTotal, fieldLengthTotal + fieldLength);
 
                          value = stringFunctionExecutor.execute(value);
 
                          contentHandler.characters(value.toCharArray(), 0, value.length());
                        }
                  }
 
View Full Code Here


            if(functionDefinition.length() != 0 && functionDefinition.charAt(0) == FUNCTION_SEPARATOR) {
                functionDefinition = functionDefinition.substring(1);
            }

            StringFunctionExecutor stringFunctionExecutor = null;
            if(functionDefinition.length() != 0) {
              stringFunctionExecutor = StringFunctionExecutor.getInstance(functionDefinition);
            }

            fields[i] = new Field(fieldName, fieldLength, stringFunctionExecutor);
View Full Code Here

        Field[] fields = new Field[this.csvFields.length];
      for(int i = 0; i < this.csvFields.length; i++) {
        // Extract informations about the field
            String fieldInfos = this.csvFields[i].trim();
            String fieldName = fieldInfos;
            StringFunctionExecutor stringFunctionExecutor = null;

            if(fieldInfos.indexOf('?') >= 0) {
                fieldName = fieldInfos.substring(0, fieldInfos.indexOf('?'));
                String functionDefinition = fieldInfos.substring(fieldInfos.indexOf('?')+1);
View Full Code Here

                  if (recordIt < csvRecord.length) {
                    String value = csvRecord[recordIt];
 
                      contentHandler.startElement(XMLConstants.NULL_NS_URI, fieldName, StringUtils.EMPTY, EMPTY_ATTRIBS);
 
                      StringFunctionExecutor stringFunctionExecutor = field.getStringFunctionExecutor();
                      if(stringFunctionExecutor != null) {
                        value = stringFunctionExecutor.execute(value);
                      }
 
                      contentHandler.characters(value.toCharArray(), 0, value.length());
                      contentHandler.endElement(XMLConstants.NULL_NS_URI, fieldName, StringUtils.EMPTY);
                  }
View Full Code Here

                                i = Integer.MAX_VALUE - 1;
                            }
                            continue;
                        }

                        StringFunctionExecutor stringFunction = fieldMetaData.getStringFunctionExecutor();
                        if (stringFunction != null) {
                            value = stringFunction.execute(value);
                        }

                        field = new Field(fieldMetaData.getName(), value);
                        field.setMetaData(fieldMetaData);
                    }
View Full Code Here

TOP

Related Classes of org.milyn.function.StringFunctionExecutor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.