Package nexj.core.integration

Examples of nexj.core.integration.IntegrationException


      //Null row datum may only be ignored if the first field (and so all of the fields) is optional
      if (rowTransferObj == null)
      {
         if (partsInOrder != null && partsInOrder.length >= 1 && partsInOrder[0].isRequired())
         {
            throw new IntegrationException("err.integration.minPartCount",
               new Object[]{partsInOrder[0].getFullPath()});
         }
        
         return;
      }
     
      MessagePart previousPart = rowPart;
     
      //Format fields in ordinal order
      for (int nPartIndex=0; nPartIndex < partsInOrder.length; nPartIndex++)
      {
         PrimitiveMessagePart part = partsInOrder[nPartIndex];
        
         if (part == null)
         {
            nDelimiterAccumulator += 1;
            continue;
         }
        
         CSVMessagePartMapping partMapping = (CSVMessagePartMapping)part.getMapping();
        
         //Get the transfer object for this part's datum.
         String[] dataKeyPath = partMapping.getDataKeyPath();
         Object datum = rowTransferObj;

         for (int nKeyPathIndex=0; nKeyPathIndex < dataKeyPath.length; nKeyPathIndex++)
         {
            datum = ((TransferObject)datum).findValue(dataKeyPath[nKeyPathIndex], Undefined.VALUE);
           
            if (datum == Undefined.VALUE)
            {
               break;
            }
         }
        
         //Always write the absolute minimum number of delimiters: if there is no data
         //for the last fields on the line, then no delimiter is written.
         if (datum != Undefined.VALUE)
         {
            for (int nDelim = 0; nDelim < nDelimiterAccumulator; nDelim++)
            {
               m_writer.write(((CSVMessagePartMapping)previousPart.getMapping()).getDelimiter().charValue());
            }
           
            nDelimiterAccumulator = 1;
            formatField(datum, partMapping, part);
         }
         else
         {
            nDelimiterAccumulator++;
           
            if (part.isRequired())
            {
               throw new IntegrationException("err.integration.minPartCount",
                  new Object[]{part.getFullPath()});
            }
         }
        
         previousPart = part;
View Full Code Here


            {
               m_writer.write(chOut);
            }
            else if (chIn == '\n' || chIn == '\r')
            {
               throw new IntegrationException("err.integration.csv.fieldHasNewlineButCantQuote",
                  new Object[]{mapping.getMessagePart().getFullPath()});
            }
           
            m_writer.write(chIn);
         }
View Full Code Here

    */
   public TransferObject parse(Input in, MessageTable table) throws IntegrationException
   {
      if (table.getParserTable() == null || !(table.getParserTable() instanceof CSVMessageParserTable))
      {
         throw new IntegrationException("err.integration.messageTableUninitialized");
      }

      CSVMessageParserTable parserTable = (CSVMessageParserTable)table.getParserTable();

      if (parserTable.getMessageList().size() == 0)
      {
         return null;
      }

      Object[] rawRow = null;
      Message detectedMessage = null;

      Message longestMessage = parserTable.getMessageWithMostFields();
      CSVMessagePartMapping rootMapping = (CSVMessagePartMapping)longestMessage.getRoot().getMapping();
      CompositeMessagePart rowPart = (CompositeMessagePart)longestMessage.getRoot().getPart(0);
      CSVMessagePartMapping rowMapping = (CSVMessagePartMapping)rowPart.getMapping();

      initializeParse(in, rootMapping);

      //Count the number of fields in the first row of input, and use this number
      //to guess the message.
      try
      {
         rawRow = rawReadRow(null, rowMapping);

         detectedMessage = parserTable.getMessageForFieldCount(rawRow.length);
      }
      catch (IOException ioEx)
      {
         throw new IntegrationException("err.integration.csv.undetectableMessage", ioEx);
      }

      if (detectedMessage == null)
      {
         throw new IntegrationException("err.integration.csv.undetectableMessage");
      }

      //Parse detected Message, starting with first row of data already read.
      return parseMessage(detectedMessage, rawRow);
   }
View Full Code Here

         consumeComments(rootMapping);
      }
      catch (IOException ioEx)
      {
         throw new IntegrationException("err.integration.parse",
            new Object[]{null}, ioEx);
      }
   }
View Full Code Here

         listResult = parseBody(partsInOrder, rowMapping, firstRow);
      }
      catch (Exception innerEx)
      {
         throw new IntegrationException("err.integration.parse",
            new Object[]{msg.getName()}, innerEx);
      }

      result = new TransferObject(msg.getName());
      result.setValue(rowPart.getName(), listResult);
View Full Code Here

            {
               MessagePart scanPart = partsInOrder[nPartScanIndex];

               if (scanPart != null && scanPart.isRequired())
               {
                  throw new IntegrationException("err.integration.minPartCount",
                     new Object[]{scanPart.getFullPath()});
               }
            }

            continue;
View Full Code Here

         {
            partEncounteredArray[partMapping.getOrdinal()-1] = true;
         }
         else
         {
            throw new IntegrationException("err.integration.csv.duplicateFieldInHeader",
               new Object[]{rawRow[nNameIndex], new Integer(nNameIndex+1)});
         }
      }

      return result;
View Full Code Here

            CSVMessagePartMapping message2Mapping = (CSVMessagePartMapping)message2.getRoot().getMapping();

            //Perform verification on the message pair (message1, message2)
            if (!haveSameConfiguration(message1Mapping, message2Mapping) || !verifyLengthRestriction(message1, message2))
            {
               throw new IntegrationException("err.integration.csv.messageTableConflict",
                  new Object[]{message1.getName(), message2.getName()});
            }
         }

         messages.add(message1);
View Full Code Here

         {
            m_fieldToMessageArray[nFields] = msg;
         }
         else
         {
            throw new IntegrationException("err.integration.csv.sameNumberOfFields",
               new Object[]{m_fieldToMessageArray[nFields], msg.getName(), Integer.toString(nFields)});
         }
      }
View Full Code Here

      {
         throw e;
      }
      catch (Exception e)
      {
         throw new IntegrationException("err.integration.hl7.messageSyntax",
            new Object[]{message.getName()}, e);
      }
   }
View Full Code Here

TOP

Related Classes of nexj.core.integration.IntegrationException

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.