@Override public ResponseEntity<List<MgmtSoftwareModule>> createSoftwareModules( @RequestBody final List<MgmtSoftwareModuleRequestBodyPost> softwareModules) { LOG.debug("creating {} softwareModules", softwareModules.size()); final Collection<SoftwareModule> createdSoftwareModules = softwareModuleManagement .create(MgmtSoftwareModuleMapper.smFromRequest(entityFactory, softwareModules)); LOG.debug("{} softwareModules created, return status {}", softwareModules.size(), HttpStatus.CREATED); return ResponseEntity.status(HttpStatus.CREATED) .body(MgmtSoftwareModuleMapper.toResponse(createdSoftwareModules)); }
final boolean isRequiredMigrationStep) { final SoftwareModule appMod = softwareModuleManagement.create(entityFactory.softwareModule().create() .type(findOrCreateSoftwareModuleType(SM_TYPE_APP, Integer.MAX_VALUE)).name(prefix + SM_TYPE_APP) .version(version + "." + new SecureRandom().nextInt(100)).description(LOREM.words(20)) .vendor(prefix + " vendor Limited, California")); final SoftwareModule runtimeMod = softwareModuleManagement .create(entityFactory.softwareModule().create().type(findOrCreateSoftwareModuleType(SM_TYPE_RT)) .name(prefix + "app runtime").version(version + "." + new SecureRandom().nextInt(100)) .description(LOREM.words(20)).vendor(prefix + " vendor GmbH, Stuttgart, Germany")); final SoftwareModule osMod = softwareModuleManagement .create(entityFactory.softwareModule().create().type(findOrCreateSoftwareModuleType(SM_TYPE_OS)) .name(prefix + " Firmware").version(version + "." + new SecureRandom().nextInt(100)) .description(LOREM.words(20)).vendor(prefix + " vendor Limited Inc, California"));
/** * Creates {@link SoftwareModule} with {@link #DEFAULT_VENDOR} and * {@link #DEFAULT_VERSION} and random generated * {@link Target#getDescription()} in the repository. * * @param typeKey * of the {@link SoftwareModuleType} * @param prefix * added to name and version * * @return persisted {@link SoftwareModule}. */ public SoftwareModule createSoftwareModule(final String typeKey, final String prefix) { return softwareModuleManagement.create(entityFactory.softwareModule().create() .type(findOrCreateSoftwareModuleType(typeKey)).name(prefix + typeKey).version(prefix + DEFAULT_VERSION) .description(LOREM.words(10)).vendor(DEFAULT_VENDOR)); }
final boolean isRequiredMigrationStep) { final SoftwareModule appMod = softwareModuleManagement.create(entityFactory.softwareModule().create() .type(findOrCreateSoftwareModuleType(SM_TYPE_APP, Integer.MAX_VALUE)).name(prefix + SM_TYPE_APP) .version(version + "." + new SecureRandom().nextInt(100)).description(LOREM.words(20)) .vendor(prefix + " vendor Limited, California")); final SoftwareModule runtimeMod = softwareModuleManagement .create(entityFactory.softwareModule().create().type(findOrCreateSoftwareModuleType(SM_TYPE_RT)) .name(prefix + "app runtime").version(version + "." + new SecureRandom().nextInt(100)) .description(LOREM.words(20)).vendor(prefix + " vendor GmbH, Stuttgart, Germany")); final SoftwareModule osMod = softwareModuleManagement .create(entityFactory.softwareModule().create().type(findOrCreateSoftwareModuleType(SM_TYPE_OS)) .name(prefix + " Firmware").version(version + "." + new SecureRandom().nextInt(100)) .description(LOREM.words(20)).vendor(prefix + " vendor Limited Inc, California"));
/** * Creates {@link SoftwareModule} with {@link #DEFAULT_VENDOR} and * {@link #DEFAULT_VERSION} and random generated * {@link Target#getDescription()} in the repository. * * @param typeKey * of the {@link SoftwareModuleType} * @param prefix * added to name and version * * @return persisted {@link SoftwareModule}. */ public SoftwareModule createSoftwareModule(final String typeKey, final String prefix) { return softwareModuleManagement.create(entityFactory.softwareModule().create() .type(findOrCreateSoftwareModuleType(typeKey)).name(prefix + typeKey).version(prefix + DEFAULT_VERSION) .description(LOREM.words(10)).vendor(DEFAULT_VENDOR)); }
private void addNewBaseSoftware() { final String name = nameTextField.getValue(); final String version = versionTextField.getValue(); final String vendor = vendorTextField.getValue(); final String description = descTextArea.getValue(); final String type = typeComboBox.getValue() != null ? typeComboBox.getValue().toString() : null; final SoftwareModuleType softwareModuleTypeByName = softwareModuleTypeManagement.getByName(type) .orElseThrow(() -> new EntityNotFoundException(SoftwareModuleType.class, type)); final SoftwareModuleCreate softwareModule = entityFactory.softwareModule().create() .type(softwareModuleTypeByName).name(name).version(version).description(description).vendor(vendor); final SoftwareModule newSoftwareModule = softwareModuleManagement.create(softwareModule); eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.ADD_ENTITY, newSoftwareModule)); uiNotifcation.displaySuccess(i18n.getMessage("message.save.success", new Object[] { newSoftwareModule.getName() + ":" + newSoftwareModule.getVersion() })); softwareModuleTable.setValue(Sets.newHashSet(newSoftwareModule.getId())); }
private void addNewBaseSoftware() { final String name = nameTextField.getValue(); final String version = versionTextField.getValue(); final String vendor = vendorTextField.getValue(); final String description = descTextArea.getValue(); final String type = typeComboBox.getValue() != null ? typeComboBox.getValue().toString() : null; final SoftwareModuleType softwareModuleTypeByName = softwareModuleTypeManagement.getByName(type) .orElseThrow(() -> new EntityNotFoundException(SoftwareModuleType.class, type)); final SoftwareModuleCreate softwareModule = entityFactory.softwareModule().create() .type(softwareModuleTypeByName).name(name).version(version).description(description).vendor(vendor); final SoftwareModule newSoftwareModule = softwareModuleManagement.create(softwareModule); eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.ADD_ENTITY, newSoftwareModule)); uiNotifcation.displaySuccess(i18n.getMessage("message.save.success", newSoftwareModule.getName() + ":" + newSoftwareModule.getVersion())); softwareModuleTable.setValue(Sets.newHashSet(newSoftwareModule.getId())); }