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

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

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

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: org.eclipse.hawkbit/hawkbit-ui

private List<ProxyDistribution> createProxyDistributions(final Page<DistributionSet> distBeans) {
  final List<ProxyDistribution> proxyDistributions = new ArrayList<>();
  for (final DistributionSet distributionSet : distBeans) {
    final ProxyDistribution proxyDistribution = new ProxyDistribution();
    proxyDistribution.setName(
        HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
    proxyDistribution.setDescription(distributionSet.getDescription());
    proxyDistribution.setDistId(distributionSet.getId());
    proxyDistribution.setId(distributionSet.getId());
    proxyDistribution.setVersion(distributionSet.getVersion());
    proxyDistribution.setCreatedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getCreatedAt()));
    proxyDistribution.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getLastModifiedAt()));
    proxyDistribution.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(distributionSet));
    proxyDistribution.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(distributionSet));
    proxyDistribution.setIsComplete(distributionSet.isComplete());
    proxyDistributions.add(proxyDistribution);
  }
  return proxyDistributions;
}
origin: org.eclipse.hawkbit/hawkbit-repository-test

protected Long getOsModule(final DistributionSet ds) {
  return ds.findFirstModuleByType(osType).get().getId();
}
origin: org.eclipse.hawkbit/hawkbit-ui

/**
 * Constructor.
 * 
 * @param distributionSet
 *            the distributionSet
 */
public DistributionSetIdName(final DistributionSet distributionSet) {
  this(distributionSet.getId(), distributionSet.getName(), distributionSet.getVersion());
}
origin: org.eclipse.hawkbit/hawkbit-repository-jpa

@Override
void sendAssignmentEvents(final DistributionSet set, final List<JpaTarget> targets,
    final Set<Long> targetIdsCancellList, final Map<String, JpaAction> targetIdsToActions) {
  final List<Action> actions = targets.stream().map(target -> {
    target.setUpdateStatus(TargetUpdateStatus.PENDING);
    sendTargetUpdatedEvent(target);
    return target;
  }).filter(target -> !targetIdsCancellList.contains(target.getId())).map(Target::getControllerId)
      .map(targetIdsToActions::get).collect(Collectors.toList());
  sendTargetAssignDistributionSetEvent(set.getTenant(), set.getId(), actions);
}
origin: eclipse/hawkbit

private void populateValuesOfDistribution(final Long editDistId) {
  final Optional<DistributionSet> distSet = distributionSetManagement.getWithDetails(editDistId);
  if (!distSet.isPresent()) {
    return;
  }
  distNameTextField.setValue(distSet.get().getName());
  distVersionTextField.setValue(distSet.get().getVersion());
  if (distSet.get().getType().isDeleted()) {
    distsetTypeNameComboBox.addItem(distSet.get().getType().getId());
  }
  distsetTypeNameComboBox.setValue(distSet.get().getType().getId());
  distsetTypeNameComboBox.setEnabled(false);
  reqMigStepCheckbox.setValue(distSet.get().isRequiredMigrationStep());
  descTextArea.setValue(distSet.get().getDescription());
}
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;
}
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 boolean validateAssignment(final SoftwareModule sm, final DistributionSet ds) {
  final String dsNameAndVersion = HawkbitCommonUtil.concatStrings(":", ds.getName(), ds.getVersion());
  final String smNameAndVersion = HawkbitCommonUtil.concatStrings(":", sm.getName(), sm.getVersion());
  if (!isSoftwareModuleDragged(ds.getId(), sm)) {
    return false;
    return false;
  if (targetManagement.countByFilters(null, null, null, ds.getId(), Boolean.FALSE,
      new String[] {}) > 0) {
    return false;
  if (ds.getModules().contains(sm)) {
    return false;
  if (!ds.getType().containsModuleType(sm.getType())) {
    return false;
  if (distributionSetManagement.isInUse(ds.getId())) {
    getNotification()
        .displayValidationError(getI18n().getMessage("message.error.notification.ds.target.assigned",
            ds.getName(), ds.getVersion()));
    return false;
origin: org.eclipse.hawkbit/hawkbit-repository-test

protected DistributionSetAssignmentResult assignDistributionSet(final DistributionSet pset,
    final List<Target> targets) {
  return deploymentManagement.assignDistributionSet(pset.getId(),
      targets.stream().map(Target::getTargetWithActionType).collect(Collectors.toList()));
}
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-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: org.eclipse.hawkbit/hawkbit-ui

final Set<SoftwareModule> swModules = distributionSet.getModules();
swModules.forEach(swModule -> {
  swModuleNames.append(swModule.getName());
stringBuilder.append(HTML_UL_OPEN_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append(" DistributionSet Description : ").append(distributionSet.getDescription());
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append(" DistributionSet Type : ").append((distributionSet.getType()).getName());
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append(" Required Migration step : ")
    .append(distributionSet.isRequiredMigrationStep() ? "Yes" : "No");
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
origin: eclipse/hawkbit

@Override
public void saveOrUpdate() {
  if (isDuplicate(editDistId)) {
    return;
  }
  final boolean isMigStepReq = reqMigStepCheckbox.getValue();
  final Long distSetTypeId = (Long) distsetTypeNameComboBox.getValue();
  distributionSetTypeManagement.get(distSetTypeId).ifPresent(type -> {
    final DistributionSet currentDS = distributionSetManagement.update(entityFactory.distributionSet()
        .update(editDistId).name(distNameTextField.getValue()).description(descTextArea.getValue())
        .version(distVersionTextField.getValue()).requiredMigrationStep(isMigStepReq));
    notificationMessage.displaySuccess(i18n.getMessage("message.new.dist.save.success",
        new Object[] { currentDS.getName(), currentDS.getVersion() }));
    // update table row+details layout
    eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.UPDATED_ENTITY, currentDS));
  });
}
origin: eclipse/hawkbit

@Override
@SuppressWarnings("unchecked")
protected void updateEntity(final DistributionSet baseEntity, final Item item) {
  item.getItemProperty(SPUILabelDefinitions.DIST_ID).setValue(baseEntity.getId());
  item.getItemProperty(SPUILabelDefinitions.VAR_IS_DISTRIBUTION_COMPLETE).setValue(baseEntity.isComplete());
  super.updateEntity(baseEntity, item);
}
origin: eclipse/hawkbit

protected void populateDetails() {
  if (getSelectedBaseEntity() != null) {
    updateDistributionSetDetailsLayout(getSelectedBaseEntity().getType().getName(),
        getSelectedBaseEntity().isRequiredMigrationStep());
  } else {
    updateDistributionSetDetailsLayout(null, null);
  }
}
origin: eclipse/hawkbit

static void addLinks(final DistributionSet distributionSet, final MgmtDistributionSet response) {
  response.add(linkTo(methodOn(MgmtDistributionSetRestApi.class).getAssignedSoftwareModules(response.getDsId(),
      MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
      MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null))
          .withRel(MgmtRestConstants.DISTRIBUTIONSET_V1_MODULE));
  response.add(linkTo(methodOn(MgmtDistributionSetTypeRestApi.class)
      .getDistributionSetType(distributionSet.getType().getId())).withRel("type"));
  response.add(linkTo(methodOn(MgmtDistributionSetRestApi.class).getMetadata(response.getDsId(),
      MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
      MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null)).withRel("metadata"));
}
origin: eclipse/hawkbit

@Test
@Description("Delete a software module assignment." + " Required Permission: " + SpPermission.UPDATE_REPOSITORY)
public void deleteAssignSoftwareModules() throws Exception {
  final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
  mockMvc.perform(delete(
      MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING
          + "/{distributionSetId}/assignedSM/{softwareModuleId}",
      set.getId(), set.findFirstModuleByType(osType).get().getId())
          .contentType(MediaType.APPLICATION_JSON_UTF8))
      .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
      .andDo(this.document.document(pathParameters(
          parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID),
          parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID))));
  ;
}
origin: eclipse/hawkbit

/**
 * Populate software module table.
 * 
 * @param distributionSet
 */
public void populateModule(final DistributionSet distributionSet) {
  removeAllItems();
  if (distributionSet != null) {
    if (isUnassignSoftModAllowed && permissionChecker.hasUpdateRepositoryPermission()) {
      try {
        isTargetAssigned = false;
      } catch (final EntityReadOnlyException exception) {
        isTargetAssigned = true;
        LOG.info("Target already assigned for the distribution set: " + distributionSet.getName(),
            exception);
      }
    }
    final Set<SoftwareModuleType> swModuleMandatoryTypes = distributionSet.getType().getMandatoryModuleTypes();
    final Set<SoftwareModuleType> swModuleOptionalTypes = distributionSet.getType().getOptionalModuleTypes();
    if (!CollectionUtils.isEmpty(swModuleMandatoryTypes)) {
      swModuleMandatoryTypes.forEach(swModule -> setSwModuleProperties(swModule, true, distributionSet));
    }
    if (!CollectionUtils.isEmpty(swModuleOptionalTypes)) {
      swModuleOptionalTypes.forEach(swModule -> setSwModuleProperties(swModule, false, distributionSet));
    }
    setAmountOfTableRows(getContainerDataSource().size());
  }
}
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();
}
org.eclipse.hawkbit.repository.modelDistributionSet

Javadoc

A DistributionSet defines a meta package that combines a set of SoftwareModules which have to be or are provisioned to a Target.

A Target has exactly one target DistributionSet assigned.

Most used methods

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

Popular in Java

  • Reading from database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setScale (BigDecimal)
  • scheduleAtFixedRate (Timer)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • JTable (javax.swing)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top PhpStorm plugins
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