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

📄 conecurvesolidman.java

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

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

/**
 * <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 ConeCurveSolidMan
    implements Manager {

  TransSession session;
  rootMaker rm;

  public ConeCurveSolidMan(TransSession session) {
    this.session = session;
    rm = (rootMaker) session.findRoot("Maker");
  }

  //增加一个体
  public Solid create() {
    try {
    //  rm = (rootMaker) session.findRoot("Maker");
      //开始一个和数据库的Session
      rm.addConeCurveSolidNum();
      //产生一个新的root;
      String root = rm.ConeCurveSolidrootMaker();
      System.out.println("the root of the newly created Cone is :    " + root);
      ConeCurveSolid coneCurveSolid = new ConeCurveSolid();
      coneCurveSolid.setName(root);
      //持久化
      session.makeRoot(root, coneCurveSolid);
      session.commit();
      //返回该对象的基类;
      return coneCurveSolid;
    }
    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 {
      ConeCurveSolid coneCurveSolid = (ConeCurveSolid) session.findRoot(
          root);
      //删除一个长方体
      VEnumeration result;
     RequireMan requireMan =new RequireMan(session );
     result=requireMan.deepSelect( root,"Cone" );
     while (result.hasMoreElements()) {
       session.deleteObject(result.nextElement());
    }

      // session.deleteObject(coneCurveSolid);
      //删除这个长方体对应的root
      session.deleteRoot(root);
      //相应的rootmaker的值减少一;
      rm.delConeCurveSolidNum();
      session.commit();
      System.out.println("delete a ConeCurveSolid with name  " + root);
    }
    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;
      }
    }
  }

  //查询一个体对象
  public Solid findByRoot(String root) {

  try{
    ConeCurveSolid coneCurveSolid = (ConeCurveSolid) session.findRoot(
        root);
    session.commit();
    return coneCurveSolid;
  }
  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 + -