class BBInputSetup implements JavaDelegate {

    protected GeneralBuildingBlock getGBBALaCarteNonService(ExecuteBuildingBlock executeBB,
            RequestDetails requestDetails, Map<ResourceKey, String> lookupKeyMap, String requestAction,
            String resourceId, String vnfType) throws Exception {
        String bbName = executeBB.getBuildingBlock().getBpmnFlowName();
        String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
        org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null;
        ServiceModel serviceModel = new ServiceModel();
        Service service = null;
        Service newService = null;
        boolean isReplace = false;
        if (serviceInstanceId != null) {
            aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
            if (aaiServiceInstance != null) {
                if (requestAction.equalsIgnoreCase("replaceInstance")
                        || requestAction.equalsIgnoreCase("replaceInstanceRetainAssignments")) {
                    RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList();
                    if (relatedInstanceList != null) {
                        for (RelatedInstanceList relatedInstList : relatedInstanceList) {
                            RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
                            if (relatedInstance.getModelInfo().getModelType().equals(ModelType.service)) {
                                newService = bbInputSetupUtils.getCatalogServiceByModelUUID(
                                        relatedInstance.getModelInfo().getModelVersionId());
                                isReplace = true;
                            }
                        }
                    }
                }

                service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());

                serviceModel.setNewService(newService);
                serviceModel.setCurrentService(service);

                if (service == null) {
                    String message = String.format(
                            "Related service instance model not found in MSO CatalogDB: model-version-id=%s",
                            aaiServiceInstance.getModelVersionId());
                    throw new ServiceModelNotFoundException(message);
                } else if (newService == null && isReplace) {
                    String message = "Related service instance model in Request not found in MSO CatalogDB";
                    throw new ServiceModelNotFoundException(message);
                }
            } else {
                String message = String.format("Related service instance from AAI not found: service-instance-id=%s",
                        serviceInstanceId);
                throw new NoServiceInstanceFoundException(message);
            }
        }

        ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance);
        if (isReplace) {
            serviceInstance.setModelInfoServiceInstance(
                    this.mapperLayer.mapCatalogServiceIntoServiceInstance(serviceModel.getNewService()));
        } else {
            serviceInstance.setModelInfoServiceInstance(
                    this.mapperLayer.mapCatalogServiceIntoServiceInstance(serviceModel.getCurrentService()));
        }
        BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(executeBB.getRequestId())
                .setRequestDetails(requestDetails).setService(service).setBbName(bbName)
                .setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).setResourceId(resourceId)
                .setVnfType(vnfType).setKey(executeBB.getBuildingBlock().getKey())
                .setConfigurationResourceKeys(executeBB.getConfigurationResourceKeys()).setExecuteBB(executeBB)
                .setRequestAction(requestAction).setIsReplace(isReplace).setServiceModel(serviceModel).build();
        this.populateObjectsOnAssignAndCreateFlows(parameter);
        return this.populateGBBWithSIAndAdditionalInfo(parameter);
    }

}