use of org.eclipse.kapua.model.id.KapuaId in project kapua by eclipse.
the class Accounts method deleteAccount.
/**
* Deletes an account based on the information provided in Account parameter.
*
* @param accountId Provides the information to update the account.
* @return The updated created Account object.
*/
@DELETE
@Path("{accountId}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response deleteAccount(@PathParam("accountId") String accountId) {
try {
KapuaId accountKapuaId = KapuaEid.parseShortId(accountId);
KapuaId scopeId = KapuaSecurityUtils.getSession().getScopeId();
accountService.delete(scopeId, accountKapuaId);
} catch (Throwable t) {
handleException(t);
}
return Response.ok().build();
}
use of org.eclipse.kapua.model.id.KapuaId in project kapua by eclipse.
the class Accounts method getAccount.
/**
* Returns the Account specified by the "id" path parameter.
*
* @param accountId The id of the Account requested.
* @return The requested Account object.
*/
@GET
@Path("{accountId}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Account getAccount(@PathParam("accountId") String accountId) {
Account account = null;
try {
KapuaId id = KapuaEid.parseShortId(accountId);
account = accountService.find(id);
} catch (Throwable t) {
handleException(t);
}
return returnNotNullEntity(account);
}
use of org.eclipse.kapua.model.id.KapuaId in project kapua by eclipse.
the class Devices method getSnapshots.
/**
* Returns the list of all the Snapshots available on the device.
*
* @return The list of Snapshot Ids.
*/
@GET
@Path("{deviceId}/snapshots")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public DeviceSnapshots getSnapshots(@PathParam("deviceId") String deviceId) {
DeviceSnapshots deviceSnapshots = snapshotFactory.newDeviceSnapshots();
try {
KapuaId scopeId = KapuaSecurityUtils.getSession().getScopeId();
KapuaId id = KapuaEid.parseShortId(deviceId);
deviceSnapshots = snapshotService.get(scopeId, id, null);
} catch (Throwable t) {
handleException(t);
}
return returnNotNullEntity(deviceSnapshots);
}
use of org.eclipse.kapua.model.id.KapuaId in project kapua by eclipse.
the class Devices method uninstallPackage.
/**
* Uninstalls a package deployed on a device.
*
* @param deviceId
* The device ID of the Device requested.
* @param request
* Mandatory object with all the informations
* needed to uninstall a package.
* @return The list of the installed packages.
*/
@DELETE
@Path("{deviceId}/packages")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response uninstallPackage(@PathParam("deviceId") String deviceId, DevicePackageUninstallRequest request) {
try {
KapuaId scopeId = KapuaSecurityUtils.getSession().getScopeId();
KapuaId id = KapuaEid.parseShortId(deviceId);
packageService.uninstallExec(scopeId, id, request, null);
} catch (Throwable t) {
handleException(t);
}
return Response.ok().build();
}
use of org.eclipse.kapua.model.id.KapuaId in project kapua by eclipse.
the class Devices method installPackage.
/**
* Install a new deployment package on a device.
*
* @param deviceId
* The client ID of the Device requested.
* @param request
* Mandatory object with all the informations
* needed to download a package.
* @return The list of the installed packages.
*/
@POST
@Path("{deviceId}/packages")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response installPackage(@PathParam("deviceId") String deviceId, DevicePackageDownloadRequest request) {
try {
KapuaId scopeId = KapuaSecurityUtils.getSession().getScopeId();
KapuaId id = KapuaEid.parseShortId(deviceId);
packageService.downloadExec(scopeId, id, request, null);
} catch (Throwable t) {
handleException(t);
}
return Response.ok().build();
}
Aggregations