yuxc
2024-06-04 93f7335e1a52591662d5d37f41ac352860b2ca2a
Source/platformProject/vci-platform-web/src/main/java/com/vci/web/util/PlatformClientUtil.java
@@ -1,34 +1,20 @@
package com.vci.web.util;
import com.vci.corba.logon.method.LogonFactory;
import com.vci.corba.logon.method.LogonFactoryHelper;
import com.vci.corba.volumn.method.VolumnFactory;
import com.vci.corba.volumn.method.VolumnFactoryHelper;
import com.vci.starter.corba.connector.JacorbClientConnector;
import com.vci.starter.web.exception.VciBaseException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.vci.client.common.providers.ServiceProvider;
import com.vci.corba.bofactory.BOFactoryServicePrx;
import com.vci.corba.common.PLException;
import com.vci.corba.omd.atm.AttPoolServicePrx;
import com.vci.corba.omd.btm.BTMServicePrx;
import com.vci.corba.omd.etm.EnumServicePrx;
import com.vci.corba.omd.lcm.LifeCycleServicePrx;
import com.vci.corba.omd.ltm.LinkTypeServicePrx;
import com.vci.corba.omd.stm.StatePoolServicePrx;
import com.vci.corba.omd.vrm.VersionRuleServicePrx;
import com.vci.corba.portal.PortalServicePrx;
import com.vci.corba.query.ObjectQueryServicePrx;
import com.vci.corba.volume.VolumeServicePrx;
import com.vci.corba.workflow.WorkflowServicePrx;
import org.springframework.stereotype.Component;
import plm.bs.bom.common.BOFactoryService;
import plm.bs.bom.common.BOFactoryServiceHelper;
import plm.corba.attribpool.AttPoolServiceHelper;
import plm.corba.attribpool.AttPoolServiceOperations;
import plm.corba.btm.BTMServiceHelper;
import plm.corba.btm.BTMServiceOperations;
import plm.corba.enumManager.EnumServiceHelper;
import plm.corba.enumManager.EnumServiceOperations;
import plm.corba.lifecycle.LifeCyleServiceHelper;
import plm.corba.lifecycle.LifeCyleServiceOperations;
import plm.corba.linkTypeManager.LinkTypeServiceHelper;
import plm.corba.linkTypeManager.LinkTypeServiceOperations;
import plm.corba.portal.PortalServiceHelper;
import plm.corba.portal.PortalServiceOperations;
import plm.corba.qt.QTServiceHelper;
import plm.corba.qt.QTServiceOperations;
import plm.corba.statePoolManager.StatePoolServiceHelper;
import plm.corba.statePoolManager.StatePoolServiceOperations;
import plm.corba.versionRuleManager.VersionRuleServiceHelper;
import plm.corba.versionRuleManager.VersionRuleServiceOperations;
/**
 * 平台的客户端调用工具类
@@ -91,115 +77,110 @@
     */
    private static final String QUERY_SERVICE_NAME = "qtService";
    /**
    * corba的客户端调用
    */
    @Autowired
    private JacorbClientConnector jacorbClientConnector;
    /**
     * 获取业务类型工厂的服务
     * @return 服务的对象
     */
    public BOFactoryService getBOFactoryService(){
       return BOFactoryServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(BO_FACTORY_SERVICE_NAME));
    }
    public BOFactoryServicePrx getBOFactoryService(){
        return ServiceProvider.getBOFService();
   }
    /**
     * 获取登录主服务
     * @return 服务的对象
     */
    public LogonFactory getLogonFactoryService(){
        return LogonFactoryHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(LOGON_FACTORY_SERVICE_NAME));
    }
    public WorkflowServicePrx getLogonFactoryService(){
        return ServiceProvider.getWFService();
  }
    /**
     * 获取状态池的服务
     * @return 服务的对象
     */
    public StatePoolServiceOperations getStatePoolService(){
        return StatePoolServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(STATE_POOL_SERVICE_NAME));
    }
    public StatePoolServicePrx getStatePoolService() throws PLException {
        return ServiceProvider.getOMDService().getStateService();
   }
    /**
     * 获取生命周期的服务
     * @return 生命周期的服务对象
     */
    public LifeCyleServiceOperations getLifeCycleService(){
        return LifeCyleServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(LIFE_CYCLE_SERVICE_NAME));
    }
    public LifeCycleServicePrx getLifeCycleService() throws PLException {
        return ServiceProvider.getOMDService().getLifeCycleService();
}
    /**
     * 获取枚举的服务
     * @return 枚举的服务对象
     */
    public EnumServiceOperations getEnumService(){
        return EnumServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(ENUM_SERVICE_NAME));
    public EnumServicePrx getEnumService() throws PLException {
        return ServiceProvider.getOMDService().getEnumService();
//        return EnumServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(ENUM_SERVICE_NAME));
    }
    /**
     * 获取版本规则的服务
     * @return 版本规则的服务
     */
    public VersionRuleServiceOperations getVersionService(){
        return VersionRuleServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(VERSION_SERVICE_NAME));
    public VersionRuleServicePrx getVersionService() throws PLException {
        return ServiceProvider.getOMDService().getVerRuleService();
//        return VersionRuleServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(VERSION_SERVICE_NAME));
    }
    /**
     * 属性服务
     * @return 服务的对象
     */
    public AttPoolServiceOperations getAttributeService(){
        return AttPoolServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(ATTRIBUTE_SERVICE_NAME));
    public AttPoolServicePrx getAttributeService() throws PLException {
        return ServiceProvider.getOMDService().getAttributeService();
//        return AttPoolServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(ATTRIBUTE_SERVICE_NAME));
    }
    /**
     * 获取业务类型
     * @return 服务的对象
     */
    public BTMServiceOperations getBtmService(){
        return BTMServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(BTM_SERVICE_NAME));
    public BTMServicePrx getBtmService() throws PLException {
        return ServiceProvider.getOMDService().getBTMService();
//        return BTMServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(BTM_SERVICE_NAME));
    }
    /**
     * 获取链接类型
     * @return 服务的对象
     */
    public LinkTypeServiceOperations getLinkTypeService(){
        return LinkTypeServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(LINK_SERVICE_NAME));
    public LinkTypeServicePrx getLinkTypeService() throws PLException {
        return ServiceProvider.getOMDService().getLinkTypeService();
//        return LinkTypeServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(LINK_SERVICE_NAME));
    }
    /**
     * 获取UI上下文服务
     * @return 服务的对象
     */
    public PortalServiceOperations getPortalService(){
        return PortalServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(PORTAL_SERVICE_NAME));
    public PortalServicePrx getPortalService(){
        return ServiceProvider.getUIService();
//        return PortalServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(PORTAL_SERVICE_NAME));
    }
    /**
     * 获取查询服务
     * @return 服务的对象
     */
    public QTServiceOperations getQueryService(){
        return QTServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(QUERY_SERVICE_NAME));
    public ObjectQueryServicePrx getQueryService(){
        return ServiceProvider.getOQService();
//        return QTServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(QUERY_SERVICE_NAME));
    }
    /**
     * 卷服务
     * @param serverUrl 命名服务
     * @param volumeName 卷的名称
     * @return 卷服务的的对象
     */
    public VolumnFactory getVolumeService(String serverUrl,String volumeName){
        if(StringUtils.isNotBlank(serverUrl)){
            if(StringUtils.countMatches(serverUrl,":") < 2){
                throw new VciBaseException("卷服务的配置错误,需要主机名:端口:服务前缀这种形式");
            }
            String[] split = serverUrl.split(":");
            serverUrl = "corbaloc::" + split[0] + ":" +split[1] + "/NameService:" +split[2];
        }
        return VolumnFactoryHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByUrlAndServiceName(serverUrl,volumeName));
    public VolumeServicePrx getVolumeService(String volumeName){
        return ServiceProvider.getVolumeService(volumeName);
//        return VolumnFactoryHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByUrlAndServiceName(serverUrl,volumeName));
    }
}