0

全部,

我将一个组添加为父组的子组,但它没有成为父组的成员。我必须进去手动设置。

有人知道这是如何工作的吗?

4

1 回答 1

2

我不得不玩它并在BOB 论坛上做一些研究,但我想通了,尽管它不直观。

我将假设您知道如何获取父组 IUserGroup 对象。

// get the plugin manager
IPluginMgr pluginMgr = store.getPluginMgr();
//  Retrieve the User plugin.
IPluginInfo groupPlugin = pluginMgr.getPluginInfo("CrystalEnterprise.UserGroup");
//  Create a new InfoObjects collection.
IInfoObjects newInfoObjects  = store.newInfoObjectCollection();
//  Add the User plugin to the collection.
newInfoObjects.add (groupPlugin);
//  Retrieve the newly created user object.
IUserGroup newUserGroup = (IUserGroup)newInfoObjects.get(0);

// build the new group
String newGroupName = "My Test Group"; 
newUserGroup.setTitle(newGroupName);
newUserGroup.setDescription("Just for sample test code");
store.commit(newInfoObjects);

// now that things commited associate the parent group
if(parentGroup != null)
{
  parentGroup.getSubGroups().add(new Integer(newUserGroup.getID()));
  store.commit(parGroupObjs);
}

最大的障碍是您希望只使用 setParentID() 方法。警告说这仅在 BO XI R2 下测试,而不是 R3,因此对于当前版本可能不是 100% 正确。

于 2010-03-05T21:03:54.970 回答