/**
  * Adds information about parent POM.
  *
  * @param pomDescriptor The descriptor for the current POM.
  * @param model The Maven Model.
  * @param context The scanner context.
  */
 private void addParent(MavenPomDescriptor pomDescriptor, Model model, ScannerContext context) {
   Parent parent = model.getParent();
   if (null != parent) {
     MavenArtifactDescriptor parentDescriptor =
         getArtifactResolver(context).resolve(new ParentCoordinates(parent), context);
     pomDescriptor.setParent(parentDescriptor);
   }
 }
  /**
   * Adds information about references licenses.
   *
   * @param pomDescriptor The descriptor for the current POM.
   * @param model The Maven Model.
   * @param store The database.
   */
  private void addLicenses(MavenPomDescriptor pomDescriptor, Model model, Store store) {
    List<License> licenses = model.getLicenses();
    for (License license : licenses) {
      MavenLicenseDescriptor licenseDescriptor = store.create(MavenLicenseDescriptor.class);
      licenseDescriptor.setUrl(license.getUrl());
      licenseDescriptor.setComments(license.getComments());
      licenseDescriptor.setName(license.getName());
      licenseDescriptor.setDistribution(license.getDistribution());

      pomDescriptor.getLicenses().add(licenseDescriptor);
    }
  }
 /**
  * Create the descriptor and set base information.
  *
  * @param model The model.
  * @param scanner The scanner.
  * @return The descriptor.
  */
 protected MavenPomDescriptor createMavenPomDescriptor(Model model, Scanner scanner) {
   ScannerContext context = scanner.getContext();
   MavenPomDescriptor pomDescriptor = context.peek(MavenPomDescriptor.class);
   pomDescriptor.setName(model.getName());
   pomDescriptor.setGroupId(model.getGroupId());
   pomDescriptor.setArtifactId(model.getArtifactId());
   pomDescriptor.setPackaging(model.getPackaging());
   pomDescriptor.setVersion(model.getVersion());
   String pomFqn = getFullyQualifiedName(model);
   pomDescriptor.setFullQualifiedName(pomFqn);
   Coordinates artifactCoordinates = new ModelCoordinates(model);
   MavenArtifactDescriptor artifact =
       getArtifactResolver(context).resolve(artifactCoordinates, context);
   // if the pom describes itself as artifact then the returned artifact
   // descriptor must be used as pom descriptor (the old instance is
   // invalidated due to adding labels)
   if (MavenPomDescriptor.class.isAssignableFrom(artifact.getClass())) {
     pomDescriptor = MavenPomDescriptor.class.cast(artifact);
   }
   pomDescriptor.getDescribes().add(artifact);
   return pomDescriptor;
 }
 /**
  * Adds information about defined profile.
  *
  * @param pomDescriptor The descriptor for the current POM.
  * @param model The Maven Model.
  * @param scannerContext The scanner context.
  */
 private void addProfiles(
     MavenPomDescriptor pomDescriptor, Model model, ScannerContext scannerContext) {
   List<Profile> profiles = model.getProfiles();
   Store store = scannerContext.getStore();
   for (Profile profile : profiles) {
     MavenProfileDescriptor mavenProfileDescriptor = store.create(MavenProfileDescriptor.class);
     pomDescriptor.getProfiles().add(mavenProfileDescriptor);
     mavenProfileDescriptor.setId(profile.getId());
     addProperties(mavenProfileDescriptor, profile.getProperties(), store);
     addModules(mavenProfileDescriptor, profile.getModules(), store);
     addPlugins(mavenProfileDescriptor, profile.getBuild(), scannerContext);
     addManagedPlugins(mavenProfileDescriptor, profile.getBuild(), scannerContext);
     addManagedDependencies(
         mavenProfileDescriptor,
         profile.getDependencyManagement(),
         scannerContext,
         ProfileManagesDependencyDescriptor.class);
     addProfileDependencies(mavenProfileDescriptor, profile.getDependencies(), scannerContext);
     addActivation(mavenProfileDescriptor, profile.getActivation(), store);
   }
 }