/** * Parameterized constructor. * * @param name * of the {@link DistributionSet} * @param version * of the {@link DistributionSet} * @param description * of the {@link DistributionSet} * @param type * of the {@link DistributionSet} * @param moduleList * {@link SoftwareModule}s of the {@link DistributionSet} * @param requiredMigrationStep * of the {@link DistributionSet} */ public JpaDistributionSet(final String name, final String version, final String description, final DistributionSetType type, final Collection<SoftwareModule> moduleList, final boolean requiredMigrationStep) { super(name, version, description); this.requiredMigrationStep = requiredMigrationStep; this.type = type; if (moduleList != null) { moduleList.forEach(this::addModule); } if (this.type != null) { complete = this.type.checkComplete(this); } }
/** * Parameterized constructor. * * @param name * of the {@link DistributionSet} * @param version * of the {@link DistributionSet} * @param description * of the {@link DistributionSet} * @param type * of the {@link DistributionSet} * @param moduleList * {@link SoftwareModule}s of the {@link DistributionSet} * @param requiredMigrationStep * of the {@link DistributionSet} */ public JpaDistributionSet(final String name, final String version, final String description, final DistributionSetType type, final Collection<SoftwareModule> moduleList, final boolean requiredMigrationStep) { super(name, version, description); this.requiredMigrationStep = requiredMigrationStep; this.type = type; if (moduleList != null) { moduleList.forEach(this::addModule); } if (this.type != null) { complete = this.type.checkComplete(this); } }
public boolean removeModule(final SoftwareModule softwareModule) { if (modules == null) { return false; } final Optional<SoftwareModule> found = modules.stream() .filter(module -> module.getId().equals(softwareModule.getId())).findAny(); if (found.isPresent()) { modules.remove(found.get()); complete = type.checkComplete(this); return true; } return false; }
public boolean removeModule(final SoftwareModule softwareModule) { if (modules == null) { return false; } final Optional<SoftwareModule> found = modules.stream() .filter(module -> module.getId().equals(softwareModule.getId())).findAny(); if (found.isPresent()) { modules.remove(found.get()); complete = type.checkComplete(this); return true; } return false; }
public boolean addModule(final SoftwareModule softwareModule) { if (modules == null) { modules = new HashSet<>(); } checkTypeCompatability(softwareModule); final Optional<SoftwareModule> found = modules.stream() .filter(module -> module.getId().equals(softwareModule.getId())).findAny(); if (found.isPresent()) { return false; } final long allready = modules.stream() .filter(module -> module.getType().getKey().equals(softwareModule.getType().getKey())).count(); if (allready >= softwareModule.getType().getMaxAssignments()) { modules.stream().filter(module -> module.getType().getKey().equals(softwareModule.getType().getKey())) .findAny().ifPresent(modules::remove); } if (modules.add(softwareModule)) { complete = type.checkComplete(this); return true; } return false; }
public boolean addModule(final SoftwareModule softwareModule) { if (modules == null) { modules = new HashSet<>(); } checkTypeCompatability(softwareModule); final Optional<SoftwareModule> found = modules.stream() .filter(module -> module.getId().equals(softwareModule.getId())).findAny(); if (found.isPresent()) { return false; } final long allready = modules.stream() .filter(module -> module.getType().getKey().equals(softwareModule.getType().getKey())).count(); if (allready >= softwareModule.getType().getMaxAssignments()) { modules.stream().filter(module -> module.getType().getKey().equals(softwareModule.getType().getKey())) .findAny().ifPresent(modules::remove); } if (modules.add(softwareModule)) { complete = type.checkComplete(this); return true; } return false; }