📄 spherecurvesolidman.java
字号:
package operation;
import brgeometry.*;
import java.util.*;
import com.versant.fund.*;
import com.versant.trans.*;
import helper.ProBag;
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 not attributable
* @version 1.0
*/
public class SphereCurveSolidMan
implements Manager {
TransSession session;
rootMaker rm;
public SphereCurveSolidMan(TransSession session) {
this.session = session;
rm = (rootMaker) session.findRoot("Maker");
}
public Solid create() {
try {
// rm = (rootMaker) session.findRoot("Maker");
//开始一个和数据库的Session
rm.addSphereCurveSolidNum();
//产生一个新的root;
String root = rm.SphereCurveSolidrootMaker();
System.out.println("the root of the newly created Sphere is : " + root);
SphereCurveSolid sphereCurveSolid = new SphereCurveSolid();
sphereCurveSolid.setName(root);
//持久化
session.makeRoot(root, sphereCurveSolid);
session.commit();
//返回该对象的基类;
return sphereCurveSolid;
}
catch (VException exception) {
session.endSession();
//rootMaker 新产生的root与数据库中已经有的root重复
if (exception.getErrno() == Constants.EVJ_ROOTNAME_ALREADY_DEFINED)
System.out.println("Root name already exists");
//rootMaker不存在
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 {
SphereCurveSolid sphereCurveSolid = (SphereCurveSolid) session.findRoot(
root);
session.deleteObject(sphereCurveSolid);
VEnumeration result;
RequireMan requireMan =new RequireMan(session );
result=requireMan.deepSelect( root,"Sphere");
while (result.hasMoreElements()) {
session.deleteObject(result.nextElement());
}
//session.deleteRoot(root);
rm.delSphereCurveSolidNum();
session.commit();
System.out.println("delete a SphereCurveSolid with name " + root);
}
catch (VException exception) {
session.endSession();
int err = exception.getErrno();
if (err != Constants.EVJ_ROOTNAME_DOES_NOT_EXIST) {
throw exception;
}
}
}
public Solid findByRoot(String root) {
try {
SphereCurveSolid sphereCurveSolid = (SphereCurveSolid) session.findRoot(
root);
session.commit();
return sphereCurveSolid;
}
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 + -