private TypeSpecificConfigModel createVirtualTypeSpecific(
     RepoType type, VirtualRepoDescriptor descriptor) {
   TypeSpecificConfigModel typeSpecific = null;
   MavenTypeSpecificConfigModel mavenModel = null;
   switch (type) {
     case Maven:
       mavenModel = new MavenTypeSpecificConfigModel();
       break;
     case Gradle:
       mavenModel = new GradleTypeSpecificConfigModel();
       break;
     case Ivy:
       mavenModel = new IvyTypeSpecificConfigModel();
       break;
     case SBT:
       mavenModel = new SbtTypeSpecificConfigModel();
       break;
     case P2:
       P2TypeSpecificConfigModel p2 = new P2TypeSpecificConfigModel();
       populateVirtualP2Values(p2, descriptor);
       mavenModel = p2;
       break;
     case Gems:
       typeSpecific = new GemsTypeSpecificConfigModel();
       break;
     case Npm:
       typeSpecific = new NpmTypeSpecificConfigModel();
       break;
     case Bower:
       typeSpecific = new BowerTypeSpecificConfigModel();
       break;
     case NuGet:
       typeSpecific = new NugetTypeSpecificConfigModel();
       populateSharedNuGetValues((NugetTypeSpecificConfigModel) typeSpecific, descriptor);
       break;
     case Pypi:
       typeSpecific = new PypiTypeSpecificConfigModel();
       break;
     case Docker:
       DockerTypeSpecificConfigModel dockerType = new DockerTypeSpecificConfigModel();
       dockerType.setForceDockerAuthentication(descriptor.isForceDockerAuthentication());
       typeSpecific = dockerType;
       break;
     case Generic:
       typeSpecific = new GenericTypeSpecificConfigModel();
       break;
   }
   if (typeSpecific != null) {
     return typeSpecific;
   }
   populateMavenVirtualValues(mavenModel, descriptor);
   return mavenModel;
 }
 private TypeSpecificConfigModel createRemoteTypeSpecific(
     RepoType type, HttpRepoDescriptor descriptor) {
   MavenTypeSpecificConfigModel mavenModel = null;
   TypeSpecificConfigModel model = null;
   switch (type) {
     case Maven:
       mavenModel = new MavenTypeSpecificConfigModel();
       break;
     case Gradle:
       mavenModel = new GradleTypeSpecificConfigModel();
       break;
     case Ivy:
       mavenModel = new IvyTypeSpecificConfigModel();
       break;
     case SBT:
       mavenModel = new SbtTypeSpecificConfigModel();
       break;
     case P2:
       mavenModel = new P2TypeSpecificConfigModel();
       break;
     case Debian:
       DebTypeSpecificConfigModel debType = new DebTypeSpecificConfigModel();
       debType.setListRemoteFolderItems(descriptor.isListRemoteFolderItems());
       model = debType;
       break;
     case Docker:
       DockerTypeSpecificConfigModel dockerType = new DockerTypeSpecificConfigModel();
       dockerType.setEnableTokenAuthentication(descriptor.isEnableTokenAuthentication());
       dockerType.setForceDockerAuthentication(descriptor.isForceDockerAuthentication());
       dockerType.setListRemoteFolderItems(descriptor.isListRemoteFolderItems());
       model = dockerType;
       break;
     case NuGet:
       NugetTypeSpecificConfigModel nugetType = new NugetTypeSpecificConfigModel();
       populateSharedNuGetValues(nugetType, descriptor);
       NuGetConfiguration nuget = descriptor.getNuget();
       if (nuget != null) {
         nugetType.setDownloadContextPath(nuget.getDownloadContextPath());
         nugetType.setFeedContextPath(nuget.getFeedContextPath());
       }
       nugetType.setListRemoteFolderItems(descriptor.isListRemoteFolderItems());
       model = nugetType;
       break;
     case Npm:
       NpmTypeSpecificConfigModel npmType = new NpmTypeSpecificConfigModel();
       npmType.setListRemoteFolderItems(descriptor.isListRemoteFolderItems());
       model = npmType;
       break;
     case Pypi:
       PypiTypeSpecificConfigModel pypiType = new PypiTypeSpecificConfigModel();
       pypiType.setListRemoteFolderItems(descriptor.isListRemoteFolderItems());
       model = pypiType;
       break;
     case VCS:
       VcsTypeSpecificConfigModel vcsType = new VcsTypeSpecificConfigModel();
       populateVcsValues(vcsType, descriptor);
       model = vcsType;
       break;
     case Bower:
       BowerTypeSpecificConfigModel bowerType = new BowerTypeSpecificConfigModel();
       populateVcsValues(bowerType, descriptor);
       BowerConfiguration bowerConfiguration = descriptor.getBower();
       if (bowerConfiguration != null) {
         bowerType.setRegistryUrl(bowerConfiguration.getBowerRegistryUrl());
       }
       model = bowerType;
       break;
     case Gems:
       GemsTypeSpecificConfigModel gemsType = new GemsTypeSpecificConfigModel();
       gemsType.setListRemoteFolderItems(descriptor.isListRemoteFolderItems());
       model = gemsType;
       break;
     case Generic:
       GenericTypeSpecificConfigModel genericType = new GenericTypeSpecificConfigModel();
       genericType.setListRemoteFolderItems(descriptor.isListRemoteFolderItems());
       model = genericType;
       break;
     case YUM:
       YumTypeSpecificConfigModel yumType = new YumTypeSpecificConfigModel();
       yumType.setListRemoteFolderItems(descriptor.isListRemoteFolderItems());
       yumType.setAutoCalculateYumMetadata(null);
       yumType.setMetadataFolderDepth(null);
       yumType.setGroupFileNames(null);
       model = yumType;
       break;
   }
   if (model != null) {
     return model;
   }
   populateMavenRemoteValues(mavenModel, descriptor);
   return mavenModel;
 }
 private TypeSpecificConfigModel createLocalTypeSpecific(
     RepoType type, LocalRepoDescriptor descriptor) {
   MavenTypeSpecificConfigModel mavenModel = null;
   TypeSpecificConfigModel model = null;
   switch (type) {
     case Bower:
       model = new BowerTypeSpecificConfigModel();
       break;
     case Docker:
       DockerTypeSpecificConfigModel dockerType = new DockerTypeSpecificConfigModel();
       DockerApiVersion dockerApiVersion = descriptor.getDockerApiVersion();
       if (dockerApiVersion != null) {
         dockerType.setDockerApiVersion(dockerApiVersion);
       }
       dockerType.setForceDockerAuthentication(descriptor.isForceDockerAuthentication());
       model = dockerType;
       break;
     case NuGet:
       NugetTypeSpecificConfigModel nugetType = new NugetTypeSpecificConfigModel();
       populateSharedNuGetValues(nugetType, descriptor);
       nugetType.setMaxUniqueSnapshots(descriptor.getMaxUniqueSnapshots());
       model = nugetType;
       break;
     case Npm:
       model = new NpmTypeSpecificConfigModel();
       break;
     case Pypi:
       model = new PypiTypeSpecificConfigModel();
       break;
     case Vagrant:
       model = new VagrantTypeSpecificConfigModel();
       break;
     case GitLfs:
       model = new GitLfsTypeSpecificConfigModel();
       break;
     case Debian:
       DebTypeSpecificConfigModel debType = new DebTypeSpecificConfigModel();
       debType.setTrivialLayout(descriptor.isDebianTrivialLayout());
       model = debType;
       break;
     case YUM:
       YumTypeSpecificConfigModel yumType = new YumTypeSpecificConfigModel();
       yumType.setMetadataFolderDepth(descriptor.getYumRootDepth());
       yumType.setGroupFileNames(descriptor.getYumGroupFileNames());
       yumType.setAutoCalculateYumMetadata(descriptor.isCalculateYumMetadata());
       model = yumType;
       break;
     case Gems:
       model = new GemsTypeSpecificConfigModel();
       break;
     case Generic:
       model = new GenericTypeSpecificConfigModel();
       break;
     case Maven:
       mavenModel = new MavenTypeSpecificConfigModel();
       break;
     case Gradle:
       mavenModel = new GradleTypeSpecificConfigModel();
       break;
     case Ivy:
       mavenModel = new IvyTypeSpecificConfigModel();
       break;
     case SBT:
       mavenModel = new SbtTypeSpecificConfigModel();
       break;
   }
   if (model != null) {
     return model;
   }
   // We will get here only if our model is maven / gradle / ivy / sbt and we populate the values
   populateMavenLocalValues(mavenModel, descriptor);
   return mavenModel;
 }