Wildcard Matching in Java

Hello All,
I wish to match a wildcard ... how that can be achieved?
For eg:- str1 = Number of Ports;
How I can make this work -> str1.equals("Number *") ???
Please help me in fixing the above or a way out to achieve this.
I appreciate your kind help and assistance.
Thanks,
--Abhi

Hi,
Try with code....
        String str = "Number 13122108";  // Pass as a parameter to the UDF
        String patternStr ="Number [a-zA-Z0-9]*";
        Pattern pattern = Pattern.compile(patternStr);
        Matcher matcher = pattern.matcher(str);
        if(matcher.matches()) {           
            System.out.println(str);
            System.out.println("Yes true");
        else {
            System.out.println("False ");
If stil nt solved do post
Babu

Similar Messages

  • How to use AND,OR,NOT condition in Pattern Matching in java

    how to use AND,OR,NOT condition in Pattern Matching in java
    Please anyone give example..

    Stop asking these stupid vague questions and do some of your own research.
    Start here:
    http://www.regular-expressions.info/
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html

  • Translation Pattern Wildcard Match

    Our organization uses 5 digit internal extensions throughout. Our CEO would like the ability to dial any 5 digit extension in our organization but wants his caller id to be shown as his name and the extension of his secretary – basically masking his 5 digit extension. I believe the simplest way to achieve this is to create a Translation Pattern, but I’m having an issue trying to match the wildcards in a TP in CUCM7.1.5. At this stage I have set up a new Partition and CSS just for the CEO’s phone and placed a test phone in the new CSS. I then created a TP which is where I run into a problem.
    In the TP I have selected the proper partition and in the Calling Party Transformations section I have listed the Calling Party Transform Mask as the secretary extension (we’ll say 55555 for this example). When I use an exact Translation Pattern match (say 12345) the translation works as I would expect (when I dial 12345 from the test phone, the caller ID shows as 55555). However, when I use any wildcards in the Translation Pattern (i.e. XXXXX) the translation does not occur. Now when I dial 12345 the true caller ID number shows instead of the translated number.
    I’m basically looking for a catch all rule from the CEO’s phone that will translate to 55555. I’m guessing I’m overlooking something simple here – any assistance? Thanks in advance.

    I set up a calling party transformation pattern with the same results. The issue seems to be in matching the dialed pattern or Translation Pattern field. In my testing the pattern is matched only when it's exact and not when wildcards are used. See the first attached screen shot where the pattern is '12345'. When this is applied it works as would be expected and the caller ID on the receiving phone shows 55555. But, on the second attached screenshot using wildcards, when 12345 is dialed the caller ID shows as the number on the phone and not the translated value. For some reason the wildcards don't seem to match.
    I've tried various wildcard patterns such as XXXXX, 1234X, and [0-8]XXXX - none work. The last one is the one I'd really like to use. Other thoughts or suggestions?

  • Use of % for wildcard matching in cursor

    i can use the wildcard character('%') in a statement something like this :-
    where city like nvl(cit,'%') in which if the null value is encountered in the variable 'cit', then city could be anything.
    Now, my question is can i use this wildcard character('%') in a between condition like:
    where serial_no between nvl(from_serial,'%') and nvl(to_serial,'%')
    I guess we cannot use the wildcard character('%') in a between condition like we can in a 'like' statement. So, how do i use the wildcard character('%') in a between statement. Please help in resolving the problem.

    Jatin
    You are correct, wildcards only work with LIKE.
    How you write your where clause depends on what datatype is involved. Assuming serial_no is numeric:
    where serial_no between
    nvl(from_serial,serial_no-1) and
    nvl(to_serial,serial_no+1)
    OR you could do it more explicitly
    where (from_serial is null
    or serial_no >= from_serial)
    and (to_serial is null
    or serial_no <= to_serial)

  • Wildcard matching for a single uid/email address

    I need to create an account which will receive all mail who's "To:" field matches a string. Specifically, I wish to create a UID=mailproxy which will receive all mail addressed to *[email protected] 
    If it matters, mail addressed to this account will be ${UID}-mailproxy (where UID is a valid mail user on the system although not necessarily in the same domain i.e. [email protected]).
    I cannot seem to confirm that this is even possible although I may be missing the logic someplace in the docs.
    Thanks,
    Tim

    Check the documentation for "catchall" address.
    Or, see if you can do something useful with the Sieve filtering language.
    What you're asking for isn't something easy to do.

  • Verifying .java and .class files match

    I have a bit of a strange situation in a team-working environment where many developers copy code to a production server. None of this code is in a Version Control System and I have been given the task of getting it into one (I've chosen Subversion, but that isnt important)
    The problem is, its not as simple as doing a full commit of the production server because developers may have copied edited .class files onto the server, but not copied edited .java (therefore the .java file is not the same as the .class file)
    Because the server has hundreds (if not thousands) or java and class files, I cant just decompile each of the class files and manually see if they match the java files, so I'm asking, is there a tool that can verify a java file matches a class file of the same name in terms of version (or if not is there an easier way of doing it than the decompile method)?
    Thanks in advance

    Years ago I had to do something very much like this...and now I'm trying to recall how we did it (and for that matter whether it worked)...and I'm having trouble recalling. Ah, that's what happens when you read forums out of insomnia.
    Of course, you can do a baseline check by just checking the file timestamps. Also instead of decompiling the class files you can try re-compiling the source code, and then generating checksums on both class files to see if they're the same.
    You might be able to use BCEL (http://jakarta.apache.org/bcel/) to extract some useful information out of the class files. As I recall I tried this but the data wasn't useful for this kind of project, but maybe I'm misremembering. It's worth looking into.

  • Java.lang.Exception: Multiple Matches Found

    Hi,
    I have written scheduler task to connect people soft DataBase get the users list and disable user accounts in IDM . Below is the peace of code.
    =============================
    ResultSet results = stmt.executeQuery(selectQuery);
    tcReconciliationOperationsIntf reconUtil = (tcReconciliationOperationsIntf)getUtility("Thor.API.Operations.tcReconciliationOperationsIntf");
    HashMap[] userValues = null;
    userValues = createDeleteHashMap(results);
    if (userValues.length < 1)
    return;
    Set deletedAcc = reconUtil.provideDeletionDetectionData(this.resourceObject, userValues);
    ============================================================
    In the Set deletedAcc = reconUtil.provideDeletionDetectionData(this.resourceObject, userValues); i am getting the following exception . please help me
    Regarding this.
    [XELLERATE.APIS],Class/Method: tcReconciliationOperationsBean/provideDeletionDetectionData encounter some problems: Multiple Matches Found
    java.lang.Exception: Multiple Matches Found
    Edited by: user11084273 on Sep 26, 2012 12:36 AM

    I believe this API expects only to match no more than one user on each of the criteria set in the paoAccountDataList (userValues) in your case, i.e. each entry in the map must give a unique identifier of one resource. This map is not a map of attributes of one account, which together identify one resource, as any one ambiguous value in the map will give this error. It appears at least one entry in you userValues map is ambiguous and matches multiple resources. I guess this all depends on what your initial select query was.

  • [bug]Jdev 11g:NullPointerException at java.util.regex.Matcher.getTextLength

    Hi,
    Jdev 11.1.1.0.31.51.56
    If somebody of you get the following trace stack when running a jspx using ViewCriteriaRow.setOperator :
    There is bug 7534359 and metalink note 747353.1 available.
    java.lang.NullPointerException
    at java.util.regex.Matcher.getTextLength(Matcher.java:1140)
    at java.util.regex.Matcher.reset(Matcher.java:291)
    at java.util.regex.Matcher.<init>(Matcher.java:211)
    at java.util.regex.Pattern.matcher(Pattern.java:888)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._loadFilter
    CriteriaValues(FacesCtrlSearchBinding.java:3695)
    Truncated. see log file for complete stacktrace
    Workaround:
    If you use 
            vcr.setAttribute("Job",job);
    or
            vcr.setAttribute("Job","="+job);
    than add following line of code:
            vcr.setOperator("Job","=");   regards
    Peter

    Hi,
    useful to mention that this happens when setting the equal operator or LIKE operator
    vcr.setAttribute("Job","= '"+job+"'");
    or
    vcr.setOperator("Job","=");
    Frank

  • Pattern Matching for a wildcard Ip address

    I m working on a project. And in it i get problem for pattern matching.I have ipv4 ip address for ex " 127.3.0.1* ".I have to generate regular exp for pattern matching in Java.Can you guide me what can be its regular exp.
    thanks,
    preeti

    preetiGupta wrote:
    I m working on a project. And in it i get problem for pattern matching.I have ipv4 ip address for ex " 127.3.0.1* ".I have to generate regular exp for pattern matching in Java.Can you guide me what can be its regular exp.Alternatively, [try this|http://lmgtfy.com/?q=regex+for+ipv4+addresses].
    Winston

  • How would you write a "wildcard" in a filefilter?

    How would you go about to have a wildcard instead of the "*" in the following filefilter;
              File[] files = new File("./resultat/resultat_" + "*" + "_" + index[0]).listFiles (new FileFilter () {
                    public boolean accept (File file) {
                        return ! file.isDirectory ();
              });All help appriciated
    - Karl XII

    Shouldn't "a*" accept all files that begins with "a" and ends with whatever?No. "*" in regexp is a not a wildcard match. Instead it matches one or more instances of the preceeding
    value.
    Therefore "a*" will match "a", "aa", "aaa", "aaaa" etc but will not match anything which does not end in
    an "a".
    The following might help you out. (not the most elegent expression but it will do
    import java.util.regex.*;
    public class RegExp{
      public static void main(String[] args) {
      Pattern p = Pattern.compile("a*b");     
      Matcher m = p.matcher("aaaab");     
      System.out.println(m.matches());                    
      // interesting bit here
      // match one or more occurances of any characters in the ASCII charset  (the \\p{ASCII}* bit   
      p = Pattern.compile("hello_\\p{ASCII}*_b");     
      m = p.matcher("hello_wibble_b");     
      System.out.println(m.matches());
    }

  • Loading Java Procedure errors

    Hello all,
    I am attempting to load a java stored procedure I have written. It depends on some javax libs that are outside of the normal java library. I loaded these external lists into the database as sys and granted my user execute privelages to the classes I load. I then try to load my class into the database and I get errors saying it can find the classes that I just loaded as sys. Is there some way that I can tell it to look in the sys schema to find these external libs or is there another step that I am unaware of?

    Make sure the resolver can locate the class in the proper schema. Any
    of the following approaches will suffice.
    Best approach would be to create a public synonym on the loaded class.
    a.) Creating a public synonym on the loaded class (via loadjava -s) to be used by
    other users
    For example,
    SQL> loadjava -user <user>/<pwd> -g Public -s -r mail.jar
    NOTE: The public synonym could also be created via SQL.
    b.) Modify the resolver spec for the JSP class so the resolver will
    search the desired schemas for the problem classes. The resolver
    can be established at load time (via loadjava -R) or modified at
    the SQL command line (via ALTER JAVA CLASS).
    Given below is difference between the Resolver in the database used to resolve classes and the CLASSPATH used by normal java environment.
    Resolver Spec vs. CLASSPATH
    When compiling or running a traditional Java program, the CLASSPATH
    environment variable determines which directories are searched when
    resolving any external class references. If a class is referenced
    which cannot be located in one of these directories, a compile-time
    or runtime exception is thrown.
    On the server, a similar mechanism called a Resolver Spec is used.
    The primary difference between the Resolver Spec and the CLASSPATH
    environment variable is that a Resolver Spec specifies which users'
    schema's to search (rather than which directories).
    Another distinction between the Resolver Spec and the CLASSPATH is
    that a Resolver Spec can be assigned on a per-class basis. That is,
    each class can use a different Resolver Spec for resolving its own
    external class references. The same behavior would be unwieldy or
    impossible to emulate using the CLASSPATH environment variable.
    The general form of a Resolver Spec is as follows:
    ((match_string schema_name) (match_string schema_name) ...)
    where match_string is a Java fullname or wildcard matching one or
    more Java classes and schema_name is the user's schema in which the
    resolver should look for those classes. The schema's specified are
    searched in left to right order.
    The default Resolver Spec is as follows:
    ((* definer's_schema) (* public))
    which specifies that, for all classes, the resolver should first search
    the owner's schema and then all public classes (e.g. standard classes).
    NOTE: If you decide to specify your own Resolver Spec, it replaces
    the default. Omitting the (* public) can result in problems
    resolving classes that reside in the standard packages

  • Problem while trying to execute Java class in JSP using  RunTime Class

    Hi,
    I want to execute a JAVA class through a JSP. For this I am using following code ....
    JSP (AAA.jsp) CODE ............
    try
    String[] cmd = new String[3];
    cmd[0] = "cmd.exe" ;
    cmd[1] = "/C" ;
    cmd[2] = "java -DPeBS_CONFIG_HOME=D:/CASLIntegration/PeBS/srcvob/PeBS/config Service_Statement_Application 22/May/2001 22/May/2003";
    Runtime rt = Runtime.getRuntime();
    System.out.println("Execing " + cmd[0] + " " + cmd[1] + " " + cmd[2]);
    Process proc = rt.exec(cmd);
    // any error message?
    StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");
    // any output?
    StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");
    // kick them off
    errorGobbler.start();
    outputGobbler.start();
    // any error???
    int exitVal = proc.waitFor();
    System.out.println("ExitValue: " + exitVal);
    catch (Throwable t)
    t.printStackTrace();
    StreamGobbler THread class Code ..........
    import java.util.*;
    import java.io.*;
    public class StreamGobbler extends Thread
    InputStream is;
    String type;
    StreamGobbler(InputStream is, String type)
    this.is = is;
    this.type = type;
    public void run()
    try
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line=null;
    while ( (line = br.readLine()) != null)
    System.out.println(type + ">" + line);
    } catch (IOException ioe)
    ioe.printStackTrace();
    I have successfully compiled and placed the class file for the above class in JSP's servlet engine. However, when I execute the JSP through explorer Web Browser, I get following compile time error:
    An error occurred between lines: 36 and 86 in the jsp file: /casl/LocalApp/VehicleServiceStmt/AAA.jsp
    Generated servlet error:
    D:\Tomcat\work\localhost\_\casl\LocalApp\VehicleServiceStmt\AAA$jsp.java:118: No constructor matching StreamGobbler(java.io.InputStream, java.lang.String) found in class StreamGobbler.
    StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");
    ^
    An error occurred between lines: 36 and 86 in the jsp file: /casl/LocalApp/VehicleServiceStmt/AAA.jsp
    Generated servlet error:
    D:\Tomcat\work\localhost\_\casl\LocalApp\VehicleServiceStmt\AAA$jsp.java:121: No constructor matching StreamGobbler(java.io.InputStream, java.lang.String) found in class StreamGobbler.
    StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");
    I am unable to determine the reason of why the constructor which exists in the StreamGobbler Class is not recevied in JSP. If I try to write the same code in JSP as a JAVA class, keeping StreamGobler class same, the programme executes successfully.
    Please help me find solution to this at the earliest. Thanks in advance,
    Prachi

    Thanks,
    I got it working by making the constructor Public.
    -Prachi

  • Webutil - client_get_file_name - java-exception

    Hello
    i'm using Forms 9.0.4 with webutil 1.0.5.
    when i open a file-dialog with
    client_get_file_name ( 'c:\temp', null, '(JPEG-Files)|*.jpg|(All Files)|*.*', 'my headline', open_file, true );The java-Console have the following output:
    java.lang.StringIndexOutOfBoundsException: String index out of range: 40
    at org.apache.regexp.StringCharacterIterator.charAt(StringCharacterIterator.java:90)
    at org.apache.regexp.RE.matchNodes(RE.java:1161)
    at org.apache.regexp.RE.matchNodes(RE.java:1376) 20 times or more
    at org.apache.regexp.RE.matchAt(RE.java:1448)
    at org.apache.regexp.RE.match(RE.java:1498)
    at org.apache.regexp.RE.match(RE.java:1468)
    at org.apache.regexp.RE.match(RE.java:1561)
    at oracle.forms.webutil.file.WebUtilFileFilter.accept(WebUtilFileFilter.java:131)
    at javax.swing.JFileChooser.accept(Unknown Source)
    at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run(Unknown Source)any ideas?
    thanks in advance!

    thanks Andreas!
    first i thought your right, but still i get this exception, even with the trailing |.
    it does not happen if the opened directory is empty or there are just a few files.
    and: i find out, that it does not happen, when i put (All Files)|*.*| in front, so the file-filter is not activ.
    like this:
    client_get_file_name ( 'c:\temp', null, '(All Files)|*.*|(JPEG-Files)|*.jpg|', 'my headline', open_file, true );if i activate the file-filter manually with opened dialog box the exception is not shown.

  • IKM file to file (java) error

    Hi Team,
    I am using IKM file to file (java) to laod the data and am getting the following error at compile step. Please help me out here.
    com.sunopsis.tools.core.exception.SnpsSimpleMessageException: ODI-17517: Error during task interpretation.
    Task: 2
    java.lang.Exception: BeanShell script error: Sourced file: inline evaluation of: ``out.print("OdiOutFile \"-FILE=") ; out.print(snpRef.getSchemaName("CT_Sample", " . . . '' : Unary operation "+" inappropriate for object : at Line: 178 : in file: inline evaluation of: `` /* This function is used to replace at code generation time the column names in . . . '' : + ");" ) ;
    BSF info: Create transformer at line: 0 column: columnNo
    at com.sunopsis.dwg.codeinterpretor.SnpCodeInterpretor.transform(SnpCodeInterpretor.java:485)
    at com.sunopsis.dwg.dbobj.SnpSessStep.createTaskLogs(SnpSessStep.java:711)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:461)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
    at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: org.apache.bsf.BSFException: BeanShell script error: Sourced file: inline evaluation of: ``out.print("OdiOutFile \"-FILE=") ; out.print(snpRef.getSchemaName("CT_Sample", " . . . '' : Unary operation "+" inappropriate for object : at Line: 178 : in file: inline evaluation of: `` /* This function is used to replace at code generation time the column names in . . . '' : + ");" ) ;
    BSF info: Create transformer at line: 0 column: columnNo
    at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
    at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
    at com.sunopsis.dwg.codeinterpretor.SnpCodeInterpretor.transform(SnpCodeInterpretor.java:471)
    ... 11 more
    Text: OdiOutFile "-FILE=<?=snpRef.getSchemaName("CT_Sample", "W") ?>/<?= getOdiClassName() ?>.java"
    import java.io.BufferedWriter;
    import java.io.BufferedReader;
    import java.io.Reader;
    import java.io.FileReader;
    import java.io.FileInputStream;
    import java.io.InputStreamReader;
    import java.io.FileOutputStream;
    import java.io.OutputStreamWriter;
    import java.io.FileWriter;
    import java.io.File;
    import java.io.IOException;
    import java.io.FilenameFilter;
    import java.util.Scanner;
    import java.util.HashMap;
    import java.util.regex.Pattern;
    import java.util.regex.Matcher;
    import java.lang.String;
    import java.lang.StringBuilder;
    import java.lang.RuntimeException;
    import java.text.ParseException;
    import java.text.ParsePosition;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import java.text.DecimalFormat;
    import java.text.DecimalFormatSymbols;
    import java.math.BigDecimal;
    public class <?= getOdiClassName() ?> {
    /* Number of threads that are to be run in parallel */
    static int NB_THREADS = 1;
      BufferedWriter pBufferedWriter;
    BufferedWriter pBufferedLogWriter;
    BufferedWriter pBufferedBadWriter;
    int nbError;
    int nbErrorInPrevFiles;
    int nbLine;
    int nbTotalLine;
    int nbWarning;
    int nbFiles;
    int nbFilter;
    int nbFilterInPrevFiles;
    int nbHeader;
    int nbInserted;
    boolean doWeContinueBatch = true;
    boolean maxErrorReach = false;
    //boolean warning = false;
    //String warning_txt ="";
    Date debut = new Date();
    Date end =  new Date();
    static int maxError=0;
      * @param pBufferedWriter
      * @param pBufferedLogWriter
      * @param pBufferedBadWriter
      * @param nbError
      * @param nbLine
      * @throws IOException
    public <?= getOdiClassName() ?>(String targF,String logF,String badF) throws IOException {
      super();
      this.pBufferedWriter = new BufferedWriter(new FileWriter(targF, false));
      this.pBufferedLogWriter = new BufferedWriter(new FileWriter(logF, false ));
      this.pBufferedBadWriter = new BufferedWriter(new FileWriter(badF, false )); 
      pBufferedLogWriter.append("Oracle Data Integrator * File to File:\nCopyright (c) Oracle Corporation.  All rights reserved.");
      pBufferedLogWriter.append("\n\nNumber of threads: "+NB_THREADS);
      pBufferedLogWriter.append("\n\nDiscardmax: 1");
      pBufferedLogWriter.append("\n\nOutputFile:\t\t"+targF+"\nBAD file:\t\t"+badF+"\n");
      this.nbError = 0;
      this.nbErrorInPrevFiles = 0;
      this.nbLine = 0;
      this.nbTotalLine=0;
      this.nbWarning=0;
      this.nbFiles=0;
      this.nbHeader=0;
      this.nbFilter=0;
      this.nbFilterInPrevFiles = 0;
      this.nbInserted=0;
    /* A simple object used to synchronize the reads of the source file and avoid overlap between the various threads */
    static Object lock = new Object();
    HashMap<Object, BigDecimal> sequenceMap = new HashMap<Object, BigDecimal>();
    HashMap<Object, BigDecimal> counterMap = new HashMap<Object, BigDecimal>();;
    public boolean getDoWeContinueBatch()
      return doWeContinueBatch;
    public void addInserted()
      synchronized(lock) {
       nbInserted+=1;
    public void addWarning()
      synchronized(lock) {
       nbWarning+=1;
    public void addFilter()
      synchronized(lock) {
       nbFilter+=1;
    public BigDecimal getCounter(Object pFieldValue, long pStartValue) {
      if (counterMap.containsKey(pFieldValue)) {
       return counterMap.get(pFieldValue);
      } else {
       counterMap.put(pFieldValue, new BigDecimal(pStartValue));
       return counterMap.get(pFieldValue);
    public BigDecimal incrementCounter(Object pFieldValue, long pStartValue) {
      if (counterMap.containsKey(pFieldValue)) {
       counterMap.put(pFieldValue, counterMap.get(pFieldValue).add(BigDecimal.ONE));
       return counterMap.get(pFieldValue);
      } else {
       counterMap.put(pFieldValue, new BigDecimal(pStartValue));
       return counterMap.get(pFieldValue);
    public BigDecimal smartSequence(Object pField, Object pValue, long pStartValue) {
      if (pField.equals(pValue)) {
       return incrementCounter(pValue, pStartValue);
      } else {
       return getCounter(pValue, pStartValue);
    public BigDecimal smartSequence(Object pField, Object pValue) {
      return smartSequence(pField, pValue, 0);
    public BigDecimal normalSequence(Object pSequenceName, long pStartValue) {
      if (sequenceMap.containsKey(pSequenceName)) {
       synchronized(sequenceMap.get(pSequenceName)) {
        sequenceMap.put(pSequenceName, sequenceMap.get(pSequenceName).add(BigDecimal.ONE));
        return sequenceMap.get(pSequenceName);
      } else {
       synchronized (sequenceMap) {
        sequenceMap.put(pSequenceName, new BigDecimal(pStartValue));
        return sequenceMap.get(pSequenceName);
    public BigDecimal normalSequence(Object pSequenceName) {
      return normalSequence(pSequenceName, 0);
    /* Utility class used for String processing */
    class OdiStringUtils {
      /* This method is used to write Input String into the StringBuilder that contains the target row and pad with spaces if necessary */
      public void pad(StringBuilder pStringBuilder, String pString, int pLength) {
       pStringBuilder.append(pString);
       for (int i=0;i<pLength-pString.length();i++) {
        pStringBuilder.append(' ');
    /* This class is the formatter for Strings that are to be written to the target file */
    class OdiStringFormatOUT{
      OdiStringUtils myStringUtils;
      String colName;
      String colMandatory;
      String colFormat;
      String colDecSep;
      String colNullIfErr;
      int    colBytes;
      String xString;
      private void check(Warning Odiwarn) throws Exception
       if (xString.length() > colBytes)
        {if (colNullIfErr=="0"){
         throw new Exception ("Column "+ colName+" : "+xString+" Value too long\n");
         if (colNullIfErr=="1")
          Odiwarn.AddWarn("Column "+ colName+" : "+xString+" Value too long\n");
         xString="";
         return;  
        if (xString.length() ==0)
        {if (colNullIfErr=="0"){
         throw new Exception ("Column "+ colName+" : is mandatory\n");
         if (colNullIfErr=="1")
          Odiwarn.AddWarn("Column "+ colName+" : is mandatory\n");
      public OdiStringFormatOUT(String pColName,String pColMandatory, String pColFormat,String pColDecSep, String pColNullIfErr,int pColBytes, OdiStringUtils pStringUtils) {
       myStringUtils = pStringUtils;
       colName = pColName;
       colMandatory = pColMandatory;
       colFormat = pColFormat;
       colDecSep = pColDecSep;
       colNullIfErr = pColNullIfErr;
       colBytes = pColBytes;
      public void format(String pString, StringBuilder pStringBuilder,Warning Odiwarn) throws Exception {
       xString=pString;
       this.check(Odiwarn);
       pStringBuilder.append(xString);
    /* This class is the formatter for Strings that are to be read from the source file */
    class OdiStringFormatIN{
      OdiStringUtils myStringUtils;
      String odiColname;
      String colNullIfErr;
      public OdiStringFormatIN(OdiStringUtils pStringUtils, String pColname, String pColNullIfErr) {
       myStringUtils = pStringUtils;
       odiColname=pColname;
       colNullIfErr=pColNullIfErr;
      public String parse(String pString,Warning Odiwarn) {
       return pString;
    /* This class is the formatter for Numbers that are to be written to the target file.
    Note that some more format() functions should be added to fully support all the possible datatypes (int, etc.) */
    class OdiNumberFormatOUT{
      OdiStringUtils myStringUtils;
      DecimalFormat internalParser;
      String colName;
      String colMandatory;
      String colFormat;
      String colDecSep;
      String colNullIfErr;
      int    colBytes;
      private void check(Number pNumber,Warning Odiwarn) throws Exception
       if (pNumber == null && colMandatory=="1" )
        {if (colNullIfErr=="0"){
         throw new Exception ("Column "+ colName+" is  mandatory\n");
         if (colNullIfErr=="1")
          Odiwarn.AddWarn("Column "+ colName+" is  mandatory\n");
       private void check(double pDouble,Warning Odiwarn) throws Exception
       if (false)
        {if (colNullIfErr=="0"){
         throw new Exception ("Column "+ colName+" : "+pDouble+" Value too long\n");
         if (colNullIfErr=="1")
          Odiwarn.AddWarn("Column "+ colName+" : "+pDouble+" Value too long\n");
       private void check(long pLong,Warning Odiwarn) throws Exception
       if (false)
        {if (colNullIfErr=="0"){
         throw new Exception ("Column "+ colName+" : "+pLong+" Value too long\n");
         if (colNullIfErr=="1")
          Odiwarn.AddWarn("Column "+ colName+" : "+pLong+" Value too long\n");
      public OdiNumberFormatOUT(String pColName,String pColMandatory, String pColFormat,String pColDecSep, String pColNullIfErr,int pColBytes, OdiStringUtils pStringUtils) {
       myStringUtils = pStringUtils;
       colName = pColName;
       colMandatory = pColMandatory;
       colFormat = pColFormat;
       colDecSep = pColDecSep;
       colNullIfErr = pColNullIfErr;
       colBytes = pColBytes;
       if (colDecSep == null) {
        colDecSep = ".";
       if (colDecSep.length() != 1) {
        colDecSep = ".";
       DecimalFormatSymbols mySymbols = new DecimalFormatSymbols();
       mySymbols.setDecimalSeparator(colDecSep.charAt(0));
       internalParser = new DecimalFormat("#.#", mySymbols);
       internalParser.setParseBigDecimal(true);
      public void format(Number pNumber, StringBuilder pStringBuilder,Warning Odiwarn) throws Exception {
       this.check(pNumber,Odiwarn);
       if (pNumber == null) {
        return;
       pStringBuilder.append(internalParser.format(pNumber));
      public void format(double pDouble, StringBuilder pStringBuilder,Warning Odiwarn) throws Exception {
       this.check(pDouble,Odiwarn);
       pStringBuilder.append(internalParser.format(pDouble));
      public void format(long pLong, StringBuilder pStringBuilder,Warning Odiwarn) throws Exception {
       this.check(pLong,Odiwarn);
       pStringBuilder.append(internalParser.format(pLong));
    /* This class is the formatter for Numbers that are to be read from the source file. */
    class OdiNumberFormatIN{
      OdiStringUtils myStringUtils;
      DecimalFormat internalParser;
      ParsePosition internalParsePosition;
      String odiColname;
      String colNullIfErr;
      public OdiNumberFormatIN(String pDecimalSeparator, OdiStringUtils pStringUtils, String pColname, String pColNullIfErr) {
       myStringUtils = pStringUtils;
       odiColname=pColname;
       colNullIfErr=pColNullIfErr;
       if (pDecimalSeparator == null) {
        pDecimalSeparator = ".";
       if (pDecimalSeparator.length() != 1) {
        pDecimalSeparator = ".";
       DecimalFormatSymbols mySymbols = new DecimalFormatSymbols();
       mySymbols.setDecimalSeparator(pDecimalSeparator.charAt(0));
       internalParser = new DecimalFormat("#.#", mySymbols);
       internalParser.setParseBigDecimal(true);
       internalParsePosition = new ParsePosition(0);
      /* This function returns null in case an Exception occurs during the parsing of the String as a Number */
      public Number parse(String pString, Warning Odiwarn) throws Exception {
       internalParsePosition.setIndex(0);
       Number x= internalParser.parse(pString.trim(), internalParsePosition);
       if ((pString.trim().length()>internalParsePosition.getIndex()))
       { x=null;
        if (colNullIfErr=="0"){
        throw new Exception (odiColname+" "+pString.trim()+" Invalid number\n");
        if (colNullIfErr=="1")
         Odiwarn.AddWarn(odiColname+": "+pString.trim()+" Invalid number");
       return x;
    /* This class is the formatter for Dates that are to be read from the source file */
    class OdiDateFormatIN{
      OdiStringUtils myStringUtils;
      SimpleDateFormat internalParser;
      ParsePosition internalParsePosition;
      String odiColname;
      String colNullIfErr;
      String localPattern="";
      public OdiDateFormatIN(String pPattern, OdiStringUtils pStringUtils, String pColname, String pColNullIfErr) {
       myStringUtils = pStringUtils;
       odiColname = pColname;
       colNullIfErr=pColNullIfErr;
       if (pPattern == null) {
        localPattern = "dd/MM/yyyy";
       } else localPattern=pPattern;
       //internalParser = new SimpleDateFormat(pPattern);
       //internalParsePosition = new ParsePosition(0);
      /* This method returns null if an error occurs when parsing the String as a date */
      public Date parse(String pString, Warning Odiwarn) throws Exception {
       internalParser = new SimpleDateFormat(localPattern);
       internalParsePosition = new ParsePosition(0);
       internalParsePosition.setIndex(0);
       internalParser.setLenient(false);
       Date x= internalParser.parse(pString.trim(),internalParsePosition);
       //trace("this is bad file");
       if (internalParsePosition.getErrorIndex() > -1 && pString.length()>0 )
       { x=null;
        if (colNullIfErr=="1") {
         Odiwarn.AddWarn(odiColname+": "+pString.trim()+" Invalid date");
        if (colNullIfErr=="0") {
        throw new Exception (odiColname+" "+pString.trim()+" Invalid date\n");
       return x;
    /* This class is the formatter for Dates that are to be written to the target file */
    class OdiDateFormatOUT{
      OdiStringUtils myStringUtils;
      SimpleDateFormat internalParser;
      String colName;
      String colMandatory;
      String colFormat;
      String colDecSep;
      String colNullIfErr;
      int    colBytes;
      Date xDate;
       private void check(Warning Odiwarn) throws Exception
       if (false)
        {if (colNullIfErr=="0"){
         throw new Exception ("Column "+ colName+" : "+xDate+" Value too long\n");
         if (colNullIfErr=="1")
          Odiwarn.AddWarn("Column "+ colName+" : "+xDate+" Value too long\n");
      public OdiDateFormatOUT(String pColName,String pColMandatory, String pColFormat,String pColDecSep, String pColNullIfErr,OdiStringUtils pStringUtils)
       myStringUtils = pStringUtils;
       colName = pColName;
       colMandatory = pColMandatory;
       colFormat = pColFormat;
       colDecSep = pColDecSep;
       colNullIfErr = pColNullIfErr;
       colBytes = 0;
       if (colFormat == null) {
        colFormat = "dd/MM/yyyy";
       internalParser = new SimpleDateFormat(colFormat);
      public void format(Date pDate, StringBuilder pStringBuilder,Warning Odiwarn) throws Exception {
       xDate=pDate;
       this.check(Odiwarn);
       if (xDate != null) {
        pStringBuilder.append(internalParser.format(xDate));
    class Warning
    boolean warning;
    String warntext;
    int currentLine;
    int nbWarn;
    public Warning ()
      warning=false;
      warntext="";
    public void New (int i)
      warning=false;
      warntext="";
      currentLine=i;
      nbWarn=0;
    public void AddWarn (String txt)
        if (warning) {
        warntext=warntext+"\n"+txt;
         } else {
        warntext=warntext+"\n"+txt;
      warning=true;
      nbWarn+=1;
    /* This class contains the code of the Thread that reads a line from the source file, processes a line and writes the output to the Target */
    class OdiFileTransformer extends Thread {
      OdiStringUtils myStringUtils= new OdiStringUtils();
      Scanner myScanner;
      Warning Odiwarn=new Warning();
      <?
        createInputFormaters();
        createOutputFormaters();
      ?>
      String tmpString;
       String[] srcCols;
      <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C1;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C2;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C3;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C4;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C5;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C6;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C7;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C8;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C9;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C10;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C11;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C12;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C13;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C14;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C15;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C16;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C17;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C18;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C19;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C20;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C21;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C22;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C23;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C24;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C25;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C26;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C27;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C28;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C29;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C30;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C31;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C32;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C33;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C34;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C35;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C36;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C37;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C38;
       <? if ("DATE".equals("STRING")) {?>Date<? } else if ("NUMERIC".equals("STRING")) {?>Number<? } else { ?>String<? } ?> srcColsCTCL_C39;
      String srcRecordSeparator;
      String trgRecordSeparator;
      String trgLineSeparator;
      StringBuilder myStringBuilder;
      public OdiFileTransformer(Scanner pScanner){
       super();
       myScanner = pScanner;
       tmpString = null;
       this.setName("OdiFileTransformer");
        srcCols = new String[1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1];
       srcRecordSeparator = Pattern.quote(",");
       trgRecordSeparator = ",";
       trgLineSeparator = "\n";
       myStringBuilder = new StringBuilder();
      public void run() {
      boolean bad = false;
      try {
       while (doWeContinueBatch){
        /* The calls to the Scanner need to be synchronized manually as it is not threadsafe */
        synchronized(lock) {
         if (myScanner.hasNext()) {
          tmpString=myScanner.next();
          nbLine+=1;
         } else {
          return;
        bad = false;
        Odiwarn.New(nbLine);
        try {
        srcCols = tmpString.split(srcRecordSeparator);
        /* The Filters are generated as if Statements that go to the next row to process if any condition is false */
        /* We start the processing of the line by clearing the StringBuilder */
        myStringBuilder.setLength(0);
        <? createInputFormaters("CTCL.C1"); ?><? createInputFormaters("CTCL.C2"); ?><? createInputFormaters("CTCL.C3"); ?><? createInputFormaters("CTCL.C4"); ?><? createInputFormaters("CTCL.C5"); ?><? createInputFormaters("CTCL.C6"); ?><? createInputFormaters("CTCL.C7"); ?><? createInputFormaters("CTCL.C8"); ?><? createInputFormaters("CTCL.C9"); ?><? createInputFormaters("CTCL.C10"); ?><? createInputFormaters("CTCL.C11"); ?><? createInputFormaters("CTCL.C12"); ?><? createInputFormaters("CTCL.C13"); ?><? createInputFormaters("CTCL.C14"); ?><? createInputFormaters("CTCL.C15"); ?><? createInputFormaters("CTCL.C16"); ?><? createInputFormaters("CTCL.C17"); ?><? createInputFormaters("CTCL.C18"); ?><? createInputFormaters("CTCL.C19"); ?><? createInputFormaters("CTCL.C20"); ?><? createInputFormaters("CTCL.C21"); ?><? createInputFormaters("CTCL.C22"); ?><? createInputFormaters("CTCL.C23"); ?><? createInputFormaters("CTCL.C24"); ?><? createInputFormaters("CTCL.C25"); ?><? createInputFormaters("CTCL.C26"); ?><? createInputFormaters("CTCL.C27"); ?><? createInputFormaters("CTCL.C28"); ?><? createInputFormaters("CTCL.C29"); ?><? createInputFormaters("CTCL.C30"); ?><? createInputFormaters("CTCL.C31"); ?><? createInputFormaters("CTCL.C32"); ?><? createInputFormaters("CTCL.C33"); ?><? createInputFormaters("CTCL.C34"); ?><? createInputFormaters("CTCL.C35"); ?><? createInputFormaters("CTCL.C36"); ?><? createInputFormaters("CTCL.C37"); ?><? createInputFormaters("CTCL.C38"); ?><? createInputFormaters("CTCL.C39"); ?>
        <?= replaceMappings("outC1Formatter.format(CTCL.C1,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC2Formatter.format(CTCL.C2,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC3Formatter.format(CTCL.C3,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC4Formatter.format(CTCL.C4,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC5Formatter.format(CTCL.C5,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC6Formatter.format(CTCL.C6,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC7Formatter.format(CTCL.C7,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC8Formatter.format(CTCL.C8,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC9Formatter.format(CTCL.C9,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC10Formatter.format(CTCL.C10,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC11Formatter.format(CTCL.C11,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC12Formatter.format(CTCL.C12,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC13Formatter.format(CTCL.C13,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC14Formatter.format(CTCL.C14,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC15Formatter.format(CTCL.C15,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC16Formatter.format(CTCL.C16,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC17Formatter.format(CTCL.C17,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC18Formatter.format(CTCL.C18,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC19Formatter.format(CTCL.C19,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC20Formatter.format(CTCL.C20,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC21Formatter.format(CTCL.C21,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC22Formatter.format(CTCL.C22,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC23Formatter.format(CTCL.C23,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC24Formatter.format(CTCL.C24,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC25Formatter.format(CTCL.C25,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC26Formatter.format(CTCL.C26,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC27Formatter.format(CTCL.C27,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC28Formatter.format(CTCL.C28,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC29Formatter.format(CTCL.C29,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC30Formatter.format(CTCL.C30,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC31Formatter.format(CTCL.C31,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC32Formatter.format(CTCL.C32,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC33Formatter.format(CTCL.C33,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC34Formatter.format(CTCL.C34,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC35Formatter.format(CTCL.C35,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC36Formatter.format(CTCL.C36,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC37Formatter.format(CTCL.C37,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC38Formatter.format(CTCL.C38,myStringBuilder,Odiwarn);") ?><?= "myStringBuilder.append(trgRecordSeparator);" ?><?= replaceMappings("outC39Formatter.format(CTCL.C39,myStringBuilder,Odiwarn);") ?>
        myStringBuilder.append(trgLineSeparator);
        pBufferedWriter.write(myStringBuilder.toString());
        if (Odiwarn.warning)
         pBufferedLogWriter.append("\nwarning line: "+Odiwarn.currentLine+"\t"+Odiwarn.warntext);
         addWarning();
        addInserted();
        catch (Exception e) {
         // TODO: handle exception
         pBufferedLogWriter.append("\nError line: "+nbLine+"\t"+e.getMessage());
         e.printStackTrace();
         pBufferedBadWriter.append(tmpString+"\n");
         synchronized(lock) {
          nbError+=1;
          if (nbError >=1)
           {pBufferedLogWriter.append("Maximum number of errors reached \n");
              doWeContinueBatch=false;
              maxErrorReach=true;
           return;}
      catch (Exception e) {
       throw(new RuntimeException(e.getMessage()));
    static class OdiFileFilter implements FilenameFilter {
      Pattern myPattern;
      BufferedWriter myLogWriter;
      public OdiFileFilter (String pPattern,BufferedWriter logWriter) throws IOException {
       File pWorkSchema = new File("<?=snpRef.getSchemaName("CT_Sample", "D") ?>");
       StringBuilder buffer = new StringBuilder();
       pPattern = pWorkSchema.getAbsolutePath().replace("\\", "/") + "/" + pPattern;
       myLogWriter=logWriter;
       char[] chars = pPattern.toCharArray();
       for (int i = 0; i < chars.length; ++i)    {
        buffer.append(chars[i]);
       myPattern = Pattern.compile(buffer.toString());
       myLogWriter.append("\nPattern: " + buffer.toString());
      public boolean accept(File pDir, String pName) {
       Matcher myMatcher = myPattern.matcher(pDir.getAbsolutePath().replace("\\", "/") + "/" + pName);
       System.out.println("" + myMatcher.matches() + pDir.getAbsolutePath().replace("\\", "/") + "/" + pName);
       return myMatcher.matches();
    public static void main(String[] args) throws Exception{
      LOG_FILE =
      BAD_FILE =
       String wbadfile = "<?=snpRef.getObjectName("L", "FILE_OK.csv", "CT_Sample", "", "D") ?>.bad";
       String wlogfile = "<?=snpRef.getObjectName("L", "FILE_OK.csv", "CT_Sample", "", "D") ?>.log";
      <?= getOdiClassName() ?> myIKMFileProcessing = new <?= getOdiClassName() ?>("<?=snpRef.getObjectName("L", "FILE_OK.csv", "CT_Sample", "", "D") ?>",wlogfile,wbadfile);
      File[] inputFileList;
      OdiFileFilter myFileFilter = new OdiFileFilter("<?=snpRef.getObjectShortName("L", "Pfizer_Regional_CT_costs_Aug2013_AP.csv", "CT_Sample", "D") ?>",myIKMFileProcessing.pBufferedLogWriter);
      File inputDir = new File("<?=snpRef.getSchemaName("CT_Sample", "D") ?>");
      inputFileList = inputDir.listFiles(myFileFilter);
      String s="";
      if (inputFileList.length==0) {myIKMFileProcessing.pBufferedLogWriter.append("\n\tError : Source file does not exist");}
      for (int i=0;i<inputFileList.length;i++) {
       if (myIKMFileProcessing.getDoWeContinueBatch()) {
       s=myIKMFileProcessing.processInputFile(inputFileList[i]);
      myIKMFileProcessing.pBufferedLogWriter.append(s);
      myIKMFileProcessing.pBufferedLogWriter.flush();
    public String processInputFile(File pInputFile) throws Exception {
      /* We open the source File by taking the encoder into account if needed */
       Scanner myScanner = new Scanner(new BufferedReader(new FileReader(pInputFile)));
        pBufferedLogWriter.append("\nInput file:\t\t"+pInputFile.getAbsolutePath().replace("\\", "/"));
      /* We use a Scanner as the record separator might not necessarily be \n */
      myScanner.useDelimiter("\n");
      /* We read the first lines in order to ignore them depending on the setting of the source datastore */
      for (int i=0;i < 0;i++){
       if (myScanner.hasNext()) {
        myScanner.next();
        nbLine+=1;
        nbHeader+=1;
      OdiFileTransformer[] odiFileTransformers = new OdiFileTransformer[NB_THREADS];
      for (int i=0;i<NB_THREADS;i++){
       odiFileTransformers[i] = new OdiFileTransformer(myScanner );
      for (int i=0;i<NB_THREADS;i++){
       odiFileTransformers[i].start();
      for (int i=0;i<NB_THREADS;i++){
       odiFileTransformers[i].join();
      end=new Date();
        if (maxErrorReach)
        pBufferedLogWriter.append("\n\tNumber of lines read for this file:\t\t" + nbLine);
        pBufferedLogWriter.append("\n\tNumber of data lines read for this file:\t\t" + (nbLine-1) + "\n\n\n");
        pBufferedLogWriter.append("\n\tNumber of error lines read for this file:\t\t" + (nbError-nbErrorInPrevFiles));
        pBufferedLogWriter.append("\n\tNumber of data lines read and filtered out for this file:\t\t" + (nbFilter-nbFilterInPrevFiles)+"\n");
      else
         pBufferedLogWriter.append("\n\tNumber of lines for this file:\t\t" + nbLine);
         pBufferedLogWriter.append("\n\tNumber of data lines for this file:\t\t" + (nbLine-1));
         pBufferedLogWriter.append("\n\tNumber of error lines for this file:\t\t" + (nbError-nbErrorInPrevFiles));
         pBufferedLogWriter.append("\n\tNumber of data lines filtered out for this file:\t\t" + (nbFilter-nbFilterInPrevFiles)+"\n");
        nbFiles+=1;
        nbTotalLine+=nbLine;
        nbErrorInPrevFiles = nbError;
        nbFilterInPrevFiles = nbFilter;
        nbLine=0;
        String s = "\n\n\n\n************************** TOTAL FIGURES ********************************";
        s = s + "\n\t"+nbFiles+" input file(s) processed.\n";
        s = s + "\n\t"+nbTotalLine+" Rows successfully read.\n" ;
        s = s +"\t"+nbHeader+" Rows skipped (Header).\n" ;
        s = s + "\t"+nbInserted+" Rows successfully loaded.\n" ;
        s = s +"\t\t==>"+nbWarning+" Rows loaded with warning.\n" ;
        s = s +"\t"+nbError+" Rows not loaded due to data errors.\n" ;
        s = s +"\t"+nbFilter+" Rows not loaded because of filter.\n" ;
        s = s + "\n\n\n";
        s = s + "\n\tRun began on "+debut;
        s = s + "\n\tRun ended on "+end;
        //long x=   ;
        s = s + "\n\tElapsed time was:\t"+Math.abs(end.getTime() - debut.getTime())+" milliseconde";
      /* We flush the buffer for any data that has not been written on the disk yet */
      pBufferedWriter.flush();
      pBufferedLogWriter.flush();
      pBufferedBadWriter.flush();
      return s;
    at com.sunopsis.dwg.dbobj.SnpSessStep.createTaskLogs(SnpSessStep.java:738)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:461)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
    at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
    at java.lang.Thread.run(Thread.java:662)

    This seems like a lot of code. I would suggest to compile your custom code outside of odi first to debug any syntax errors.

  • Java regular expressions Doubt

    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    public class ArrayExample {
        public static void main(String[] args) {
             String message = "FAMT/4,";
             Pattern pattern = Pattern.compile("(\\w*)(/)(\\d*)(,)(\\d*)");
              Matcher matcher = pattern.matcher(message);
                 if (matcher.find()) {
                      System.out.println("matcher.group(0) : "+matcher.group(0));
                      System.out.println("matcher.group(1) : "+matcher.group(1));
                      System.out.println("matcher.group(2) : "+matcher.group(2));
                      System.out.println("matcher.group(3) : "+matcher.group(3));
                      System.out.println("matcher.group(4) : "+matcher.group(4));
                      System.out.println("matcher.group(5) : "+matcher.group(5));}
    Outbut
    matcher.group(0) : FAMT/4,
    matcher.group(1) : FAMT
    matcher.group(2) : /
    matcher.group(3) : 4
    matcher.group(4) : ,
    matcher.group(5) :
    Could Someone Explain me the output. I searched a lot on group functions and not finding anything that will clear my doubt on the output

    Group zero represents the whole match. The rest are numbered according to their positions within the regex: the first set of parentheses is group one, the second set is group two, etc.. Groups can be nested, so you actually go by the position of the opening parenthesis, '('.

Maybe you are looking for

  • Dynamic Creation of form

    Hi, I need to create a web dynpro form that will filtered the fields to be displayed or set the property (mandatory or read only) based on 5 criteria selected by user. Due to complexity of the form, i need to create the form dynamically during run ti

  • TS1702 Can't purchase line stickers

    Just last night. I cant buy LINE sticker in sticker shop. there is an error as "Your purchase wasn't completed successfully. Please check your [My ORDERS] page. If see an item you don't  recognize, please contact the help page. But the weirded thing

  • Unable to connect to network after Installing Oracle VM server 2.2.1

    Dear All, I have downloaded Oracle VM Server 2.2.1 from Oracle E-Delivery Site. I installed it on one server. But after installing it I am not able to connect to the network. When I am trying to ping other servers, it says Destination Host Unreachabl

  • Problem with DimensionBuilder (Business Objects Financial Consolidation)

    Description of Problem or Question: Hi all, i try to create a new Dimension as described in the help by switching into "Definition Mode" of the Dimensionbuilder. In "data sources" I select the "amounts" folder and Select File -> New -> Dimension. Unf

  • Color the value in Advanced Table

    Hi, I have got a requirement to color value in advanced table based on condition. I have written a code in PR and it is working fine in jdeveloper and modified custom.xss file in $OA_HTML\cabo/styles folder. runtime i am setting a attribute value 'Re