以下代码是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 文件呢?