class BBInputSetup implements JavaDelegate {

    protected void populateConfiguration(BBInputSetupParameter parameter) {
        Configuration configuration = null;
        String replaceVnfModelCustomizationUUID = "";
        if (parameter.getRelatedInstanceList() != null) {
            for (RelatedInstanceList relatedInstList : parameter.getRelatedInstanceList()) {
                RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
                if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
                    if (parameter.getIsReplace()) {
                        replaceVnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
                    }
                }
            }
        }
        for (Configuration configurationTemp : parameter.getServiceInstance().getConfigurations()) {
            if (parameter.getLookupKeyMap().get(ResourceKey.CONFIGURATION_ID) != null
                    && configurationTemp.getConfigurationId()
                            .equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.CONFIGURATION_ID))) {
                configuration = configurationTemp;
                org.onap.aai.domain.yang.Configuration aaiConfiguration =
                        bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId());
                if (aaiConfiguration != null) {
                    parameter.getModelInfo().setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId());
                }
            }
        }
        if (configuration == null
                && (parameter.getBbName().equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())
                        || parameter.getBbName().equalsIgnoreCase(AssignFlows.VRF_CONFIGURATION.toString()))) {
            configuration = this.createConfiguration(parameter.getLookupKeyMap(), parameter.getInstanceName(),
                    parameter.getResourceId());
            parameter.getServiceInstance().getConfigurations().add(configuration);
        }
        if (configuration != null && parameter.getBbName().contains("Fabric")) {
            Vnfc vnfc = getVnfcToConfiguration(parameter.getConfigurationResourceKeys().getVnfcName());
            configuration.setVnfc(vnfc);
            if (!parameter.getBbName().contains("Delete")) {
                if (parameter.getIsReplace()) {
                    parameter.getConfigurationResourceKeys()
                            .setVnfResourceCustomizationUUID(replaceVnfModelCustomizationUUID);
                    mapCatalogConfiguration(configuration, parameter.getModelInfo(),
                            parameter.getServiceModel().getNewService(), parameter.getConfigurationResourceKeys());
                } else {
                    mapCatalogConfiguration(configuration, parameter.getModelInfo(),
                            parameter.getServiceModel().getCurrentService(), parameter.getConfigurationResourceKeys());
                }
            }
        } else if (configuration != null && parameter.getBbName().contains("Vrf")) {
            configuration.setModelInfoConfiguration(mapperLayer.mapCatalogConfigurationToConfiguration(
                    findConfigurationResourceCustomization(parameter.getModelInfo(), parameter.getService()), null));
            configuration.setConfigurationType(configuration.getModelInfoConfiguration().getConfigurationType());
            configuration.setConfigurationSubType(configuration.getModelInfoConfiguration().getConfigurationRole());
        }
    }

}