IBM Connections Profiles 提供一组默认属性,您可以使用它们查找您的组织中的其他用户。这些属性允许用户输入与他们的职位、地理位置、背景等相关的信息。
有些组织可能会认为这组核心属性已经够用。而另外一些组织则需要提供更多的属性,让用户可以提供与他们以及组织相关的信息。
在本文中,您将学习如何添加用于存储 Twitter 和 LinkedIn 帐户的新属性,以便其他员工可以在这些站点上彼此关注和联系。
在使用 IBM Connections 时,第一步是启动 IBM WebSphere® 管理脚本工具 (wsadmin) 客户端,并检查所需的配置文件。这样您就可以在所有配置更改生效之前验证它们。请执行以下步骤:
- 在已安装了 Deployment Manager 的系统上,从以下目录启动
wsadmin客户端:D:\<WAS_ROOT>\profiles\Dmgr01\bin>wsadmin.bat -lang jython -user wasadmin -password yourpassword
- 启动 Profiles Jython 脚本解释器:
wsadmin>execfile("profilesAdmin.py")
- 签出 Profiles 配置文件:
wsadmin> ProfilesConfigService.checkOutConfig("d:/temp", "CONNECT02Cell01")
- 创建 Profiles 配置文件的安全副本
profiles-config.xml,如 图 1 所示,并将它保存在便于访问的地方,以防止您无法重新签入修改后的文件。
图 1. 签出 Profiles 配置文件
- 打开
profile-config.xml,并在profileExtensionAttributes代码小节的末尾处添加以下代码行。这些代码行声明了新的扩展属性和它们的长度。
<profileExtensionAttributes> ... <simpleAttribute extensionId="twitterid" length="40" <simpleAttribute extensionId="linkedinid" length="40" </profileExtensionAttributes>
- 在
contactInformation代码小节内添加以下代码行。此处添加的代码行定义了将在哪里显示新的扩展属性。
<profileLayout profileType="default"> <jobInformation> ... </jobInformation> <contactInformation> ... <extensionAttribute showLabel="false" editable="true" extensionIdRef="twitterid" <extensionAttribute showLabel="false" editable="true" extensionIdRef="linkedinid" ... </contactInformation> ... </layoutConfiguration>
- 保存并关闭该文件,然后重新签入它:
wsadmin>ProfilesConfigService.checkInConfig()
如果您对
profiles-config.xml文件所做的更改是正确的,那么您应该看到类似于下面的结果:Using configuration arguments : workingDirectory: d:/temp cellName: CONNECT02Cell01 nodeName: None serverName: None Loading schema file for validation: /d:/temp/profiles-config.xsd d:/temp/profiles-config.xml is valid Profiles configuration file successfully checked in
- 退出
wsadmin客户端(可选):wsadmin>exit
- 重新启动 Profiles 应用程序(参见 图 2):
- 打开 WebSphere Integrated Solutions Console (ISC)。
- 单击 Applications > Application Types > WebSphere enterprise applications。
- 选择 Profiles,然后停止并启动应用程序。
图 2. 重新启动 Profiles 应用程序
如 图 3 所示,您现在应该看到两个新的扩展属性被添加到 Profiles 页面。
图 3. 新的扩展属性
现在已添加好新的自定义属性,您需要定义在属性旁边出现的标签。为此,请执行以下步骤:
- 在已安装了 Deployment Manager 的系统上,从以下目录启动
wsadmin客户端:D:\<WAS_ROOT>\profiles\Dmgr01\bin>wsadmin.bat -lang jython -user wasadmin -password yourpassword
- 启动 Profiles Jython 脚本解释器:
wsadmin>execfile("profilesAdmin.py")
- 签出 Profiles 配置文件:
wsadmin> ProfilesConfigService.checkOutConfig("d:/temp", "CONNECT02Cell01")
- 打开
profiles-config.xml,将showLabel更改为 True,并更改labelKey属性:<extensionAttribute showLabel="true" editable="true" labelKey="label.custom.twitterid" extensionIdRef="twitterid" bundleIdRef="custom" /> <extensionAttribute showLabel="true" editable="true" labelKey="label.custom.linkedinid" extensionIdRef="linkedinid" bundleIdRef="custom" />
- 保存
profiles-config.xml,然后签入该文件:wsadmin>ProfilesConfigService.checkInConfig()
现在,将资源包添加到 IBM Connections 配置文件中。此外,还必须签出 IBM Connections 配置文件
LotusConnection-config.xml:
- 启动 IBM Connections Jython 脚本解释器:
wsadmin>execfile("connectionsConfig.py")
- 签出 IBM Connections 配置文件:
wsadmin>LCConfigService.checkOutConfig("d:/temp","CONNECT02Cell01")
- 打开
LotusConnections-config.xml,并添加以下代码行(以粗体显示):<config buildlevel="LC3.0.1_20110317_1228" id="LotusConnections"... ... <resources> <widgetBundle prefix="custom" name="label.custom.resources"/> </resources> <config>
- 签入
LotusConnections-config.xml:wsadmin>LCConfigService.checkInConfig()
- 在
customization\strings目录下创建一个名称为label.custom.resources.properties的文件,然后添加以下代码行:label.custom.twitterid=Twitter label.custom.linkedinid=LinkedIn URL
- 重新启动 IBM Connections 服务器。
现在,您应该能够在扩展属性旁边看到正确的标签,如 图 4 所示。
图 4. 自定义标签
当添加扩展属性时,您可以使用其他属性(如 表 1 所示)来实现一个更高水平的定制。有关这些属性以及如何在验证过程中添加所需扩展属性的更多信息,请参阅 参考资料。
表 1. 扩展属性的属性
| 属性 | 详细信息 |
|---|---|
editable | 指定用户是否可以编辑扩展属性。该属性使用布尔值。 |
showLabel | 指定是否要在用户界面 (UI) 显示扩展属性的标签。该属性使用布尔值。 |
hideIfEmpty | 指定在没有设定属性值时是否隐藏属性。该属性使用布尔值。 |
link | 该属性使用布尔值。 |
prependHtml | 指定值的 HTML 代码前缀。该属性使用字符串值。 |
appendHtml | 指定追加给值的 HTML 代码。该属性使用字符串值。 |
您已经添加了扩展属性,现在,要让它们成为可搜索的属性。这个过程允许用户对新的属性进行搜索。无论存储在其中的信息是否相关,您都可以根据其使用频率添加或删除属性。图 5 显示了默认的 Profiles Search 页面。
图 5. 默认的搜索页面
在该节中,您需要进行以下更改:
- 包括您之前添加的 Twitter
Id属性。 - 删除
City、State、Country和Phone Number属性。
要进行这些更改,去哪个执行以下步骤:
- 在已安装了 Deployment Manager 的系统上,从以下目录启动
wsadmin客户端。D:\<WAS_ROOT>\profiles\Dmgr01\bin>wsadmin.bat -lang jython -user wasadmin -password yourpassword
- 启动 Profiles Jython 脚本解释器:
wsadmin>execfile("profilesAdmin.py")
- 签出 Profiles 配置文件:
wsadmin> ProfilesConfigService.checkOutConfig("d:/temp", "CONNECT02Cell01")
- 打开
profiles-config.xml并找到searchLayout代码小节。添加以粗体显示的更改:<searchLayout> <attribute showLabel="true">displayName</attribute> <attribute showLabel="false">preferredFirstName</attribute> <attribute showLabel="false">preferredLastName</attribute> <attribute showLabel="true">profileTags</attribute> <attribute showLabel="true">jobResp</attribute> <attribute showLabel="false">experience</attribute> <attribute showLabel="false">background</attribute> <attribute showLabel="true">organizationTitle</attribute> <extensionAttribute showLabel="true" labelKey="label.custom.twitterid" bundleIdRef="custom" extensionIdRef=" twitterid" /> <!--<attribute showLabel="false">workLocation.city</attribute> --> <!--<attribute showLabel="false">workLocation.state</attribute> --> <!--<attribute showLabel="false">countryDisplayValue</attribute> --> <attribute showLabel="false">email</attribute> <!--<attribute showLabel="false">telephoneNumber</attribute> --> </searchLayout>
- 保存并签入
profiles-config.xml配置文件。wsadmin>LCConfigService.checkInConfig()
- 重新启动 Profiles 应用程序。
图 6 显示了包含最终更改的搜索页面。
图 6. 更改后的默认搜索页
IBM 建议缓存静态的设计元素(如级联样式表文件和脚本),以提高性能。所以,您必须在完成与 UI 相关的更改后更新 IBM Connections 部署的版本戳。如果不执行此步骤,则要求用户删除其浏览器缓存,这对于某些组织而言可能是一件痛苦的事情。
每当改变颜色和主题、更改标签、添加或删除扩展属性时,都应该缓存设计元素。缓存过程相当简单,只需签出 LotusConnections.xml 配置文件并更新时间戳:
- 在已安装了 Deployment Manager 的系统上,从以下目录启动
wsadmin客户端:D:\<WAS_ROOT>\profiles\Dmgr01\bin>wsadmin.bat -lang jython -user wasadmin -password yourpassword
- 启动 IBM Connections Jython 脚本解释器:
wsadmin>execfile("connectionsConfig.py")
- 签出 IBM Connections 配置文件:
wsadmin>LCConfigService.checkOutConfig("d:/temp","CONNECT02Cell01")
- 更新
versionStamp属性的值:LCConfigService.updateConfig("versionStamp","")
- 签入
LotusConnections-config.xml:wsadmin>LCConfigService.checkInConfig()
此时,您应该已经准备好开始执行您的 Profiles 实现。本文指导您完成了所有必要步骤,以扩展您的 Profiles 部署并包括(或删除)让您的环境对组织更有用、更合适的所有属性。本文还介绍了定制 Profiles Search 页面的过程,这将帮助您的用户充分利用新的扩展属性。最后并且重要的一点是,您学习了在没有用户干预的情况下如何在所有用户的计算机上刷新 UI 所需的其他操作。
学习
-
查看 IBM
Connections 页面。
-
阅读 IBM Redbook,
Customizing
IBM Connections 3.0.1,了解有关定制的更多信息。
-
学习如何 为 Profiles 启用自定义的扩展属性。
-
了解有关 指定必填字段 的更多信息。
-
在 IBM
Connections 产品文档 页面上查找技术信息。
-
在 Lotus
Greenhouse 上试用 IBM Connections。
获得产品和技术
讨论
-
加入 IBM Connections
论坛。
-
订阅 IBM Social Software
博客。
-
加入 My
developerWorks 社区。探索由开发人员推动的博客、论坛、组和维基,并与其他 developerWorks 用户进行交流。
Luis Guirigay 是一名高级 IT 架构师,专长从事管理、高可用性/灾难恢复、性能调优和支持。他使用 IBM 产品已有超过 14 年的时间,这些产品几乎包括所有版本的 IBM Connections、WebSphere Portal、Domino、Sametime 和 Quickr 的 IBM Certified Administrator,他还是 Domino 和 IBM Lotus Workflow 的 IBM Certified Developer。他有丰富的 WebSphere Application Server、DB2、Tivoli 和 ILWWCM 方面的经验。Luis 已经出版了多本 Domino、Workplace、DB2 和 System i 相关的 IBM Redbooks,而且他还经常在 IamLug and Midwest Lotus User Group 会议、Lotusphere、Chicago Lotus User Group 以及美国多个 IBM PoT 和 IBM 研讨会上发表演讲。您可以通过 @Lguiriga 在 Twitter 上关注 Luis。