当前位置: 首页>>代码示例>>Java>>正文


Java ProvisioningService.modifySubscription方法代码示例

本文整理汇总了Java中org.oscm.provisioning.intf.ProvisioningService.modifySubscription方法的典型用法代码示例。如果您正苦于以下问题:Java ProvisioningService.modifySubscription方法的具体用法?Java ProvisioningService.modifySubscription怎么用?Java ProvisioningService.modifySubscription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.oscm.provisioning.intf.ProvisioningService的用法示例。


在下文中一共展示了ProvisioningService.modifySubscription方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: modifySubscription

import org.oscm.provisioning.intf.ProvisioningService; //导入方法依赖的package包/类
private BaseResult modifySubscription(String instanceId,
        String subscriptionId, String referenceId,
        List<ServiceParameter> parameterValues,
        List<ServiceAttribute> attributeValues,
        final HashMap<String, Setting> parameterMap,
        final HashMap<String, Setting> attributeMap,
        ProvisioningStatus targetStatus, User requestingUser) {

    ServiceInstance instance = null;

    try {
        instance = instanceDAO.getInstanceById(instanceId);

        instance.prepareRollback();

        checkInstanceAvailability(instance);

        final HashMap<String, Setting> controllerSettings = configService
                .getControllerConfigurationSettings(
                        instance.getControllerId());
        final APPlatformController controller = APPlatformControllerFactory
                .getInstance(instance.getControllerId());

        final ProvisioningSettings currentSettings = configService
                .getProvisioningSettings(instance,
                        UserMapper.toServiceUser(requestingUser));
        final ProvisioningSettings newSettings = new ProvisioningSettings(
                parameterMap, attributeMap,
                currentSettings.getCustomAttributes(), controllerSettings,
                instance.getDefaultLocale());
        newSettings.setAuthentication(currentSettings.getAuthentication());
        configService.copyCredentialsFromControllerSettings(newSettings,
                controllerSettings);
        newSettings.setRequestingUser(
                UserMapper.toServiceUser(requestingUser));
        newSettings.setSubscriptionId(subscriptionId);
        newSettings.setReferenceId(referenceId);

        // Forward modification request
        final InstanceStatus status = controller.modifyInstance(
                instance.getInstanceId(), currentSettings, newSettings);
        if (status != null) {
            // forward call to provisioning service on application instance
            if (status.isInstanceProvisioningRequested()) {
                final ProvisioningService provisioning = provisioningFactory
                        .getInstance(instance);
                final List<ServiceParameter> filteredParameters = InstanceFilter
                        .getFilteredInstanceParametersForService(
                                parameterValues);
                final BaseResult result = provisioning.modifySubscription(
                        instanceId, subscriptionId, referenceId,
                        filteredParameters, attributeValues,
                        requestingUser);
                if (provResult.isError(result)) {
                    return result;
                }
            }

            // If everything worked well we will save all changed parameters
            instance.setInstanceParameters(status.getChangedParameters());
            instance.setInstanceAttributes(status.getChangedAttributes());
        }

        instance.setProvisioningStatus(targetStatus);
        instance.setSubscriptionId(subscriptionId);
        instance.setReferenceId(referenceId);
        em.persist(instance);

        timerService.initTimers();

        return provResult.newOkBaseResult();
    } catch (Exception e) {
        logger.warn(e.getMessage(), e);
        return provResult.getErrorResult(BaseResult.class, e,
                getLocale(requestingUser), instance, instanceId);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:78,代码来源:AsynchronousProvisioningProxy.java


注:本文中的org.oscm.provisioning.intf.ProvisioningService.modifySubscription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。