2

以下代码是Opensource BIMserver的 Java 客户端的一部分。

JsonBimServerClientFactory factory = new JsonBimServerClientFactory("");
BimServerClient client = factory.create(new UsernamePasswordAuthenticationInfo("exple@dd.com", "poiuy"));
String randomName = "yu" + new Random().nextLong();

// Create a new project with a random name
SProject project = client.getServiceInterface().addProject(randomName, "ifc2x3tc1");
long poid = project.getOid();
String comment = "";

// This method is an easy way to find a compatible deserializer for the combination of
// the "ifc" file extension and this project. You can also get a specific deserializer
// if you want to.
SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", poid);

// Make sure you change this to a path to a local IFC file
String absolutePathOfFile = servletContext.getRealPath("/") + "resources/images/IFC/stickfile.ifc";

java.nio.file.Path demoIfcFile = Paths.get(absolutePathOfFile);
// Here we actually checkin the IFC file.

如果用户属于“管理员”类型但不适用于“用户”类型的用户,则上述代码可以很好地签入 IFC 文件。那么如何为没有管理员权限的用户签入 IFC 文件呢?

4

1 回答 1

0

“用户”类型的用户不能创建项目。如果您使用“Admin”类型的用户创建一个项目,则必须使用授予该项目的“User”类型用户权限

client.getServiceInterface().addUserToProject(userOid, projectOid)

代码很可能在addProject调用时就已经失败了。请确认堆栈跟踪和服务调用返回的错误消息。

于 2018-07-17T02:57:11.367 回答