use of org.eclipse.kapua.app.console.shared.model.GwtBundleInfo in project kapua by eclipse.
the class DeviceTabPackagesInstalled method refresh.
public void refresh() {
if (m_dirty && m_initialized) {
GwtDevice selectedDevice = getSelectedDevice();
if (selectedDevice == null || !selectedDevice.isOnline()) {
m_treeStore.removeAll();
m_treeGrid.unmask();
m_treeGrid.getView().setEmptyText(MSGS.deviceNoDeviceSelectedOrOffline());
} else {
m_treeGrid.mask(MSGS.loading());
gwtDeviceManagementService.findDevicePackages(selectedDevice.getScopeId(), selectedDevice.getId(), new AsyncCallback<List<GwtDeploymentPackage>>() {
@Override
public void onSuccess(List<GwtDeploymentPackage> packages) {
m_treeStore.removeAll();
if (packages != null && !packages.isEmpty()) {
for (GwtDeploymentPackage pkg : packages) {
m_treeStore.add(pkg, false);
if (pkg.getBundleInfos() != null) {
for (GwtBundleInfo bundle : pkg.getBundleInfos()) {
m_treeStore.add(pkg, bundle, false);
}
}
}
} else {
m_rootTabPanel.getUninstallButton().disable();
m_treeGrid.getView().setEmptyText(MSGS.deviceNoPackagesInstalled());
m_treeGrid.getView().refresh(false);
}
m_treeGrid.unmask();
}
@Override
public void onFailure(Throwable caught) {
FailureHandler.handle(caught);
m_treeGrid.unmask();
}
});
}
m_dirty = false;
}
}
use of org.eclipse.kapua.app.console.shared.model.GwtBundleInfo in project kapua by eclipse.
the class GwtDeviceManagementServiceImpl method findDevicePackages.
//
// Packages
//
@Override
public List<GwtDeploymentPackage> findDevicePackages(String scopeShortId, String deviceShortId) throws GwtKapuaException {
List<GwtDeploymentPackage> gwtPkgs = new ArrayList<GwtDeploymentPackage>();
try {
KapuaLocator locator = KapuaLocator.getInstance();
DevicePackageManagementService deviceManagementService = locator.getService(DevicePackageManagementService.class);
KapuaId scopeId = KapuaEid.parseShortId(scopeShortId);
KapuaId deviceId = KapuaEid.parseShortId(deviceShortId);
DevicePackages deploymentPackages = deviceManagementService.getInstalled(scopeId, deviceId, null);
for (DevicePackage deploymentPackage : deploymentPackages.getPackages()) {
GwtDeploymentPackage gwtPkg = new GwtDeploymentPackage();
gwtPkg.setName(deploymentPackage.getName());
gwtPkg.setVersion(deploymentPackage.getVersion());
DevicePackageBundleInfos devicePackageBundleInfos = deploymentPackage.getBundleInfos();
if (devicePackageBundleInfos != null) {
List<GwtBundleInfo> gwtBundleInfos = new ArrayList<GwtBundleInfo>();
for (DevicePackageBundleInfo bundleInfo : devicePackageBundleInfos.getBundlesInfos()) {
GwtBundleInfo gwtBundleInfo = new GwtBundleInfo();
gwtBundleInfo.setName(bundleInfo.getName());
gwtBundleInfo.setVersion(bundleInfo.getVersion());
gwtBundleInfos.add(gwtBundleInfo);
}
gwtPkg.setBundleInfos(gwtBundleInfos);
}
gwtPkgs.add(gwtPkg);
}
} catch (Throwable t) {
KapuaExceptionHandler.handle(t);
}
return gwtPkgs;
}
Aggregations