Tabnine Logo
DistributionSet.getModules
Code IndexAdd Tabnine to your IDE (free)

How to use
getModules
method
in
org.eclipse.hawkbit.repository.model.DistributionSet

Best Java code snippets using org.eclipse.hawkbit.repository.model.DistributionSet.getModules (Showing top 20 results out of 315)

origin: eclipse/hawkbit

/**
 * Adds {@link SoftwareModuleMetadata} to every module of given
 * {@link DistributionSet}.
 * 
 * {@link #VISIBLE_SM_MD_VALUE}, {@link #VISIBLE_SM_MD_KEY} with
 * {@link SoftwareModuleMetadata#isTargetVisible()} and
 * {@link #INVISIBLE_SM_MD_KEY}, {@link #INVISIBLE_SM_MD_VALUE} without
 * {@link SoftwareModuleMetadata#isTargetVisible()}
 * 
 * @param set
 *            to add metadata to
 */
public void addSoftwareModuleMetadata(final DistributionSet set) {
  set.getModules().forEach(this::addTestModuleMetadata);
}
origin: org.eclipse.hawkbit/hawkbit-repository-test

/**
 * Adds {@link SoftwareModuleMetadata} to every module of given
 * {@link DistributionSet}.
 * 
 * {@link #VISIBLE_SM_MD_VALUE}, {@link #VISIBLE_SM_MD_KEY} with
 * {@link SoftwareModuleMetadata#isTargetVisible()} and
 * {@link #INVISIBLE_SM_MD_KEY}, {@link #INVISIBLE_SM_MD_VALUE} without
 * {@link SoftwareModuleMetadata#isTargetVisible()}
 * 
 * @param set
 *            to add metadata to
 */
public void addSoftwareModuleMetadata(final DistributionSet set) {
  set.getModules().forEach(this::addTestModuleMetadata);
}
origin: org.eclipse.hawkbit/hawkbit-repository-jpa

@Override
public boolean checkComplete(final DistributionSet distributionSet) {
  return distributionSet.getModules().stream().map(SoftwareModule::getType).collect(Collectors.toList())
      .containsAll(getMandatoryModuleTypes());
}
origin: eclipse/hawkbit

/**
 * Searches through modules for the given type.
 *
 * @param type
 *            to search for
 * @return SoftwareModule of given type
 */
default Optional<SoftwareModule> findFirstModuleByType(final SoftwareModuleType type) {
  return getModules().stream().filter(module -> module.getType().equals(type)).findAny();
}
origin: eclipse/hawkbit

@Override
public boolean checkComplete(final DistributionSet distributionSet) {
  return distributionSet.getModules().stream().map(SoftwareModule::getType).collect(Collectors.toList())
      .containsAll(getMandatoryModuleTypes());
}
origin: org.eclipse.hawkbit/hawkbit-ddi-resource

static List<DdiChunk> createChunks(final Target target, final Action uAction,
    final ArtifactUrlHandler artifactUrlHandler, final SystemManagement systemManagement,
    final HttpRequest request, final ControllerManagement controllerManagement) {
  final Map<Long, List<SoftwareModuleMetadata>> metadata = controllerManagement
      .findTargetVisibleMetaDataBySoftwareModuleId(uAction.getDistributionSet().getModules().stream()
          .map(SoftwareModule::getId).collect(Collectors.toList()));
  return uAction.getDistributionSet().getModules().stream()
      .map(module -> new DdiChunk(mapChunkLegacyKeys(module.getType().getKey()), module.getVersion(),
          module.getName(),
          createArtifacts(target, module, artifactUrlHandler, systemManagement, request),
          mapMetadata(metadata.get(module.getId()))))
      .collect(Collectors.toList());
}
origin: eclipse/hawkbit

static List<DdiChunk> createChunks(final Target target, final Action uAction,
    final ArtifactUrlHandler artifactUrlHandler, final SystemManagement systemManagement,
    final HttpRequest request, final ControllerManagement controllerManagement) {
  final Map<Long, List<SoftwareModuleMetadata>> metadata = controllerManagement
      .findTargetVisibleMetaDataBySoftwareModuleId(uAction.getDistributionSet().getModules().stream()
          .map(SoftwareModule::getId).collect(Collectors.toList()));
  return new ResponseList<>(uAction.getDistributionSet().getModules().stream()
      .map(module -> new DdiChunk(mapChunkLegacyKeys(module.getType().getKey()), module.getVersion(),
          module.getName(),
          createArtifacts(target, module, artifactUrlHandler, systemManagement, request),
          mapMetadata(metadata.get(module.getId()))))
      .collect(Collectors.toList()));
}
origin: eclipse/hawkbit

private void lookIfUpdateAvailable(final Target target) {
  final Optional<Action> actionOptional = controllerManagement
      .findOldestActiveActionByTarget(target.getControllerId());
  if (!actionOptional.isPresent()) {
    return;
  }
  final Action action = actionOptional.get();
  if (action.isCancelingOrCanceled()) {
    amqpMessageDispatcherService.sendCancelMessageToTarget(target.getTenant(), target.getControllerId(),
        action.getId(), target.getAddress());
    return;
  }
  final Map<SoftwareModule, List<SoftwareModuleMetadata>> modules = Maps
      .newHashMapWithExpectedSize(action.getDistributionSet().getModules().size());
  final Map<Long, List<SoftwareModuleMetadata>> metadata = controllerManagement
      .findTargetVisibleMetaDataBySoftwareModuleId(action.getDistributionSet().getModules().stream()
          .map(SoftwareModule::getId).collect(Collectors.toList()));
  action.getDistributionSet().getModules().forEach(module -> modules.put(module, metadata.get(module.getId())));
  amqpMessageDispatcherService.sendUpdateMessageToTarget(action.getTenant(), action.getTarget(), action.getId(),
      modules, action.isMaintenanceWindowAvailable());
}
origin: eclipse/hawkbit

/**
 * Method to send a message to a RabbitMQ Exchange after the Distribution
 * set has been assign to a Target.
 *
 * @param assignedEvent
 *            the object to be send.
 */
@EventListener(classes = TargetAssignDistributionSetEvent.class)
protected void targetAssignDistributionSet(final TargetAssignDistributionSetEvent assignedEvent) {
  if (isNotFromSelf(assignedEvent)) {
    return;
  }
  LOG.debug("targetAssignDistributionSet retrieved. I will forward it to DMF broker.");
  distributionSetManagement.get(assignedEvent.getDistributionSetId()).ifPresent(set -> {
    final Map<SoftwareModule, List<SoftwareModuleMetadata>> modules = Maps
        .newHashMapWithExpectedSize(set.getModules().size());
    set.getModules()
        .forEach(
            module -> modules.put(module,
                softwareModuleManagement.findMetaDataBySoftwareModuleIdAndTargetVisible(
                    PageRequest.of(0, RepositoryConstants.MAX_META_DATA_COUNT), module.getId())
                    .getContent()));
    targetManagement.getByControllerID(assignedEvent.getActions().keySet())
        .forEach(target -> sendUpdateMessageToTarget(assignedEvent.getTenant(), target,
            assignedEvent.getActions().get(target.getControllerId()), modules,
            assignedEvent.isMaintenanceWindowAvailable()));
  });
}
origin: eclipse/hawkbit

public static String distributionSetUpdateValidFieldsOnly(final DistributionSet set) throws JSONException {
  set.getModules().stream().map(module -> {
    try {
      return new JSONObject().put("id", module.getId());
    } catch (final JSONException e) {
      e.printStackTrace();
      return null;
    }
  }).collect(Collectors.toList());
  return new JSONObject().put("name", set.getName()).put("description", set.getDescription())
      .put("version", set.getVersion()).put("requiredMigrationStep", set.isRequiredMigrationStep())
      .toString();
}
origin: eclipse/hawkbit

public static JSONObject distributionSetCreateValidFieldsOnly(final DistributionSet set) throws JSONException {
  final List<JSONObject> modules = set.getModules().stream().map(module -> {
    try {
      return new JSONObject().put("id", module.getId());
    } catch (final JSONException e) {
      e.printStackTrace();
      return null;
    }
  }).collect(Collectors.toList());
  return new JSONObject().put("name", set.getName()).put("description", set.getDescription())
      .put("type", set.getType() == null ? null : set.getType().getKey()).put("version", set.getVersion())
      .put("requiredMigrationStep", set.isRequiredMigrationStep()).put("modules", new JSONArray(modules));
}
origin: eclipse/hawkbit

public static JSONObject distributionSet(final DistributionSet set) throws JSONException {
  final List<JSONObject> modules = set.getModules().stream().map(module -> {
    try {
      return new JSONObject().put("id", module.getId());
    } catch (final JSONException e) {
      e.printStackTrace();
      return null;
    }
  }).collect(Collectors.toList());
  return new JSONObject().put("name", set.getName()).put("description", set.getDescription())
      .put("type", set.getType() == null ? null : set.getType().getKey()).put("id", Long.MAX_VALUE)
      .put("version", set.getVersion()).put("createdAt", "0").put("updatedAt", "0")
      .put("createdBy", "fghdfkjghdfkjh").put("updatedBy", "fghdfkjghdfkjh")
      .put("requiredMigrationStep", set.isRequiredMigrationStep()).put("modules", new JSONArray(modules));
}
origin: eclipse/hawkbit

/**
 * Creates {@link DistributionSet}s in repository including three
 * {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT}
 * , {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} followed by an
 * iterative number and {@link DistributionSet#isRequiredMigrationStep()}
 * <code>false</code>.
 * 
 * In addition it updates the created {@link DistributionSet}s and
 * {@link SoftwareModule}s to ensure that
 * {@link BaseEntity#getLastModifiedAt()} and
 * {@link BaseEntity#getLastModifiedBy()} is filled.
 * 
 * @return persisted {@link DistributionSet}.
 */
public DistributionSet createUpdatedDistributionSet() {
  DistributionSet set = createDistributionSet("");
  set = distributionSetManagement.update(
      entityFactory.distributionSet().update(set.getId()).description("Updated " + DEFAULT_DESCRIPTION));
  set.getModules().forEach(module -> softwareModuleManagement.update(
      entityFactory.softwareModule().update(module.getId()).description("Updated " + DEFAULT_DESCRIPTION)));
  // load also lazy stuff
  return distributionSetManagement.getWithDetails(set.getId()).get();
}
origin: org.eclipse.hawkbit/hawkbit-repository-test

/**
 * Creates {@link DistributionSet}s in repository including three
 * {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT}
 * , {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} followed by an
 * iterative number and {@link DistributionSet#isRequiredMigrationStep()}
 * <code>false</code>.
 * 
 * In addition it updates the created {@link DistributionSet}s and
 * {@link SoftwareModule}s to ensure that
 * {@link BaseEntity#getLastModifiedAt()} and
 * {@link BaseEntity#getLastModifiedBy()} is filled.
 * 
 * @return persisted {@link DistributionSet}.
 */
public DistributionSet createUpdatedDistributionSet() {
  DistributionSet set = createDistributionSet("");
  set = distributionSetManagement.update(
      entityFactory.distributionSet().update(set.getId()).description("Updated " + DEFAULT_DESCRIPTION));
  set.getModules().forEach(module -> softwareModuleManagement.update(
      entityFactory.softwareModule().update(module.getId()).description("Updated " + DEFAULT_DESCRIPTION)));
  // load also lazy stuff
  return distributionSetManagement.getWithDetails(set.getId()).get();
}
origin: org.eclipse.hawkbit/hawkbit-ui

private void populateDistributionDtls(final VerticalLayout layout, final DistributionSet distributionSet) {
  layout.removeAllComponents();
  layout.addComponent(SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.name"),
      distributionSet == null ? "" : distributionSet.getName()));
  layout.addComponent(
      SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.version"),
          distributionSet == null ? "" : distributionSet.getVersion()));
  if (distributionSet == null) {
    return;
  }
  distributionSet.getModules()
      .forEach(module -> layout.addComponent(getSWModlabel(module.getType().getName(), module)));
}
origin: eclipse/hawkbit

private void populateDistributionDtls(final VerticalLayout layout, final DistributionSet distributionSet) {
  layout.removeAllComponents();
  layout.addComponent(SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.name"),
      distributionSet == null ? "" : distributionSet.getName()));
  layout.addComponent(
      SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.version"),
          distributionSet == null ? "" : distributionSet.getVersion()));
  if (distributionSet == null) {
    return;
  }
  distributionSet.getModules()
      .forEach(module -> layout.addComponent(getSWModlabel(module.getType().getName(), module)));
}
origin: eclipse/hawkbit

protected DistributionSet createDistributionSet() {
  DistributionSet distributionSet = testdataFactory.createDistributionSet("");
  distributionSet = distributionSetManagement.update(entityFactory.distributionSet()
      .update(distributionSet.getId()).description("The descption of the distribution set."));
  distributionSet.getModules().forEach(module -> {
    final byte[] random = RandomStringUtils.random(5).getBytes();
    artifactManagement
        .create(new ArtifactUpload(new ByteArrayInputStream(random), module.getId(), "file1", false, 0));
    softwareModuleManagement.update(entityFactory.softwareModule().update(module.getId())
        .description("Description of the software module"));
  });
  return distributionSet;
}
origin: eclipse/hawkbit

private void setSwModuleProperties(final SoftwareModuleType swModType, final Boolean isMandatory,
    final DistributionSet distributionSet) {
  final Set<SoftwareModule> alreadyAssignedSwModules = distributionSet.getModules();
  final Item saveTblitem = getContainerDataSource().addItem(swModType.getName());
  final Label mandatoryLabel = createMandatoryLabel(isMandatory);
  final Label typeName = HawkbitCommonUtil.getFormatedLabel(swModType.getName());
  final VerticalLayout verticalLayout = createSoftModuleLayout(swModType, distributionSet,
      alreadyAssignedSwModules);
  saveTblitem.getItemProperty(SOFT_TYPE_MANDATORY).setValue(mandatoryLabel);
  saveTblitem.getItemProperty(SOFT_TYPE_NAME).setValue(typeName);
  saveTblitem.getItemProperty(SOFT_MODULE).setValue(verticalLayout);
}
origin: org.eclipse.hawkbit/hawkbit-ui

private void setSwModuleProperties(final SoftwareModuleType swModType, final Boolean isMandatory,
    final DistributionSet distributionSet) {
  final Set<SoftwareModule> alreadyAssignedSwModules = distributionSet.getModules();
  final Item saveTblitem = getContainerDataSource().addItem(swModType.getName());
  final Label mandatoryLabel = createMandatoryLabel(isMandatory);
  final Label typeName = HawkbitCommonUtil.getFormatedLabel(swModType.getName());
  final VerticalLayout verticalLayout = createSoftModuleLayout(swModType, distributionSet,
      alreadyAssignedSwModules);
  saveTblitem.getItemProperty(SOFT_TYPE_MANDATORY).setValue(mandatoryLabel);
  saveTblitem.getItemProperty(SOFT_TYPE_NAME).setValue(typeName);
  saveTblitem.getItemProperty(SOFT_MODULE).setValue(verticalLayout);
}
origin: eclipse/hawkbit

static MgmtDistributionSet toResponse(final DistributionSet distributionSet) {
  if (distributionSet == null) {
    return null;
  }
  final MgmtDistributionSet response = new MgmtDistributionSet();
  MgmtRestModelMapper.mapNamedToNamed(response, distributionSet);
  response.setDsId(distributionSet.getId());
  response.setVersion(distributionSet.getVersion());
  response.setComplete(distributionSet.isComplete());
  response.setType(distributionSet.getType().getKey());
  response.setDeleted(distributionSet.isDeleted());
  distributionSet.getModules()
      .forEach(module -> response.getModules().add(MgmtSoftwareModuleMapper.toResponse(module)));
  response.setRequiredMigrationStep(distributionSet.isRequiredMigrationStep());
  response.add(linkTo(methodOn(MgmtDistributionSetRestApi.class).getDistributionSet(response.getDsId()))
      .withSelfRel());
  return response;
}
org.eclipse.hawkbit.repository.modelDistributionSetgetModules

Popular methods of DistributionSet

  • getId
  • getType
  • getVersion
  • isRequiredMigrationStep
  • findFirstModuleByType
  • getDescription
  • getName
  • isComplete
  • getAutoAssignFilters
  • getCreatedAt
  • getLastModifiedAt
  • getTenant
  • getLastModifiedAt,
  • getTenant,
  • isDeleted

Popular in Java

  • Updating database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now