Ejemplo n.º 1
0
 private void cachePhysicalPaths(final Collection<Path> paths) {
   final Collection<Path> pathsToCache = CollectionUtils.populate(new HashSet<Path>(), paths);
   if (!pathsToCache.contains(ROOT)) {
     pathsToCache.add(ROOT);
   }
   for (final Path path : pathsToCache) {
     pathLocations.put(path, path.getModulePath(this));
   }
 }
Ejemplo n.º 2
0
  /**
   * Constructor
   *
   * @param groupId the Maven groupId, explicit or inherited (required)
   * @param artifactId the Maven artifactId (required)
   * @param version the version of the artifact being built (required)
   * @param packaging the Maven packaging (required)
   * @param dependencies (can be <code>null</code> for none)
   * @param parent the POM's parent declaration (can be <code>null</code> for none)
   * @param modules the modules defined by this POM (only applies when packaging is "pom"; can be
   *     <code>null</code> for none)
   * @param pomProperties any properties defined in the POM (can be <code>null</code> for none)
   * @param name the Maven name of the artifact being built (can be blank)
   * @param repositories any repositories defined in the POM (can be <code>null</code> for none)
   * @param pluginRepositories any plugin repositories defined in the POM (can be <code>null</code>
   *     for none)
   * @param sourceDirectory the directory relative to the POM that contains production code (can be
   *     blank for the Maven default)
   * @param testSourceDirectory the directory relative to the POM that contains test code (can be
   *     blank for the Maven default)
   * @param filters any filters defined in the POM (can be <code>null</code> for none)
   * @param buildPlugins any plugins defined in the POM (can be <code>null</code> for none)
   * @param resources any build resources defined in the POM (can be <code>null</code> for none)
   * @param path the canonical path of this POM (required)
   * @param moduleName the Maven name of this module (blank for the project's root or only POM)
   * @param paths the {@link Path}s required for this module, in addition to the root (can be <code>
   *     null</code>)
   */
  public Pom(
      final String groupId,
      final String artifactId,
      final String version,
      final String packaging,
      final Collection<? extends Dependency> dependencies,
      final Parent parent,
      final Collection<? extends Module> modules,
      final Collection<? extends Property> pomProperties,
      final String name,
      final Collection<? extends Repository> repositories,
      final Collection<? extends Repository> pluginRepositories,
      final String sourceDirectory,
      final String testSourceDirectory,
      final Collection<? extends Filter> filters,
      final Collection<? extends Plugin> buildPlugins,
      final Collection<? extends Resource> resources,
      final String path,
      final String moduleName,
      final Collection<Path> paths) {
    Validate.notBlank(packaging, "Invalid packaging '%s'", packaging);
    Validate.notBlank(path, "Invalid path '%s'", path);

    // gav = new GAV(groupId, artifactId, version);
    this.moduleName = StringUtils.stripToEmpty(moduleName);
    this.name = StringUtils.stripToEmpty(name);
    this.packaging = packaging;
    this.parent = parent;

    if (version == null && parent.getVersion() != null) {
      gav = new GAV(groupId, artifactId, parent.getVersion());
    } else {
      gav = new GAV(groupId, artifactId, version);
    }

    this.path = path;
    this.sourceDirectory =
        StringUtils.defaultIfEmpty(sourceDirectory, Path.SRC_MAIN_JAVA.getDefaultLocation());
    this.testSourceDirectory =
        StringUtils.defaultIfEmpty(testSourceDirectory, Path.SRC_TEST_JAVA.getDefaultLocation());

    CollectionUtils.populate(this.buildPlugins, buildPlugins);
    CollectionUtils.populate(this.dependencies, dependencies);
    CollectionUtils.populate(this.filters, filters);
    CollectionUtils.populate(this.modules, modules);
    CollectionUtils.populate(this.pluginRepositories, pluginRepositories);
    CollectionUtils.populate(this.pomProperties, pomProperties);
    CollectionUtils.populate(this.repositories, repositories);
    CollectionUtils.populate(this.resources, resources);

    cachePhysicalPaths(paths);
  }
 /**
  * Indicates whether active record CRUD methods should be generated for the given entities (this
  * being an all or nothing decision)
  *
  * @param database the database being reverse-engineered (required)
  * @param managedEntities any existing DB-managed entities in the user project (can be <code>null
  *     </code> or empty)
  * @return see above
  */
 private boolean isActiveRecord(
     final Database database, final Collection<ClassOrInterfaceTypeDetails> managedEntities) {
   if (CollectionUtils.isEmpty(managedEntities)) {
     // There are no existing entities; use the given setting
     return database.isActiveRecord();
   }
   /*
    * There are one or more existing entities; preserve the existing
    * decision, based on the first such entity. This saves the user from
    * having to enter the same value for the "activeRecord" option each
    * time they run the database reverse engineer command.
    */
   return managedEntities.iterator().next().getAnnotation(ROO_JPA_ACTIVE_RECORD) != null;
 }
Ejemplo n.º 4
0
 /**
  * Constructs a new instance.
  *
  * @param details the member holders that should be stored in this instance (can be <code>null
  *     </code>)
  */
 MemberDetailsImpl(final Collection<? extends MemberHoldingTypeDetails> details) {
   Validate.notEmpty(details, "Member holding details required");
   CollectionUtils.populate(this.details, details);
 }
Ejemplo n.º 5
0
 public MethodMetadata getMostConcreteMethodWithTag(final Object tagKey) {
   return CollectionUtils.firstElementOf(getMethodsWithTag(tagKey));
 }