All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bimface.sdk.service.BakeService Maven / Gradle / Ivy

The newest version!
package com.bimface.sdk.service;

import com.bimface.api.bean.response.databagDerivative.DatabagDerivativeBean;
import com.bimface.api.bean.response.databagDerivative.IntegrateDatabagDerivativeBean;
import com.bimface.api.bean.response.databagDerivative.TranslateDatabagDerivativeBean;
import com.bimface.exception.BimfaceException;
import com.bimface.sdk.bean.request.DatabagDerivativeRequest;
import com.bimface.sdk.bean.request.OfflineDatabagRequest;
import com.bimface.sdk.client.ApiClient;
import com.bimface.sdk.config.Config;
import com.bimface.sdk.config.Endpoint;
import com.bimface.sdk.utils.AssertUtils;

import java.util.List;
import java.util.Map;

/**
 * 烘焙相关
 */
public class BakeService {
    private ApiClient apiClient;
    private AccessTokenService accessTokenService;

    public BakeService(Endpoint endpoint, AccessTokenService accessTokenService) {
        this(endpoint, null, accessTokenService);
    }

    public BakeService(Endpoint endpoint, Config config, AccessTokenService accessTokenService) {
        this.apiClient = ApiClient.getApiClient(endpoint.getApiHost(), config);
        this.accessTokenService = accessTokenService;
    }

    /**
     * 为单文件创建bake数据包
     * @param fileId
     * @param callback
     * @param config
     * @return
     * @throws BimfaceException
     */
    public TranslateDatabagDerivativeBean createTranslateBakeDatabag(Long fileId, String callback, Map config) throws BimfaceException {
        AssertUtils.assertParameterNotNull(fileId, "fileId");
        DatabagDerivativeRequest databagDerivativeRequest = new DatabagDerivativeRequest();
        databagDerivativeRequest.setConfig(config);
        return apiClient.createTranslateBakeDatabag(fileId, callback,
            databagDerivativeRequest, accessTokenService.getAccessToken());
    }

    /**
     * 查询单文件bake数据包
     * @param fileId
     * @return
     * @throws BimfaceException
     */
    public List getTranslateBakeDatabags(Long fileId) throws BimfaceException {
        AssertUtils.assertParameterNotNull(fileId, "fileId");
        return apiClient.getTranslateBakeDatabags(fileId, accessTokenService.getAccessToken());
    }

    /**
     * 为集成模型创建bake数据包
     * @param integrateId
     * @param callback
     * @param config
     * @return
     * @throws BimfaceException
     */
    public IntegrateDatabagDerivativeBean createIntegrateBakeDatabag(Long integrateId, String callback, Map config) throws BimfaceException {
        AssertUtils.assertParameterNotNull(integrateId, "integrateId");
        DatabagDerivativeRequest databagDerivativeRequest = new DatabagDerivativeRequest();
        databagDerivativeRequest.setConfig(config);
        return apiClient.createIntegrateBakeDatabag(integrateId, callback,
                databagDerivativeRequest, accessTokenService.getAccessToken());
    }

    /**
     * 查询集成模型bake数据包
     * @param integrateId
     * @return
     * @throws BimfaceException
     */
    public List getIntegrateBakeDatabags(Long integrateId) throws BimfaceException {
        AssertUtils.assertParameterNotNull(integrateId, "integrateId");
        return apiClient.getIntegrateBakeDatabags(integrateId, accessTokenService.getAccessToken());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy