查询对象的自定义类型WTTypeDefinition
2009-12-12 12:24
453 查看
import java.lang.reflect.InvocationTargetException;
import java.rmi.RemoteException;
import com.ptc.core.meta.type.mgmt.common.TypeDefinitionDefaultView;
import com.ptc.core.meta.type.mgmt.server.impl.WTTypeDefinition;
import wt.clients.prodmgmt.WTPartHelper;
import wt.epm.util.EPMSoftTypeServerUtilities;
import wt.fc.PersistenceHelper;
import wt.part.WTPart;
import wt.type.TypeDefinitionReference;
import wt.type.Typed;
import wt.util.WTException;
/**
*
* @author 云淡天晴
* @version 1.0
* 此例显示了如何获取一个对象的自定义类型
* 在这里我们以部件为例,当然方法有很多种,此方法只是在众多方法中较为简洁。
*
*/
public class TypeDemo implements wt.method.RemoteAccess{
/**
* 获取部件的自定义类型
* @param args
* @throws WTException
* @throws InvocationTargetException
* @throws RemoteException
*/
public static void main(String[] args) throws WTException, RemoteException, InvocationTargetException {
// TODO Auto-generated method stub
WTPart[] part=WTPartHelper.findPartByNumber("0000000021");
System.out.println(part[0]);
WTTypeDefinition definition=geTypeDefinition(part[0]);
System.out.println(definition.getDisplayNameKey());
}
/**
* 获取部件的自定义类型并且返回类型对象
* @param type 此type为WTPart,WTDocument等接口
* @return WTTypeDefinition
* @throws WTException
*/
public static WTTypeDefinition geTypeDefinition(Typed type) throws WTException
{
TypeDefinitionReference ref=type.getTypeDefinitionReference();
TypeDefinitionDefaultView view = EPMSoftTypeServerUtilities.getTypeDefinition(ref);
WTTypeDefinition definition = (WTTypeDefinition) PersistenceHelper.manager.refresh(view.getObjectID());
return definition;
}
}
import java.rmi.RemoteException;
import com.ptc.core.meta.type.mgmt.common.TypeDefinitionDefaultView;
import com.ptc.core.meta.type.mgmt.server.impl.WTTypeDefinition;
import wt.clients.prodmgmt.WTPartHelper;
import wt.epm.util.EPMSoftTypeServerUtilities;
import wt.fc.PersistenceHelper;
import wt.part.WTPart;
import wt.type.TypeDefinitionReference;
import wt.type.Typed;
import wt.util.WTException;
/**
*
* @author 云淡天晴
* @version 1.0
* 此例显示了如何获取一个对象的自定义类型
* 在这里我们以部件为例,当然方法有很多种,此方法只是在众多方法中较为简洁。
*
*/
public class TypeDemo implements wt.method.RemoteAccess{
/**
* 获取部件的自定义类型
* @param args
* @throws WTException
* @throws InvocationTargetException
* @throws RemoteException
*/
public static void main(String[] args) throws WTException, RemoteException, InvocationTargetException {
// TODO Auto-generated method stub
WTPart[] part=WTPartHelper.findPartByNumber("0000000021");
System.out.println(part[0]);
WTTypeDefinition definition=geTypeDefinition(part[0]);
System.out.println(definition.getDisplayNameKey());
}
/**
* 获取部件的自定义类型并且返回类型对象
* @param type 此type为WTPart,WTDocument等接口
* @return WTTypeDefinition
* @throws WTException
*/
public static WTTypeDefinition geTypeDefinition(Typed type) throws WTException
{
TypeDefinitionReference ref=type.getTypeDefinitionReference();
TypeDefinitionDefaultView view = EPMSoftTypeServerUtilities.getTypeDefinition(ref);
WTTypeDefinition definition = (WTTypeDefinition) PersistenceHelper.manager.refresh(view.getObjectID());
return definition;
}
}
相关文章推荐
- 查询对象的自定义类型WTTypeDefinition
- find_if和函数对象结合实现对自定义类型vector的查找 复杂结构体查询某个值
- 动态指定任意类型的ObjectDataSource对象的查询参数
- golang自定义数据类型查询与插入postgresql中point数据
- oracle创建定时job,job调用存储过程,批量查询,批量修改,自定义数据类型,
- 自定义可绑定数据的业务对象实体和强类型-Part Four
- ORACLE 自定义类型 type/ object
- 集合对象与自定义javabean对象接收数据库查询的数据 (基础知识扫盲)
- 基本包装类型和自定义对象
- DTD(Document Type Definition文档类型定义)
- struts2自定义类型转换(1)基于DefaultTypeConverter
- Hibernate3原生SQL查询返回自定义类型时Integer类型的转换问题
- struts2自定义类型转换(2)基于StrutsTypeConverter
- 在hibernate中查询使用List,Map和类对象定制返回类型
- c++如何理解map对象的value_type是pair类型
- [翻译]如何使用LINQ方法来比较自定义类型的对象
- mybatis自定义类型处理器TypehHandler示例详解
- Hibernate对自定义类型UserType的用法
- java fastjson如何自定义转换含枚举类型对象(编程技巧)