Package org.jitterbit.integration.data.script

Examples of org.jitterbit.integration.data.script.Transform


    m_tip=new TipWindow(this);
    TreeComponent sourceTreeComponent=treeMapperMigration.m_oldSourceTree,
      targetTreeComponent=treeMapperMigration.m_oldTargetTree;
    m_table=Maps.newHashMap();
    List<String> mapList=old.getMapList();
    Transform transform=new Transform();
    for (String line : mapList) {
      Mapping m = MapStringFormat.parse(line);
      String targetDE=m.getTargetPath().toString();
      String expr=m.getExpression();
      Node target=targetTreeComponent.findNode_expandTreeIfNotExist(targetDE);
View Full Code Here


    private final class PrintReversePolishNotationAction extends AbstractAction {

        @Override
        public void actionPerformed(ActionEvent e) {
            String expression = getText();
            Transform tf = new Transform();
            List<Token> tokens = tf.getRpnTokenVector(expression);
            if (tokens == null) {
                System.err.println("Syntax error");
            } else {
                System.out.println("Reverse Polish Notation:");
                for (Token t : tokens) {
View Full Code Here

                List<String> mappings = m_mappingsHaveBeenLoaded ?
                                getCurrentMappings() : m_Transformation.getMapList();
                m_sourceTreeComponent.readMappingStructure(input,m_sourceTitle);
                m_targetTreeComponent.readMappingStructure(output,m_targetTitle);
                getTreeMapperContainer().getFormulaDisplayer().refreshSourceTree(input, m_sourceTitle);
                m_transform=new Transform();
                m_sourceTreeComponent.createJmsProperties();
                m_targetTreeComponent.createJmsProperties();
                try {
                    setMapList(mappings, false);
                } catch (TreeMapperException ex) {
View Full Code Here

        }
        return isChangeAllowedByUser;
    }
   
    private String setFirstInstance(String expr){
        Transform transform=new Transform();
        List<Token> tokenList=transform.tokenize(expr);
        for(Token token: tokenList){
            if(token.m_id==Transform.t_DE){
                String sourceDe=token.m_str;
                Matcher matcher=PATTERN.matcher(sourceDe);
                if(matcher.find()){
View Full Code Here

            expr);
      }

      newExpr.append(expr.substring(start0,start));

      Transform trans = new Transform();
      trans.initTokenizer(expr, start, end);

      boolean isAtStart=true, hasValidLHS=false;
      Token t;
      while((t=trans.nextToken(isAtStart,hasValidLHS))!=null){
        int id=t.getId();
        if(id==Transform.t_End)break;
        if(id==Transform.t_Unknown){
          return null;
        }
        if(id==Transform.t_DE){
          //String oldDeName=t.getStr();
          // if oldDeName does not contains instance tag
          String oldDe0=t.getStr(),newDe0=mapTable.get(oldDe0);
          if(newDe0!=null){
            newExpr.append(newDe0);
          } else {
            StringTokenizer tk=new StringTokenizer(oldDe0,"#.",true);
            String str="";
            StringBuilder oldDe=new StringBuilder();
            String newDe=""; // oldDe0, newDe0 have '#', but oldDe, newDe don't
            boolean bPrompt=false;
            while(tk.hasMoreTokens()){
              String token=tk.nextToken();
              if(token.charAt(0)=='#'){
                StringBuilder tag=new StringBuilder("#"); // tag is the substring between '#' and '.' including '#' and '.'
                while(tk.hasMoreTokens()){
                  token=tk.nextToken();
                  tag.append(token);
                  if(token.charAt(0)=='.')break;
                }
                oldDe.append('.');
                int last_len=newDe.length();
                String newDe_tmp=mapTable.get("["+oldDe+"]");
                if(newDe_tmp==null){
                  bPrompt=true;
                          continue;
                } else if(newDe_tmp.charAt(0)=='['){
                  newDe=newDe_tmp.substring(1,newDe_tmp.length()-1);
                }
                int len=newDe.length();
                if(newDe.charAt(len-1)=='.'){ // this subnode terminate with '.'
                  str+=newDe.substring(last_len,len-1)+tag;
                }
                else {// subnode terminate with '$'
                  str+=newDe.substring(last_len,len);
                }
              }
              else {
                oldDe.append(token);
              }
            }
            int last_len=newDe.length();
            newDe=mapTable.get(oldDe.toString());
            if(newDe!=null){
              if(last_len<newDe.length()){
                str+=newDe.substring(last_len,newDe.length());
              }
              if(bPrompt){
                String title = "Target: "+targetDE;
                str=migration.manualConversion(title, oldDe0, str);
              }
              if(str!=null)newExpr.append(str);
            }
            if(str==null||newDe==null) {
              String title = "Target: "+targetDE;
              String err_message =
                "Failed to translate node: "+oldDe0+
                "\nin the following expression:";
              String question = "Do you want to skip the migration for this mapping?";

              if(migration.checkToContinue(title,err_message,expr,question)){
                        return null;
                      }
                      else {
                        throw new ScriptException(
                            "Error in migrating the mapping\n"+
                    "\nThe target node: "+ targetDE +
                    "\nFailed to translate the node:\n"+oldDe0+
                    "\nin the expression\n" + expr);
                      }
            }
          }
        } else {
          newExpr.append(t.getStr());
        }
        if(id!=Transform.t_Space && id!=Transform.t_Comment){
          hasValidLHS=(id==Transform.t_Set||id==Transform.t_GlobalDE||id==Transform.t_LocalDE);
          isAtStart=(id==Transform.t_Set||id==Transform.t_LP||id==Transform.t_Fcn||
            id==Transform.t_And||id==Transform.t_Or||id==Transform.t_NE||id==Transform.t_EQ||
            id==Transform.t_GT||id==Transform.t_GE||id==Transform.t_LT||id==Transform.t_LE||id==Transform.t_Comma||id==Transform.t_Semicolon);
          trans.setLastId(id);
        }
      }
      newExpr.append(ScriptConstants.END_TRANS);
      start0=end+ScriptConstants.END_TRANS_LENGTH;
    }
View Full Code Here

        }
    }

    private void updateScriptedLinks(IntegrationEntityLookup lookup, String script) {
        Set<? extends IntegrationEntityId> ids = GrammarUtils.getAllIdsFromScript(
                new Transform(), script, "The Script " + getName());
        Collection<? extends IntegrationEntity> objects =
            IdToObjectUtils.getEntitiesFromIds(ids, lookup, IntegrationEntity.class);
        scriptedLinks = Lists.newArrayList();
        for (IntegrationEntity e : objects) {
            if (e != null) {
View Full Code Here

        private final List<String> newMapList = Lists.newArrayList();

        private final Transform transform;

        public MappingReplacer() {
            transform = new Transform();
        }
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.data.script.Transform

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.