IBM bluepage API 查询

摘要: 在IBM 做项目,总是免不了要和 bluepage 打交道。IBM 的BLUEPAGE 是什么? 其实是 Tivoli LDAP. 简称TDS,类似于微软的AD 或者其他OPEN LDAP 等。这东西主要用来管理 组织架构,人员的信息的。如果在IBM混过的人,用过SAMETIME的都知道,可以直接看到人员的组织架构,其实就是通过bluepage 里的信息得到的。ibm 为了简单,自己封装了一个JAR包,作为提供给其他系统调用,也就是API.

在IBM 做项目,总是免不了要和 bluepage 打交道。IBM 的BLUEPAGE 是什么? 其实是 Tivoli LDAP. 简称TDS,类似于微软的AD 或者其他OPEN LDAP 等。

这东西主要用来管理 组织架构,人员的信息的。如果在IBM混过的人,用过SAMETIME的都知道,可以直接看到人员的组织架构,其实就是通过bluepage 里的信息得到的。

ibm 为了简单,自己封装了一个JAR包,作为提供给其他系统调用,也就是API.
大家可以搜索下 bpjtk-v ... 后面是版本了,看有没有新版本。一般来说,要IBM内网才可以直接调用,否则要特殊处理。

一个简单的API调用:

import java.util.Enumeration;
import java.util.Hashtable;

import com.ibm.bluepages.BPResults;
import com.ibm.bluepages.BluePages;

/**
 * DumpPerson displays all available information about a person 
 * specified by CNUM.
 * 
 * 

Syntax: java com.ibm.bluepages.samples.DumpPerson CNUM [-d] * [-u APILOCATORURL] * *

Example: java com.ibm.bluepages.samples.DumpPerson 091445897 *

Example: java com.ibm.bluepages.samples.DumpPerson 091445897 -u * http://bluepages.ibm.com/BpHttpApisv3/apilocator *

Example: java com.ibm.bluepages.samples.DumpPerson 091445897 -d -u * http://bluepages.ibm.com/BpHttpApisv3/apilocator * * * @version 3.0 - Created on January 22, 1999.Last updated on January * 6, 2009. * */ public class DumpPerson { public static void main(String args[]) { /* * Declarations. */ BPResults results; // Results of BluePages method Hashtable personRow; // One row of the person's results Hashtable miscRow; // One row of some other results Enumeration keys; // Keys in hashtable Enumeration values; // Values in hashtable String targetCnum; // CNUM to find /* * Check the arguments. */ if (args.length < 1) { System.err.println("Usage: java com.ibm.bluepages.samples.DumpPerson " + "CNUM [-u APILOCATORURL] [-d]"); return; } targetCnum = args[0]; // Check other arguments, if specified. for (int i = 1; i < args.length; i++) { if (args[i].equalsIgnoreCase("-u")) { // If specified, set API locator URL before calling BluePages functions. if (++i < args.length) { System.setProperty("bluepages.api.locator", args[i]); } } else if (args[i].equalsIgnoreCase("-d")) { // Turn on the debug.. System.setProperty("bluepages.debug", "true"); } } long now = System.currentTimeMillis(); /* * Call the method to retrieve the data from the persons table. */ results = BluePages.getPersonByCnum(targetCnum); /* * Make sure the method didn't fail unexpectedly. */ if (!results.succeeded()) { System.err.println("Error: " + results.getStatusMsg()); return; } /* * Make sure the person is found. */ if (results.rows() == 0) { System.err.println("Error: Unable to find person with CNUM " + targetCnum + "."); return; } /* * Display the person-related information. */ System.out.println("Person Information"); System.out.println("------------------"); personRow = results.getRow(0); for (keys = personRow.keys(), values = personRow.elements(); keys.hasMoreElements(); ) System.out.println((String) keys.nextElement() + ": " + (String) values.nextElement()); /* * Call the method to retrieve the data from the departments * table. */ miscRow = BluePages.getDeptData((String) personRow.get("DIV"), (String) personRow.get("DEPT")); /* * Display information about the department. */ System.out.println(); System.out.println("Department Information"); System.out.println("----------------------"); if (miscRow.size() == 0) { System.err.println("Unable to find department information."); } else { for (keys = miscRow.keys(), values = miscRow.elements(); keys.hasMoreElements(); ) System.out.println((String) keys.nextElement() + ": " + (String) values.nextElement()); } /* * Call the method to retrieve the data from the employee types * table. */ miscRow = BluePages.getEmployeeCode( (String) personRow.get("EMPTYPE")); /* * Display information about the employee type. */ System.out.println(); System.out.println("Employee Type Information"); System.out.println("-------------------------"); if (miscRow.size() == 0) { System.err.println("Unable to find employee type information."); } else { for (keys = miscRow.keys(), values = miscRow.elements(); keys.hasMoreElements(); ) System.out.println((String) keys.nextElement() + ": " + (String) values.nextElement()); } /* * Call the method to retrieve the data from the HR organization codes * table. */ miscRow = BluePages.getOrganizationCode( (String) personRow.get("ORGCODE")); /* * Display information about the organization code. */ System.out.println(); System.out.println("Organization Code Information"); System.out.println("-----------------------------"); if (miscRow.size() == 0) { System.err.println("Unable to find organization code information."); } else { for (keys = miscRow.keys(), values = miscRow.elements(); keys.hasMoreElements(); ) System.out.println((String) keys.nextElement() + ": " + (String) values.nextElement()); } /* * Call the method to retrieve the data from the work locations * table. */ miscRow = BluePages.getWorkLocation( (String) personRow.get("WORKLOC")); /* * Display information about the work location. */ System.out.println(); System.out.println("Work Location Information"); System.out.println("-------------------------"); if (miscRow.size() == 0) { System.err.println("Unable to find work location information."); } else { for (keys = miscRow.keys(), values = miscRow.elements(); keys.hasMoreElements(); ) System.out.println((String) keys.nextElement() + ": " + (String) values.nextElement()); } /* * Call the method to retrieve the data from the countries table. */ miscRow = BluePages.getCountryCode( (String) personRow.get("EMPCC")); /* * Display information about the country. */ System.out.println(); System.out.println("Country Information"); System.out.println("-------------------"); if (miscRow.size() == 0) { System.err.println("Unable to find country information."); } else { for (keys = miscRow.keys(), values = miscRow.elements(); keys.hasMoreElements(); ) System.out.println((String) keys.nextElement() + ": " + (String) values.nextElement()); } System.out.println("\nElapsed time= " + (System.currentTimeMillis() - now) + " ms."); } }

上一篇: Filenet Eform 转成 PDF 方法
下一篇: 苦B的程序员屌丝
 评论 ( What Do You Think )
名称
邮箱
网址
评论
验证
   
 

 


  • 微信公众号

  • 我的微信

站点声明:

1、一号门博客CMS,由Python, MySQL, Nginx, Wsgi 强力驱动

2、部分文章或者资源来源于互联网, 有时候很难判断是否侵权, 若有侵权, 请联系邮箱:summer@yihaomen.com, 同时欢迎大家注册用户,主动发布无版权争议的 文章/资源.

3、鄂ICP备14001754号-3, 鄂公网安备 42280202422812号