Package com.exedosoft.plat

Examples of com.exedosoft.plat.Transaction


    if (this.service == null || this.service.getTempSql() == null) {
      this.setEchoValue(I18n.instance().get("未配置SQL 语句"));
      return NO_FORWARD;
    }

    Transaction t = this.service.currentTransaction();
    try {
      t.begin();

      // 数据源ID
      // String datasourceuid = this.actionForm.getValue("datasourceuid");
      // 业务包UID
      String bpuid = this.actionForm.getValue("bpuid");

      String fileName = this.actionForm.getValue("fileName");

      if (fileName == null || fileName.trim().equals("")) {
        this.setEchoValue(I18n.instance().get("你还没有选择文件!"));

        return NO_FORWARD;
      }

      // if (datasourceuid == null || datasourceuid.trim().equals("")) {
      // this.setEchoValue("你没有选择数据源! ");
      // return NO_FORWARD;
      // }

      fileName = DOGlobals.UPLOAD_TEMP.trim() + "/" + fileName.trim();
      System.out.println("FileName::" + fileName);
      boolean isImport = importXml(bpuid, fileName);
      if (!isImport) {
        return NO_FORWARD;
      }
      this.setEchoValue(I18n.instance().get("翻译完成!"));

    } catch (Exception e) {
      t.rollback();
      e.printStackTrace();
    } finally {
      t.end();
    }

    this.setEchoValue(I18n.instance().get("导入成功!"));

    return DEFAULT_FORWARD;
View Full Code Here


    return DEFAULT_FORWARD;
  }

  public static  void removeBO(BOInstance instance) {
    DOService deletes = DOService.getService("DO_Parameter_deletebybouid");
    Transaction t = deletes.currentTransaction();
    t.begin();
    try {
      deletes.invokeUpdate(instance.getUid());
     
      deleteRubbish(instance,"DO_BO_Property_deletebybouid");
      deleteRubbish(instance,"DO_Rule_deletebybouid");
      deleteRubbish(instance,"DO_Service_deletebybouid");
      deleteRubbish(instance,"DO_Service_Rule_DeleteRubbish");
      deleteRubbish(instance,"DO_Parameter_Service_deleterubbish");
      deleteRubbish(instance,"DO_UI_PaneModel_deletebyboduid");
      deleteRubbish(instance,"DO_UI_PaneLinks_Deleterubbish");
       
      deleteRubbish(instance,"DO_UI_GridModel_deletebycategoryUid");
      deleteRubbish(instance,"DO_UI_FormModel_deleterubbish");
      deleteRubbish(instance,"DO_UI_FormTargets_deleterubbish");
      deleteRubbish(instance,"DO_UI_FormLinks_deleterubbish");
      
      
      deleteRubbish(instance,"DO_UI_MenuModel_deletebycategoryUid");
      deleteRubbish(instance,"DO_UI_MenuModel_Deleterubbish");
      deleteRubbish(instance,"DO_UI_MenuModel_Deleterubbish");
      deleteRubbish(instance,"DO_UI_MenuModel_Deleterubbish");
      deleteRubbish(instance,"DO_UI_MenuModel_Deleterubbish");


      deleteRubbish(instance,"DO_UI_TreeModel_deletebycategoryUid");
      deleteRubbish(instance,"DO_UI_TreeModel_Deleterubbish");
      deleteRubbish(instance,"DO_UI_TreeModel_Deleterubbish");
      deleteRubbish(instance,"DO_UI_TreeModel_Deleterubbish");
      deleteRubbish(instance,"DO_UI_TreeModel_Deleterubbish");
      deleteRubbish(instance,"DO_UI_TreeModel_Deleterubbish");
      

//      DOService formTargetInsert = DOService
//          .getService("DO_UI_FormTargets_Insert");
//
//      DOService formLinksInsert = DOService
//          .getService("DO_UI_FormLinks_Insert");
//
//      DOService treeModelInsert = DOService
//          .getService("DO_UI_TreeModel_Insert");


     
      deleteRubbish(instance,"DO_BO_Delete");
      ///清楚缓存
      CacheFactory.getCacheData().put(instance.getUid(), null);
   
    } catch (ExedoException e) {
      t.rollback();
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    t.end();
  }
View Full Code Here

    DOService findBP = DOService
        .getService("DO_BusiPackage_byapplicationuid");

    DOService findBO = DOService.getService("DO_BO_FindByBPUid_Form");

    Transaction t = findBP.currentTransaction();
    List<String> allIDs = new ArrayList<String>();
    DOExport export = new DOExport();
    try {
      t.begin();
      List bps = appendJSONS(sb, "package", findBP);
      // 服务下面的参数

      DOBO aBO = DOBO.getDOBOByName("do_bo");
      for (Iterator itBp = bps.iterator(); itBp.hasNext();) {
        BOInstance biBP = (BOInstance) itBp.next();
        List bos = findBO.invokeSelect(biBP.getUid());
        for (Iterator itBO = bos.iterator(); itBO.hasNext();) {
          BOInstance biBO = (BOInstance) itBO.next();
          aBO.refreshContext(biBO.getUid());
          export.exportBO(sb, biBO);
        }
      }
      t.end();
    } catch (Exception e) {
      t.rollback();
      e.printStackTrace();
    }

    sb.append("</export>");
   
View Full Code Here

    if (this.service == null || this.service.getTempSql() == null) {
      setEchoValue(I18n.instance().get("未配置SQL 语句"));
      return NO_FORWARD;
    }

    Transaction t = this.service.currentTransaction();
    try {
      t.begin();
      DOBO boPane = DOBO.getDOBOByName("do_ui_panemodel");
      DOBO boGrid = DOBO.getDOBOByName("do_ui_gridmodel");
      DOBO boForm = DOBO.getDOBOByName("do_ui_formmodel");
      DOBO boFormLink = DOBO.getDOBOByName("DO_UI_FormLinks");
      DOBO boFormTarget = DOBO.getDOBOByName("DO_UI_FormTargets");

      // /还要复制子面板连接(子面板内部不复制)
      BOInstance biPane = boPane.getCorrInstance();
      DOPaneModel pm = DOPaneModel.getPaneModelByID(biPane.getUid());

      DOGridModel gm = pm.getGridModel();
      // //如果连接的是表格:::::暂时只实现这个
      if (gm != null) {

        // /////保存GridModel
        BOInstance biGrid = boGrid.getInstance(gm.getObjUid());
        biGrid.putValue("objuid", null);
        biGrid.putValue("name", biGrid.getValue("name") + "_copy");
        biGrid.putValue("l10n", biGrid.getValue("l10n") + "_copy");
        BOInstance newBiGrid = boGrid.getDInsertService().invokeUpdate(
            biGrid);

        // //保存GridModel

        // /保存面板
        biPane.putValue("objuid", null);
        biPane.putValue("name", biPane.getValue("name") + "_copy");
        biPane.putValue("l10n", biPane.getValue("l10n") + "_copy");
        biPane.putValue("linkuid", newBiGrid.getUid());       
        boPane.getDInsertService().invokeUpdate(biPane);
        // /保存面板

        List<DOFormModel> fms = gm.getAllGridFormLinks();
        Map<DOFormModel,BOInstance> map = new HashMap<DOFormModel,BOInstance>();
        for (Iterator<DOFormModel> it = fms.iterator(); it.hasNext();) {
          DOFormModel aFm = it.next();
          // ///保存FormModel
          BOInstance biForm = boForm.getInstance(aFm.getObjUid());
          biForm.putValue("objuid", null);
          biForm.putValue("gridModelUid", newBiGrid.getUid());
         
          DOService fmInsert = boForm.getDInsertService();
         
          if("en".equals(DOGlobals.getValue("lang.local"))){
            fmInsert = DOService.getService("DO_UI_FormModel_Insert_EN");
          }
         
          BOInstance newBiForm = fmInsert.invokeUpdate(biForm);
         
          map.put(aFm, newBiForm);
          // //保存FormModel
          for(Iterator<DOFormTarget> itTargetGrid = aFm.getTargetGridModels().iterator();itTargetGrid.hasNext(); ){
            DOFormTarget aFt = itTargetGrid.next();
            BOInstance biFt = boFormTarget.getInstance(aFt.getObjUid());
            biFt.putValue("objuid", null);
            biFt.putValue("formUid", newBiForm.getUid());
            boFormTarget.getDInsertService().invokeUpdate(biFt);           
          }
        }

        /////linkForms 需要单独处理
        for (Iterator<DOFormModel> it = fms.iterator(); it.hasNext();) {
          DOFormModel aFm = it.next();
          BOInstance newBiForm = map.get(aFm);
          // //FormModel linkForms
          for(Iterator<DOFormModel> itLinkForms = aFm.getLinkForms().iterator(); itLinkForms.hasNext();){
            DOFormModel linkForm = itLinkForms.next();
            BOInstance newLinkBiForm = new BOInstance();
            if(map.get(linkForm)!=null){
              newLinkBiForm = map.get(linkForm);
            }else{
              newLinkBiForm = boForm.getInstance(linkForm.getObjUid());
            }
            // 
            Map<String,String> paras = new HashMap<String,String>();
            paras.put("formuid", newBiForm.getUid());
            paras.put("linkformuid", newLinkBiForm.getUid());
            boFormLink.getDInsertService().invokeUpdate(paras);
          }

        }

      }

      t.end();
    } catch (Exception e) {
      t.rollback();
      e.printStackTrace();
    }
    setEchoValue(I18n.instance().get("复制成功,请点击左侧树节点进行操作!"));

    return DEFAULT_FORWARD;
View Full Code Here

    if("en".equals(DOGlobals.getValue("lang.local"))){
      copyService = DOService.getService("DO_UI_FormModel_COPY_TO_GRID_EN");
    }
    
   
    Transaction t = copyService.currentTransaction();
    try {
      t.begin();
      DOBO boForm = DOBO.getDOBOByName("do_ui_formmodel");
      DOBO boFormTarget = DOBO.getDOBOByName("DO_UI_FormTargets");
      DOBO boFormLink = DOBO.getDOBOByName("DO_UI_FormLinks");
      for(int i = 0; i < checks.length ; i++){
        BOInstance biForm = boForm.getInstance(checks[i]);
        DOFormModel aFm = DOFormModel.getFormModelByID(biForm.getUid());
       
        biForm.putValue("objuid", null);
        biForm.putValue("gridModelUid", gridModelUid);
        BOInstance newBiForm = copyService.invokeUpdate(biForm);
        // //保存FormModel
        for(Iterator<DOFormTarget> itTargetGrid = aFm.getTargetGridModels().iterator();itTargetGrid.hasNext(); ){
          DOFormTarget aFt = itTargetGrid.next();
          BOInstance biFt = boFormTarget.getInstance(aFt.getObjUid());
          biFt.putValue("objuid", null);
          biFt.putValue("formUid", newBiForm.getUid());
          boFormTarget.getDInsertService().invokeUpdate(biFt);           
        }

          // //FormModel linkForms
        for(Iterator<DOFormModel> itLinkForms = aFm.getLinkForms().iterator(); itLinkForms.hasNext();){
            DOFormModel linkForm = itLinkForms.next();
            Map<String,String> paras = new HashMap<String,String>();
            paras.put("formuid", newBiForm.getUid());
            paras.put("linkformuid", linkForm.getObjUid());
            boFormLink.getDInsertService().invokeUpdate(paras);
        }
       
       
      }
      t.end();
    } catch (Exception e) {
      t.rollback();
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return DEFAULT_FORWARD;
View Full Code Here

    BOInstance appShare = bo.getCorrInstance();

    DOService insertInstallRecord = DOService
        .getService("multi_appshareinstall_install");

    Transaction t = insertInstallRecord.currentTransaction();
    t.begin();

    try {
      TenancyValues tv = (TenancyValues) DOGlobals.getInstance()
          .getSessoinContext().getTenancyValues();
     
      if(tv.getTenant().getUid().equals(appShare.getValue("auth_tenant_id"))){
        this.setEchoValue(I18n.instance().get("应用已经存在!"));

        return this.NO_FORWARD;
      }

      Map paras = new HashMap();
      paras.put("use_tenant_id", tv.getTenant().getUid());
      paras.put("use_tenant_name", tv.getTenant().getValue("l10n"));
      insertInstallRecord.invokeUpdate(paras);

      URL url = DODataSource.class.getResource("/globals.xml");
      String s = url.getPath();
      String s2 = s;
      s = s.substring(0, s2.toLowerCase().indexOf("web-inf"));

      StringBuffer fileName = new StringBuffer(s).append("appshare/")
          .append(appShare.getValue("xml_path"));

      DOImport imp = new DOImport();
      imp.importXml("", fileName.toString());
    } catch (Exception e) {

      t.rollback();
      // TODO Auto-generated catch block
      e.printStackTrace();
    } finally {
      t.end();
    }
    this.setEchoValue(I18n.instance().get("安装成功"));

    return DEFAULT_FORWARD;
View Full Code Here

    if (this.service == null ) {
      this.setEchoValue(I18n.instance().get("没有定义服务!"));
      return NO_FORWARD;
    }

    Transaction t = this.service.currentTransaction();
    try {
      t.begin();
      DOBO boService = DOBO.getDOBOByName("do_service");
      BOInstance biService = boService.getCorrInstance();
      BOInstance paras = new BOInstance();
      paras.putValue("serviceUid", biService.getUid());
      paras.putValue("onlyRun", "1");
      paras.putValue("condition", "true");
      paras.putValue("conditionType", "1");//1 代表script
      paras.putValue("name", "Rule_" + biService.getValue("name"));
      paras.putValue("l10n", "Rule_" + biService.getValue("l10n"));
      paras.putValue("salience", "5");
      paras.putValue("bouid", biService.getValue("bouid"));
      this.service.invokeUpdate(paras);
      t.end();
    } catch (Exception e) {
      t.rollback();
      e.printStackTrace();
    }
    this.setEchoValue(I18n.instance().get("成功生成规则!"));
    return DEFAULT_FORWARD;
View Full Code Here

  public static BOInstance copyService(BOInstance biService, DOService dos) {

    DOService thisService = DOService.getService("DO_Service_COPYDEEP");

    Transaction t = thisService.currentTransaction();
    try {
      t.begin();
      DOBO boServicePara = DOBO.getDOBOByName("DO_Parameter_Service");
      DOBO boServiceRule = DOBO.getDOBOByName("DO_Service_Rule");
      biService.setUid(null);
      biService.putValue("name", biService.getValue("name") + "_copy");
      biService.putValue("l10n", biService.getValue("l10n") + "_copy");
      BOInstance biNewService = thisService.invokeUpdate(biService);

      for (Iterator<DOParameterService> it = dos
          .retrieveParaServiceLinks().iterator(); it.hasNext();) {
        DOParameterService dps = it.next();
        BOInstance bi = boServicePara.getInstance(dps.getObjUid());
        bi.setUid(null);
        boServicePara.getDInsertService().invokeUpdate(bi);
      }
      for (Iterator<DOServiceRule> it = dos.retrieveServiceRules()
          .iterator(); it.hasNext();) {
        DOServiceRule dsr = it.next();
        BOInstance bi = boServiceRule.getInstance(dsr.getObjUid());
        bi.setUid(null);
        boServiceRule.getDInsertService().invokeUpdate(bi);
      }
      t.end();
      return biNewService;
    } catch (Exception e) {
      t.rollback();
      e.printStackTrace();
      return null;
    }
  }
View Full Code Here

      this.setEchoValue(I18n.instance().get("未配置SQL 语句"));

      return NO_FORWARD;
    }

    Transaction t = this.service.currentTransaction();
    try {
      t.begin();

      // 数据源ID
      String datasourceuid = this.actionForm.getValue("datasourceuid");
      // 业务包UID
      String bpuid = this.actionForm.getValue("bpuid");

      String fileName = this.actionForm.getValue("fileName");

      if (fileName == null) {
        this.setEchoValue(I18n.instance().get("你还没有选择文件!"));

        return NO_FORWARD;
      }

      fileName = DOGlobals.UPLOAD_TEMP.trim()
           + "/" + fileName.trim();
      System.out.println("FileName::" + fileName);
      try {
        Document doc = DOMXmlUtil.getInstance().getDocument(fileName);

        DOService doboInsert = DOService.getService("DO_BO_Insert");

        DOService parameterInsert = DOService
            .getService("DO_Parameter_copy");

        DOService propertyInsert = DOService
            .getService("DO_BO_Property_copy");

        DOService doRuleInsert = DOService.getService("DO_Rule_Insert");

        DOService serviceInsert = DOService
            .getService("DO_Service_copy");

        DOService serviceRuleInsert = DOService
            .getService("DO_Service_Rule_Insert");

        DOService paraServiceInsert = DOService
            .getService("DO_Parameter_Service_Copy_Batch");

        DOService paneLinksInsert = DOService
            .getService("DO_UI_PaneLinks_copy");

        DOService formInsert = DOService
            .getService("DO_UI_FormModel_COPY_TO_GRID");

        DOService formTargetInsert = DOService
            .getService("DO_UI_FormTargets_Insert");

        DOService formLinksInsert = DOService
            .getService("DO_UI_FormLinks_Insert");

        DOService gridInsert = DOService
            .getService("DO_UI_GridModel_Insert");

        DOService paneModelInsert = DOService
            .getService("DO_UI_PaneModel_copy");

        DOService treeModelInsert = DOService
            .getService("DO_UI_TreeModel_Insert");

        DOService menuModelInsert = DOService
            .getService("DO_UI_MenuModel_copy");

       
        DOService controllerInsert = DOService
        .getService("DO_UI_Controller_Insert");

         
        DOService actionInsert = DOService
        .getService("DO_ActionConfig_Insert");

       
        NodeList children = doc.getDocumentElement().getChildNodes();

        for (int i = 0; i < children.getLength(); i++) {
          Node aNode = children.item(i);
          if (aNode instanceof Element) {

            if (aNode.getNodeName().equals("bo")) {

              NodeList lis = aNode.getChildNodes();
              for (int lii = 0; lii < lis.getLength(); lii++) {
                Node aLi = lis.item(lii);
                if (aNode instanceof Element) {
                  String aJson = aNode.getFirstChild()
                      .getNodeValue();
                  BOInstance bi = BOInstance
                      .fromJSONString(aJson);

                  DOBO bo = DOBO.getDOBOByName("do_bo");
                  BOInstance exists = bo.getInstance(bi
                      .getValue("objuid"));
                  if (exists != null) {
                    log.info("待导入的业务对象已经存在,请删除后再导入!"
                        + exists);
                    this.setEchoValue(I18n.instance().get("待导入的业务对象已经存在,请删除后再导入!"));

                    return NO_FORWARD;
                  }
                  bi.putValue("datasourceuid", datasourceuid);
                  bi.putValue("bpuid", bpuid);
                  doboInsert.invokeUpdate(bi);
                }
              }
            } else if (aNode.getNodeName().equals("property")) {
              insertANode(propertyInsert, aNode);
            } else if (aNode.getNodeName().equals("parameter")) {
              insertANode(parameterInsert, aNode);
            } else if (aNode.getNodeName().equals("rule")) {
              insertANode(doRuleInsert, aNode);
            } else if (aNode.getNodeName().equals("service")) {
              insertANode(serviceInsert, aNode);
            } else if (aNode.getNodeName().equals(
                "parameter_service")) {
              insertANode(paraServiceInsert, aNode);
            } else if (aNode.getNodeName().equals("rule_service")) {
              insertANode(serviceRuleInsert, aNode);
            } else if (aNode.getNodeName().equals("pane")) {
              insertANode(paneModelInsert, aNode);
            } else if (aNode.getNodeName().equals("pane_links")) {
              insertANode(paneLinksInsert, aNode);
            } else if (aNode.getNodeName().equals("grid")) {
              insertANode(gridInsert, aNode);
            } else if (aNode.getNodeName().equals("form")) {
              insertANode(formInsert, aNode);
            } else if (aNode.getNodeName().equals("form_relation")) {
              insertANode(formLinksInsert, aNode);
            } else if (aNode.getNodeName().equals("form_target")) {
              insertANode(formTargetInsert, aNode);
            } else if (aNode.getNodeName().equals("menu")) {
              insertANode(menuModelInsert, aNode);
            } else if (aNode.getNodeName().equals("tree")) {
              insertANode(treeModelInsert, aNode);
            } else if (aNode.getNodeName().equals("controller")) {
              insertANode(controllerInsert, aNode);
            } else if (aNode.getNodeName().equals("action")) {
              insertANode(actionInsert, aNode);
            }
          }
        }

      } catch (Exception e) {
        e.printStackTrace();
      }
      this.setEchoValue(I18n.instance().get("翻译完成!"));

      t.end();
    } catch (Exception e) {
      t.rollback();
      e.printStackTrace();
    }

    this.setEchoValue(I18n.instance().get("导入成功!"));
View Full Code Here

  public void geneConfig() {

   
    DODataSource dss = DODataSource.parseGlobals();
    Transaction t = dss.getTransaction();
   
 

    // ///////////////////second generator grid and panes
    try {
      t.begin();
      List sers = DAOUtil.INSTANCE().select(DOService.class, SQL_SELECT_SERVICE,this.geneATable);

      /**
       * 根据Service生成ui组件。
       */
     
      String list = "信息列表";
      String browse = "浏览信息";
      String modify = "修改信息";
      String copy = "复制";
      String insert = "新增数据";
     
      if("en".equals(DOGlobals.getValue("lang.local"))){
        list = "Information List";
        browse = "Browse Information";
        modify = "Modify";
        copy = "Copy";
        insert = "New";
      }

      DOService aService = DOService.getService(geneATable + "_list");
      genePaneAndGrid( aService, gridList, geneATable + "_list",list);
     
      aService = DOService.getService(geneATable + "_browse");
     
      genePaneAndGrid( aService, gridSupportMore,  geneATable + "_browse",browse);
      genePaneAndGrid( aService, gridSupportMore,   geneATable + "_update",modify);
      genePaneAndGrid( aService, gridSupportMore,   geneATable + "_dulplicate",copy);
      genePaneAndGrid( aService, gridSupportMore, geneATable +  "_insert",insert);



    } catch (Exception e) {
      t.rollback();
      e.printStackTrace();
    } finally {
      t.end();
    }
  }
View Full Code Here

TOP

Related Classes of com.exedosoft.plat.Transaction

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.