use of javax.validation.constraints.NotNull in project OsmAnd-tools by osmandapp.
the class GpxController method attachSrtm.
@PostMapping(path = { "/process-srtm" }, produces = "application/json")
public ResponseEntity<StreamingResponseBody> attachSrtm(@RequestPart(name = "file") @Valid @NotNull @NotEmpty MultipartFile file) throws IOException {
GPXFile gpxFile = GPXUtilities.loadGPXFile(file.getInputStream());
GPXFile srtmGpx = calculateSrtmAltitude(gpxFile, null);
StreamingResponseBody responseBody = outputStream -> {
GPXUtilities.writeGpx(new OutputStreamWriter(outputStream), srtmGpx, IProgress.EMPTY_PROGRESS);
};
return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + file.getName()).contentType(MediaType.APPLICATION_XML).body(responseBody);
}
use of javax.validation.constraints.NotNull in project che by eclipse.
the class RecipeEditorViewImpl method createButton.
@NotNull
private EditorButtonWidget createButton(@NotNull String title, @NotNull EditorButtonWidget.ActionDelegate delegate, @NotNull EditorButtonWidgetImpl.Background background) {
EditorButtonWidget button = widgetFactory.createEditorButton(title, background);
button.setDelegate(delegate);
buttonsPanel.add(button);
return button;
}
use of javax.validation.constraints.NotNull in project che by eclipse.
the class NodeLoader method onLoadFailure.
/**
* Called when children haven't been successfully loaded.
* Also fire {@link org.eclipse.che.ide.ui.smartTree.event.LoadExceptionEvent} event.
*
* @param parent
* parent node, children which haven't been loaded
* @return instance of {@link org.eclipse.che.api.promises.client.Operation} which contains promise with error
*/
@NotNull
private Operation<PromiseError> onLoadFailure(@NotNull final Node parent) {
return new Operation<PromiseError>() {
@Override
public void apply(PromiseError t) throws OperationException {
childRequested.remove(parent);
fireEvent(new LoadExceptionEvent(parent, t.getCause()));
}
};
}
use of javax.validation.constraints.NotNull in project che by eclipse.
the class PartButtonWidget method setIcon.
/** {@inheritDoc} */
@NotNull
@Override
public PartButton setIcon(@Nullable SVGResource iconResource) {
this.tabIcon = iconResource;
iconPanel.clear();
if (tabIcon != null) {
iconPanel.add(new SVGImage(tabIcon));
}
return this;
}
use of javax.validation.constraints.NotNull in project ddf by codice.
the class MigratableUtil method copyFileFromJavaPropertyValue.
/**
* Copies a file, whose path is taken from the value a Java properties file, to a destination.
* directory. The file to copy must be a relative path under {@code ddf.home}, and its path
* must not contain any symbolic link, otherwise the file will not be copied and a
* {@link MigrationWarning} will be returned.
*
* @param propertyFilePath path to the Java properties file that contains the path to the
* source file to copy
* @param javaProperty name of the property inside the Java properties file that contains
* the path to the source file
* @param exportDirectory path to the destination
* @param warnings any warnings generated during this operation (e.g., source file
* outside of {@code ddf.home}) will be added to this collection
*/
public void copyFileFromJavaPropertyValue(@NotNull Path propertyFilePath, @NotNull String javaProperty, @NotNull Path exportDirectory, @NotNull Collection<MigrationWarning> warnings) throws MigrationException {
notNull(propertyFilePath, "Java properties file cannot be null");
Properties properties = readPropertiesFile(ddfHome.resolve(propertyFilePath));
String source = (String) properties.get(javaProperty);
notEmpty(source, String.format("Source path property [%s] is invalid: [%s]", javaProperty, source));
Path sourcePath = Paths.get(source);
copy(sourcePath, exportDirectory, warnings, () -> isSourceMigratable(sourcePath, (reason) -> new PathMigrationWarning(propertyFilePath, javaProperty, sourcePath, reason), warnings));
}
Aggregations