diff --git a/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/client/device/inventory/DeviceTabInventoryTabBundles.java b/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/client/device/inventory/DeviceTabInventoryTabBundles.java index e65269f142c..a44e42fc422 100644 --- a/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/client/device/inventory/DeviceTabInventoryTabBundles.java +++ b/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/client/device/inventory/DeviceTabInventoryTabBundles.java @@ -28,8 +28,10 @@ import com.extjs.gxt.ui.client.widget.ContentPanel; import com.extjs.gxt.ui.client.widget.button.Button; import com.extjs.gxt.ui.client.widget.grid.ColumnConfig; +import com.extjs.gxt.ui.client.widget.grid.ColumnData; import com.extjs.gxt.ui.client.widget.grid.ColumnModel; import com.extjs.gxt.ui.client.widget.grid.Grid; +import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; import com.extjs.gxt.ui.client.widget.layout.FitLayout; import com.extjs.gxt.ui.client.widget.toolbar.ToolBar; import com.google.gwt.core.client.GWT; @@ -117,6 +119,18 @@ protected void onRender(Element parent, int index) { column.setWidth(80); configs.add(column); + column = new ColumnConfig(); + column.setId("signed"); + column.setHeader("Signed"); + column.setWidth(50); + column.setRenderer(new GridCellRenderer() { + @Override + public Object render(GwtInventoryBundle gwtInventoryBundle, String property, ColumnData columnData, int col, int row, ListStore listStore, Grid grid) { + return gwtInventoryBundle.getSigned() != null ? gwtInventoryBundle.getSigned() : "N/A"; + } + }); + configs.add(column); + ColumnModel columnModel = new ColumnModel(configs); RpcProxy> proxy = new RpcProxy>() { diff --git a/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/server/GwtDeviceInventoryManagementServiceImpl.java b/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/server/GwtDeviceInventoryManagementServiceImpl.java index 0a7d79a3275..eb92fd7b904 100644 --- a/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/server/GwtDeviceInventoryManagementServiceImpl.java +++ b/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/server/GwtDeviceInventoryManagementServiceImpl.java @@ -97,6 +97,7 @@ public ListLoadResult findDeviceBundles(String scopeIdString gwtInventoryBundle.setName(inventoryBundle.getName()); gwtInventoryBundle.setVersion(inventoryBundle.getVersion()); gwtInventoryBundle.setStatus(inventoryBundle.getStatus()); + gwtInventoryBundle.setSigned(inventoryBundle.getSigned()); gwtInventoryBundles.add(gwtInventoryBundle); } @@ -183,6 +184,7 @@ public List findDeviceDeploymentPackages(String s inventoryBundle.setName(bundleInfo.getName()); inventoryBundle.setVersion(bundleInfo.getVersion()); inventoryBundle.setStatus(bundleInfo.getStatus()); + inventoryBundle.setSigned(bundleInfo.getSigned()); gwtPackageBundles.add(inventoryBundle); } diff --git a/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/shared/model/management/inventory/GwtInventoryBundle.java b/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/shared/model/management/inventory/GwtInventoryBundle.java index e4bbc4aa2e8..c8ff7b26605 100644 --- a/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/shared/model/management/inventory/GwtInventoryBundle.java +++ b/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/shared/model/management/inventory/GwtInventoryBundle.java @@ -50,4 +50,12 @@ public String getStatus() { return get("status"); } + public void setSigned(Boolean signed) { + set("signed", signed); + } + + public Boolean getSigned() { + return get("signed"); + } + } diff --git a/rest-api/resources/src/main/resources/openapi/deviceInventory/deviceInventory.yaml b/rest-api/resources/src/main/resources/openapi/deviceInventory/deviceInventory.yaml index f1d42ae6b5b..71cd2919ccf 100644 --- a/rest-api/resources/src/main/resources/openapi/deviceInventory/deviceInventory.yaml +++ b/rest-api/resources/src/main/resources/openapi/deviceInventory/deviceInventory.yaml @@ -55,11 +55,14 @@ components: type: string status: type: string + signed: + type: boolean example: id: 0 name: org.eclipse.osgi version: 3.16.0.v20200828-0759 status: ACTIVE + signed: false deviceInventoryBundles: type: object properties: diff --git a/service/device/call/kura/src/main/java/org/eclipse/kapua/service/device/call/kura/model/inventory/bundles/KuraInventoryBundle.java b/service/device/call/kura/src/main/java/org/eclipse/kapua/service/device/call/kura/model/inventory/bundles/KuraInventoryBundle.java index 502449d89af..0c53a8d10d5 100644 --- a/service/device/call/kura/src/main/java/org/eclipse/kapua/service/device/call/kura/model/inventory/bundles/KuraInventoryBundle.java +++ b/service/device/call/kura/src/main/java/org/eclipse/kapua/service/device/call/kura/model/inventory/bundles/KuraInventoryBundle.java @@ -35,6 +35,9 @@ public class KuraInventoryBundle { @JsonProperty("state") public String state; + @JsonProperty("signed") + public Boolean signed; + /** * Gets the identifier. * @@ -114,4 +117,24 @@ public String getState() { public void setState(String state) { this.state = state; } + + /** + * Whether the bundle is signed. + * + * @return {@code true} if is signed, {@code false} if not or {@code null} if the information is not known. + * @since 1.6.0 + */ + public Boolean getSigned() { + return signed; + } + + /** + * Sets whether the bundle is signed. + * + * @param signed {@code true} if is signed, {@code false} if not or {@code null} if the information is not known. + * @since 1.6.0 + */ + public void setSigned(Boolean signed) { + this.signed = signed; + } } diff --git a/service/device/management/inventory/api/src/main/java/org/eclipse/kapua/service/device/management/inventory/model/bundle/DeviceInventoryBundle.java b/service/device/management/inventory/api/src/main/java/org/eclipse/kapua/service/device/management/inventory/model/bundle/DeviceInventoryBundle.java index 84491f4ce94..c1763d2a7e0 100644 --- a/service/device/management/inventory/api/src/main/java/org/eclipse/kapua/service/device/management/inventory/model/bundle/DeviceInventoryBundle.java +++ b/service/device/management/inventory/api/src/main/java/org/eclipse/kapua/service/device/management/inventory/model/bundle/DeviceInventoryBundle.java @@ -97,4 +97,20 @@ public interface DeviceInventoryBundle { * @since 1.5.0 */ void setStatus(String status); + + /** + * Whether the bundle is signed. + * + * @return {@code true} if is signed, {@code false} if not or {@code null} if the information is not known. + * @since 1.6.0 + */ + Boolean getSigned(); + + /** + * Sets whether the bundle is signed. + * + * @param signed {@code true} if is signed, {@code false} if not or {@code null} if the information is not known. + * @since 1.6.0 + */ + void setSigned(Boolean signed); } diff --git a/service/device/management/inventory/internal/src/main/java/org/eclipse/kapua/service/device/management/inventory/model/bundle/internal/DeviceInventoryBundleImpl.java b/service/device/management/inventory/internal/src/main/java/org/eclipse/kapua/service/device/management/inventory/model/bundle/internal/DeviceInventoryBundleImpl.java index 4e95b01c380..8802c5f1211 100644 --- a/service/device/management/inventory/internal/src/main/java/org/eclipse/kapua/service/device/management/inventory/model/bundle/internal/DeviceInventoryBundleImpl.java +++ b/service/device/management/inventory/internal/src/main/java/org/eclipse/kapua/service/device/management/inventory/model/bundle/internal/DeviceInventoryBundleImpl.java @@ -25,6 +25,7 @@ public class DeviceInventoryBundleImpl implements DeviceInventoryBundle { private String name; private String version; private String status; + private Boolean signed; /** * Constructor. @@ -73,4 +74,14 @@ public String getStatus() { public void setStatus(String status) { this.status = status; } + + @Override + public Boolean getSigned() { + return signed; + } + + @Override + public void setSigned(Boolean signed) { + this.signed = signed; + } } diff --git a/translator/kapua/kura/src/main/java/org/eclipse/kapua/translator/kapua/kura/inventory/TranslatorAppInventoryBundleExecKapuaKura.java b/translator/kapua/kura/src/main/java/org/eclipse/kapua/translator/kapua/kura/inventory/TranslatorAppInventoryBundleExecKapuaKura.java index 4dc5c2c3a7c..3a61363db99 100644 --- a/translator/kapua/kura/src/main/java/org/eclipse/kapua/translator/kapua/kura/inventory/TranslatorAppInventoryBundleExecKapuaKura.java +++ b/translator/kapua/kura/src/main/java/org/eclipse/kapua/translator/kapua/kura/inventory/TranslatorAppInventoryBundleExecKapuaKura.java @@ -73,6 +73,7 @@ protected KuraRequestPayload translatePayload(InventoryRequestPayload inventoryR KuraInventoryBundle kuraInventoryBundle = new KuraInventoryBundle(); kuraInventoryBundle.setName(deviceInventoryBundle.getName()); kuraInventoryBundle.setVersion(deviceInventoryBundle.getVersion()); + kuraInventoryBundle.setSigned(deviceInventoryBundle.getSigned()); kuraRequestPayload.setBody(getJsonMapper().writeValueAsString(kuraInventoryBundle).getBytes(CHAR_ENCODING)); } diff --git a/translator/kapua/kura/src/main/java/org/eclipse/kapua/translator/kura/kapua/inventory/AbstractTranslatorAppInventoryKuraKapua.java b/translator/kapua/kura/src/main/java/org/eclipse/kapua/translator/kura/kapua/inventory/AbstractTranslatorAppInventoryKuraKapua.java index f09f1043069..350f4580fee 100644 --- a/translator/kapua/kura/src/main/java/org/eclipse/kapua/translator/kura/kapua/inventory/AbstractTranslatorAppInventoryKuraKapua.java +++ b/translator/kapua/kura/src/main/java/org/eclipse/kapua/translator/kura/kapua/inventory/AbstractTranslatorAppInventoryKuraKapua.java @@ -107,6 +107,7 @@ protected DeviceInventoryBundles translate(KuraInventoryBundles kuraInventoryBun deviceInventoryBundle.setName(kuraInventoryBundle.getName()); deviceInventoryBundle.setVersion(kuraInventoryBundle.getVersion()); deviceInventoryBundle.setStatus(kuraInventoryBundle.getState()); + deviceInventoryBundle.setSigned(kuraInventoryBundle.getSigned()); deviceInventoryBundles.addInventoryBundle(deviceInventoryBundle); });