⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cylindercurvesoildman.java

📁 基于面向对象的数据库编程
💻 JAVA
字号:
package operation;

import brgeometry.*;
import helper.ProBag;
import helper.rootMaker;
import com.versant.fund.*;
import com.versant.trans.*;
import java.util.*;

/**
 * <p>Title: Broundary Rrepresentaion</p>
 * <p>Description: this is the Use of OODB based Broundary Representaion</p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: USTC</p>
 * @author unascribed
 * @version 1.0
 */

public class CylinderCurveSoildMan
    implements Manager {

  TransSession session;
  rootMaker rm;

  public CylinderCurveSoildMan(TransSession session) {

    this.session = session;
    rm = (rootMaker) session.findRoot("Maker");
  }

  //增加一个体
  public Solid create() {
    try {
    //  rm = (rootMaker) session.findRoot("Maker");
      rm.addCylinderCurveSolidNum();
      String root = rm.CylinderCurveSolidrootMaker();
      System.out.println("the root of the newly created Cylinder is :    " +
                         root);
      CylinderCurveSolid cylinderCurveSolid = new CylinderCurveSolid();
      cylinderCurveSolid.setName(root);
      session.makeRoot(root, cylinderCurveSolid);
      session.commit();
      return cylinderCurveSolid;
    }
    catch (VException exception) {
      session.endSession();
      if (exception.getErrno() == Constants.EVJ_ROOTNAME_ALREADY_DEFINED)
        System.out.println("Root name already exists");
      if (exception.getErrno() == Constants.EVJ_ROOTNAME_DOES_NOT_EXIST) {
        System.out.println("rootname does not exist");
        rm = null;
      }
      else
        throw exception;
      return null;
    }

  }

  //删除一个体
  public void deleteByRoot(String root) {
    try {
      CylinderCurveSolid cylinderCurveSolid = (CylinderCurveSolid) session.
          findRoot(
          root);
      VEnumeration result;
     RequireMan requireMan =new RequireMan(session );

     result=requireMan.deepSelect( root ,"Cylinder");
     while (result.hasMoreElements()) {
       session.deleteObject(result.nextElement());
      }

      //session.deleteObject(cylinderCurveSolid);
      session.deleteRoot(root);
      rm.delCylinderCurveSolidNum();
      session.commit();
      System.out.println("delete a CylinderCurveSolid with name  " + root);
    }
    catch (VException exception) {
      session.endSession();
      int err = exception.getErrno();
      if (err != Constants.EVJ_ROOTNAME_DOES_NOT_EXIST) {
        throw exception;
      }
    }
  };

  //修改一个体
  public void modifyByRoot(String root, ProBag probag) {};

  //查询一个体对象

  public Solid findByRoot(String root) {
    try{
    CylinderCurveSolid cylinderCurveSolid = (CylinderCurveSolid) session.
        findRoot(
        root);
    session.commit();
    return cylinderCurveSolid;
  }
  catch (VException exception) {
  // session.endSession();
  // Ignore error if root name does not exist
  int err = exception.getErrno();
  if (err != Constants.EVJ_ROOTNAME_DOES_NOT_EXIST) {
    throw exception;
  }
 }
  return null;
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -