Package com.webdeninteractive.xbotts.Mapping.compiler

Examples of com.webdeninteractive.xbotts.Mapping.compiler.Record


   
   
   
    JFrame testFrm = new JFrame();
   
    Record node = new Record("test1");
    Record childNode = new Record("child11");
    Record childNode3 = new Record("child12");
    node.add(childNode);
    childNode.add(childNode3);
    //childNode.setParent(node);

   
    Record node2 = new Record("test2");
    Record childNode2 = new Record("child2");
    node2.add(childNode2);

    SchemaTreeModel model = new SchemaTreeModel(node);
    SchemaTreeModel model2 = new SchemaTreeModel(node2);
   
View Full Code Here


   
      protected SchemaTreeModel createProcessDefinitionSchemaTreeModel(boolean isSource) {
        if(!isSource)
          return super.createProcessDefinitionSchemaTreeModel(isSource);
       
        Record root = new Record("Tables");
       
        try {
         
          InputStream is = null;
         
          String tableName = null;
          ConnectionFactory connectionFactory = null;
          if(activity!=null){
            tableName = ((DatabaseMappingActivity)activity).getTableName();
            connectionFactory = ((DatabaseMappingActivity)activity).getConnectionFactory();
          }
         
          if(tableName==null){
            tableName = (String)tableNameInputter.getValue();
          }
         
          if(connectionFactory==null){
            connectionFactory = (ConnectionFactory) connectionFactoryInputter.getValue();
          }
         
          //if(connectionFactory!=null){
            String serConnectionFactory = GlobalContext.serialize(connectionFactory, ConnectionFactory.class);
           
            HashMap keyAndValue = new HashMap();
            keyAndValue.put("connectionFactory", serConnectionFactory);
            keyAndValue.put("tableName", tableName);

            is = ProcessDesigner.getClientProxy().postStream("/processmanager/browseDatabaseDirectory.jsp", keyAndValue);
          /*}else{
            is = ProcessDesigner.getClientProxy().openStream("/processmanager/browseDatabaseDirectory.jsp");
          }*/
       
          ArrayList columnList = (ArrayList) GlobalContext.deserialize(is, String.class);
          Record parent = null;
          /*for(int i=0; i<dbList.size(); i++){
            Object element = dbList.get(i);
            if(element instanceof ArrayList){//that means the field parts are started.
              if(parent!=null){
                ArrayList fields = (ArrayList)element;
                for(int j=0; j<fields.size(); j++){
                  String fieldName = (String)fields.get(j);
                  Record node = createRecord(fieldName, parent.getName() + "." + fieldName, isSource);
                  parent.add(node);
                }
              }
            }else{
              String tableName = (String)element;
              Record node = createRecord(tableName, tableName, isSource);
              parent = node;
              root.add(node);
            }
          }*/
         
          for(int i=0; i<columnList.size(); i++){
            ColumnProperty columnProperty = (ColumnProperty) columnList.get(i);
             
            Record node = createRecord(columnProperty.getColumnName(), tableName + "." + columnProperty.getColumnName(), isSource);
            node.getExtendedProperties().put("columnProperty", columnProperty);
           
            if(typesToClassMap.containsKey(columnProperty.getType())){
              Class type = (Class) typesToClassMap.get(columnProperty.getType());
             
              node.getExtendedProperties().put("type", type);
              node.setClassType(type);
            }
           
            root.add(node);
          }
         
          return new SchemaTreeModel(root);
         
        } catch (Exception e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
         
          Record node = new Record("can't connect database repository...");
          SchemaTreeModel schema = new SchemaTreeModel(node);
         
          return schema;
        }
      }
View Full Code Here

      void setOwner(Linkable parent){
          this.parent=(LinkableTreeNode)parent;
      }
     
      public int getDepth( ){
          Record p=(Record)this.parent;
          int c = 0;
          while(p!=null){
              p=(Record)p.getOwner( );
              c++;
          }
          return c;
      }
View Full Code Here

   
    setValue(oldValue);
  }
 
  protected Record createRecord(String name, String referenceName, boolean isSource){
    Record node = new Record(name);
    if(referenceName==null){
      referenceName = name;
    }
   
    node.setReferenceName(referenceName);
   
    if(isSource)
      sourceNodes.put(referenceName, node);
    else
      targetNodes.put(referenceName, node);
View Full Code Here

   
    return node;
  }
 
  protected SchemaTreeModel createProcessDefinitionSchemaTreeModel(boolean isSource){
    Record variablesNode = new Record("Variables");
    Record rolesNode = new Record("Roles");
   
    ProcessDefinition def = (ProcessDefinition)ProcessDesigner.getInstance().getProcessDefinitionDesigner().getActivity();
    ProcessVariable[] pvds = (def != null ? def.getProcessVariables() : new ProcessVariable[]{});
    Role[] roles = (def != null ? def.getRoles() : new Role[]{});
   
    //final ArrayList variables = new ArrayList();
   
    if(pvds!=null)
    for(int i=0; i<pvds.length; i++){
      //variables.add(pvds[i]);
     
      Record variableNode = createRecord(pvds[i].getDisplayName().getText(), pvds[i].getName(), isSource);
     
      variablesNode.add(variableNode);
     
      createVariableNode(pvds[i], variableNode, isSource);
    }
   
    for(int i=0; i<roles.length; i++){
      //RolePointingProcessVariable rolePV = new RolePointingProcessVariable();
      //rolePV.setRole(roles[i]);
      //variables.add(rolePV);
     
      rolesNode.add(createRecord(roles[i].getName(), "[roles]."+roles[i].getName(), isSource));
    }
   
    String[] instancePropertyNames = new String[]{
      "instanceId",
      "name",
      "locale",
      "status",
      "info",
      "dueDate",
      "mainProcessInstanceId",
      "mainActivityTracingTag",
      "rootProcessInstanceId"
      "dummy1"
      "dummy2"
      "dummy3"
      "dummy4"
      "dummy5"

    };
   
    //build up bean property tree
/*    HashMap beanTree = new HashMap();
    for(int i=0; i < beanNames.length; i++){
      String beanName = beanNames[i];
     
      String[] parts = beanName.replace('.','@').split("@");
     
      HashMap tree = beanTree;
      for(int depth = 0; depth < parts.length; depth++){
        String part = parts[depth];
        if(!tree.containsKey(part))
          tree.put(part, new HashMap());
       
        tree = (HashMap) tree.get(part);
      }
    }
*/   
    Record instanceNode = new Record("Instance");
   
    for(int i=0; i < instancePropertyNames.length; i++){
      instanceNode.add(createRecord(instancePropertyNames[i], "[instance]." + instancePropertyNames[i], isSource));
    }
   
    Record activitiesNode = new Record("Activities");
    createActivityNode(def, activitiesNode, isSource);
   
    Record srcNode = new Record("source");
    srcNode.add(variablesNode);
    srcNode.add(rolesNode);
    srcNode.add(instanceNode);
    srcNode.add(activitiesNode);
   
    SchemaTreeModel model = new SchemaTreeModel(srcNode);

    return model;
  }
View Full Code Here

      };
   
    ActivityForLoop afl = new ActivityForLoop(){
      public void logic(Activity activity) {
        if(activity instanceof HumanActivity){
          Record activityNode = createRecord(activity.getName().getText(), "[activities]."+activity.getTracingTag(), isSource);
         
          activitiesNode.add(activityNode);
         
          for (int i = 0; i < activityPropertyNames.length; i++) {
            activityNode.add(createRecord(activityPropertyNames[i],"[activities]."+activity.getTracingTag() + "." + activityPropertyNames[i], isSource));
          }
        }
      }
    };
    afl.run(def);
View Full Code Here

       LinkedPair linkedPair = (LinkedPair) iter.next();
       ParameterContext paramContext = null;
      
       if(linkedPair.getSource() instanceof TransformerArgument && linkedPair.getTarget() instanceof Record){
         TransformerArgument source = (TransformerArgument) linkedPair.getSource();
         Record target = (Record) linkedPair.getTarget();
        
         paramContext = new MappingElement();

         TextContext argumentText = TextContext.createInstance();
         argumentText.setText(target.getReferenceName());
         paramContext.setArgument(argumentText);
        
         ((MappingElement)paramContext).setKey(Record.KEY == target.getKeyType());
         //paramContext.setVariable(ProcessVariable.forName(source.getReferenceName()));
        
         if(target.getExtendedProperties()!=null && target.getExtendedProperties().containsKey("type")){
           paramContext.setType((Class)target.getExtendedProperties().get("type"));
         }
        
         source.getTransformer().beforeSerialization();
        
         TransformerMapping transformerMapping = new TransformerMapping();
         transformerMapping.setTransformer(source.getTransformer());
         transformerMapping.setLinkedArgumentName(source.getName());
        
         paramContext.setTransformerMapping(transformerMapping);
        
       }else if (linkedPair.getSource() instanceof Record && linkedPair.getTarget() instanceof Record){
      
        
         Record source = (Record) linkedPair.getSource();
         Record target = (Record) linkedPair.getTarget();
        
         paramContext = new MappingElement();
         TextContext argumentText = TextContext.createInstance();
         argumentText.setText(target.getReferenceName());
         paramContext.setArgument(argumentText);
         paramContext.setVariable(ProcessVariable.forName(source.getReferenceName()));
         ((MappingElement)paramContext).setKey(Record.KEY == target.getKeyType());
        
         if(target.getExtendedProperties()!=null && target.getExtendedProperties().containsKey("type")){
           paramContext.setType((Class)target.getExtendedProperties().get("type"));
         }
       }
      
       if(paramContext !=null)
         mappingContexts.add(paramContext);
View Full Code Here

          
           existingTransformers.put(transformer, tfd);
           //transformer.beforeSerialization();
         }

         Record target = (Record) sourceNodes.get(paramContext.getArgument().getText());
         //the output argument of transformer must be the source which should be linked in the first order
         TransformerArgument source = transformer.getTransferArgument(transformerMapping.getLinkedArgumentName());
        
         if(paramContext.isKey()){
           target.setKeyType(Record.KEY);
          }
         
         try{
           mapToolPanel.getModel().addLink(source, target);
         }catch(Exception e){
           e.printStackTrace();
         }
        
         new RecursiveLoop(){

          @Override
          public boolean logic(Object tree) {
            return false;
          }

          @Override
          public List getChildren(Object tree) {
           
            if(tree instanceof TransformerMapping){
              System.out.println();
            }
           
            // stops the recursive tracing when it meets the endpoints           
            if(!(tree instanceof Transformer)){
              return null;
            }
           
            Transformer transformer = (Transformer)tree;
           
            final ArrayList children = new ArrayList();

            if(transformer.getInputArguments()!=null)
            for(int i=0; i<transformer.getInputArguments().length; i++){
              Object argumentSource = transformer.getArgumentSourceMap().get(transformer.getInputArguments()[i]);
              TransformerArgument target = transformer.getTransferArgument(transformer.getInputArguments()[i]);
             
              if(argumentSource==null) continue;
             
              ArrayList argumentSources;
              if(argumentSource instanceof ArrayList){
                argumentSources = (ArrayList)argumentSource;
              }else{
                argumentSources = new ArrayList();
                argumentSources.add(argumentSource);
              }
             
              for(int j=0; j<argumentSources.size(); j++){
                argumentSource = argumentSources.get(j);
               
                if(argumentSource instanceof TransformerMapping){
                  TransformerMapping priorTransformerMapping = (TransformerMapping) argumentSource;
                 
                  Transformer priorTransformer = priorTransformerMapping.getTransformer();
                  argumentSource = priorTransformer;
                 
                  if(!existingTransformers.containsKey(priorTransformer)){
                    TransformerDesigner tfd = priorTransformer.createDesigner(mapToolPanel.getLinkPanel());
                    existingTransformers.put(priorTransformer, tfd);
                  }
                 
                  TransformerArgument priorTransformerArgument = priorTransformer.getTransferArgument(priorTransformerMapping.getLinkedArgumentName());
                  children.add(argumentSource);
 
 
                  if(priorTransformerArgument==null)
                    continue; //anyway never be occurred... means priorTransformerArgument must exist.
                 
                   /**
                    * transformer argument is eager to be changed since the user interface occasionally re-rendered.
                    */
                   priorTransformerArgument = priorTransformer.getTransferArgument(priorTransformerArgument.getName());
 
                   //the output argument of transformer must be the source which should be linked in the first order
                   TransformerArgument source = priorTransformerArgument;
                  
                  
                   try{
                     mapToolPanel.getModel().addLink(source, target);
                   }catch(Exception e){
                     e.printStackTrace();
                   }
                  
                  
                }else{ // the case that the source is a node
                   Record source = (Record) targetNodes.get((String)argumentSource);
                  
                   try{
                     mapToolPanel.getModel().addLink(source, target);
                   }catch(Exception e){
                     e.printStackTrace();
                   }
                  
                  children.add(argumentSource);
 
                }
              }
            }

            return children;
          }
          
         }.run(transformer);

       }else{
      
         Record source = (Record) targetNodes.get(paramContext.getVariable().getName());
         Record target = (Record) sourceNodes.get(paramContext.getArgument().getText());
         if(paramContext.isKey()){
           target.setKeyType(Record.KEY);
          }
         
         try{
           mapToolPanel.getModel().addLink(source, target);
         }catch(Exception e){
View Full Code Here

TOP

Related Classes of com.webdeninteractive.xbotts.Mapping.compiler.Record

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.