use of org.eclipse.kuksa.appstore.model.hawkbit.Artifact in project Eclipse-Kuksa-Automotive-Edge-Extension by max-grzanna.
the class ArtifactFileEditor method fillGrids.
public void fillGrids(String softwareModuleId) {
try {
List<Artifact> artifactResultList = hawkbitFeignClient.getArtifactsBysoftwareModuleId(softwareModuleId);
boolean permissionFileExists = false;
for (Iterator iterator = artifactResultList.iterator(); iterator.hasNext(); ) {
Artifact artifact = (Artifact) iterator.next();
if (artifact.getProvidedFilename().equals(Utils.PERMISSION)) {
permissionFileExists = true;
break;
}
}
if (permissionFileExists == false) {
new Notification("There is no " + Utils.PERMISSION + " file.", " You should add " + Utils.PERMISSION + " file to specify permissions that are used on this application!", Notification.Type.ERROR_MESSAGE).show(Page.getCurrent());
}
artifactGrid.setItems(artifactResultList);
} catch (Exception e) {
new Notification("Hawkbit connection error. Check your Hawkbit's IP in the propreties file!", Notification.Type.ERROR_MESSAGE).show(Page.getCurrent());
}
}
use of org.eclipse.kuksa.appstore.model.hawkbit.Artifact in project Eclipse-Kuksa-Automotive-Edge-Extension by max-grzanna.
the class AppService method downloadPermissionArtifactFile.
public String downloadPermissionArtifactFile(Long appId) throws BadRequestException, NotFoundException {
App currentApp = appRepository.findById(appId);
SoftwareModuleResult currentSoftwareModuleResult = hawkbitFeignClient.getSoftwaremoduleByName(Utils.createFIQLEqual("name", currentApp.getName()) + ";" + Utils.createFIQLEqual("version", currentApp.getVersion()));
List<Artifact> listArtifact = hawkbitFeignClient.getArtifactsBysoftwareModuleId(currentSoftwareModuleResult.getContent().get(0).getId().toString());
String artifactId = null;
for (Artifact artifact : listArtifact) {
if (artifact.getProvidedFilename().toUpperCase().equals(Utils.PERMISSION)) {
artifactId = artifact.getId();
break;
}
}
if (artifactId == null) {
return Utils.NOT_FOUND;
}
String responseDownloadArtifactFile = hawkbitFeignClient.downloadArtifactFile(currentSoftwareModuleResult.getContent().get(0).getId().toString(), artifactId);
return responseDownloadArtifactFile;
}
use of org.eclipse.kuksa.appstore.model.hawkbit.Artifact in project Eclipse-Kuksa-Automotive-Edge-Extension by max-grzanna.
the class ArtifactFileEditor method addDeleteColumn.
private void addDeleteColumn(String caption) {
ImageRenderer<Artifact> renderer = new ImageRenderer<>();
renderer.addClickListener(e -> {
try {
deleteArtifact(e.getItem());
} catch (NumberFormatException e2) {
e2.printStackTrace();
} catch (BadRequestException e2) {
e2.printStackTrace();
}
});
Grid.Column<Artifact, ThemeResource> iconColumn = artifactGrid.addColumn(i -> new ThemeResource("img/delete.png"), renderer);
iconColumn.setCaption(caption);
iconColumn.setMaximumWidth(100);
artifactGrid.addItemClickListener(e -> {
if (e.getColumn().equals(iconColumn)) {
try {
deleteArtifact(e.getItem());
} catch (NumberFormatException e1) {
e1.printStackTrace();
} catch (BadRequestException e1) {
e1.printStackTrace();
}
}
});
}
Aggregations