Пример #1
0
 private String getItemid(final String filename, final SoftwareModule softwareModule) {
   return new StringBuilder(filename)
       .append(
           HawkbitCommonUtil.getFormattedNameVersion(
               softwareModule.getName(), softwareModule.getVersion()))
       .toString();
 }
Пример #2
0
 private void restoreState() {
   final Indexed container = grid.getContainerDataSource();
   if (container.getItemIds().isEmpty()) {
     container.removeAllItems();
     for (final UploadStatusObject statusObject :
         artifactUploadState.getUploadedFileStatusList()) {
       final Item item =
           container.addItem(
               getItemid(statusObject.getFilename(), statusObject.getSelectedSoftwareModule()));
       item.getItemProperty(REASON)
           .setValue(statusObject.getReason() != null ? statusObject.getReason() : "");
       if (statusObject.getStatus() != null) {
         item.getItemProperty(STATUS).setValue(statusObject.getStatus());
       }
       if (statusObject.getProgress() != null) {
         item.getItemProperty(PROGRESS).setValue(statusObject.getProgress());
       }
       item.getItemProperty(FILE_NAME).setValue(statusObject.getFilename());
       final SoftwareModule sw = statusObject.getSelectedSoftwareModule();
       item.getItemProperty(SPUILabelDefinitions.NAME_VERSION)
           .setValue(HawkbitCommonUtil.getFormattedNameVersion(sw.getName(), sw.getVersion()));
     }
     if (artifactUploadState.isUploadCompleted()) {
       minimizeButton.setEnabled(false);
     }
   }
 }
  private SoftwareModule convertToAmqpSoftwareModule(
      final Target target,
      final org.eclipse.hawkbit.repository.model.SoftwareModule softwareModule) {
    final SoftwareModule amqpSoftwareModule = new SoftwareModule();
    amqpSoftwareModule.setModuleId(softwareModule.getId());
    amqpSoftwareModule.setModuleType(softwareModule.getType().getKey());
    amqpSoftwareModule.setModuleVersion(softwareModule.getVersion());

    final List<Artifact> artifacts = convertArtifacts(target, softwareModule.getArtifacts());
    amqpSoftwareModule.setArtifacts(artifacts);
    return amqpSoftwareModule;
  }
Пример #4
0
 private static Artifact checkForExistingArtifact(
     final String filename, final boolean overrideExisting, final SoftwareModule softwareModule) {
   if (softwareModule.getArtifactByFilename(filename).isPresent()) {
     if (overrideExisting) {
       LOG.debug("overriding existing artifact with new filename {}", filename);
       return softwareModule.getArtifactByFilename(filename).get();
     } else {
       throw new EntityAlreadyExistsException(
           "File with that name already exists in the Software Module");
     }
   }
   return null;
 }
Пример #5
0
 @SuppressWarnings("unchecked")
 private void uploadRecevied(final String filename, final SoftwareModule softwareModule) {
   final Item item = uploads.addItem(getItemid(filename, softwareModule));
   if (item != null) {
     item.getItemProperty(FILE_NAME).setValue(filename);
     item.getItemProperty(SPUILabelDefinitions.NAME_VERSION)
         .setValue(
             HawkbitCommonUtil.getFormattedNameVersion(
                 softwareModule.getName(), softwareModule.getVersion()));
     final UploadStatusObject uploadStatus = new UploadStatusObject(filename, softwareModule);
     uploadStatus.setStatus("Active");
     artifactUploadState.getUploadedFileStatusList().add(uploadStatus);
   }
 }