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

📄 addbom.java

📁 Agile PLM公司的二次开发例子。 测试程序也就是二次开发例子。希望大家有用。里面有webservice的调用方法
💻 JAVA
字号:
/**
 * @Date: 2004-12-10
 * @Author: jiadongz
 * @E-mail: jiadong.zhu@agile.com
 */
 
package wsx.agile.com;

import java.io.InputStream;
import java.util.*;

import com.agile.api.*;

public class AddBOM {
    
    private AgileSessionFactory factory = null;
    private IAgileSession session = null;
    private final String USER = "admin";
    private final String PWD = "agile";
    
    public
    AddBOM() {}

    
    private void init() throws Exception {
        try{
            factory = AgileSessionFactory.getInstance(null);
            HashMap map = new HashMap();
            map.put(AgileSessionFactory.USERNAME, USER);
            map.put(AgileSessionFactory.PASSWORD, PWD);
            session = factory.createSession(null);
        }catch(APIException e){
            System.out.println(e.getMessage());
        }
    }///:~ init() Ends
    
    public void addBOM(String number) throws Exception {
        try{
            init();
            IDataObject object = (IDataObject) session.getObject(IItem.OBJECT_TYPE, number);
            String num = getPropertyValue("ZJD") + System.currentTimeMillis();
            IItem doc = (IItem) session.createObject(ItemConstants.CLASS_DOCUMENT, num);
            ITable table = object.getTable(ItemConstants.TABLE_BOM);
            IRow row = table.createRow(doc);
        }finally{
            if(session.isOpen()){
                //session.close();
            }
        }
        
    }///:~ addBOM() Ends
    
    private String getPropertyValue(String key) throws Exception {
        String prefix = "";
        try{
            //	load property	//
            Properties property = new Properties();
            InputStream in = this.getClass().getResourceAsStream("file/number.properties");
            property.load(in);
            in.close();
            //	get the value from the key	//
            prefix = property.getProperty(key); 
        }catch(Exception e){
            e.printStackTrace();
            System.out.println("Prefix is : " + prefix);
            return prefix;
        }
        System.out.println("Prefix is : " + prefix);
        return prefix;
        
    }///:~ getPropertyValue() Ends
   

}///:~ AddBOM Ends

⌨️ 快捷键说明

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