Search in sources :

Example 16 with UserId

use of de.metas.user.UserId in project metasfresh-webui-api by metasfresh.

the class NotificationRestController method deleteByIds.

@DeleteMapping
public void deleteByIds(@RequestParam(name = "ids") final String notificationIdsListStr) {
    userSession.assertLoggedIn();
    final UserId adUserId = userSession.getLoggedUserId();
    final List<String> notificationIds = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(notificationIdsListStr);
    if (notificationIds.isEmpty()) {
        throw new AdempiereException("No IDs provided");
    }
    notificationIds.forEach(notificationId -> userNotificationsService.deleteNotification(adUserId, notificationId));
}
Also used : UserId(de.metas.user.UserId) AdempiereException(org.adempiere.exceptions.AdempiereException) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping)

Example 17 with UserId

use of de.metas.user.UserId in project metasfresh-webui-api by metasfresh.

the class NotificationRestController method getNotifications.

@GetMapping("/all")
public JSONNotificationsList getNotifications(// 
@RequestParam(name = "limit", defaultValue = "-1") final int limit) {
    userSession.assertLoggedIn();
    final UserId adUserId = userSession.getLoggedUserId();
    final UserNotificationsList notifications = userNotificationsService.getNotifications(adUserId, limit);
    final JSONOptions jsonOpts = JSONOptions.of(userSession);
    return JSONNotificationsList.of(notifications, jsonOpts);
}
Also used : JSONOptions(de.metas.ui.web.window.datatypes.json.JSONOptions) UserId(de.metas.user.UserId) UserNotificationsList(de.metas.notification.UserNotificationsList) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 18 with UserId

use of de.metas.user.UserId in project metasfresh-webui-api by metasfresh.

the class NotificationRestController method markAllAsRead.

@PutMapping("/all/read")
public void markAllAsRead() {
    userSession.assertLoggedIn();
    final UserId adUserId = userSession.getLoggedUserId();
    userNotificationsService.markAllNotificationsAsRead(adUserId);
}
Also used : UserId(de.metas.user.UserId) PutMapping(org.springframework.web.bind.annotation.PutMapping)

Example 19 with UserId

use of de.metas.user.UserId in project metasfresh-webui-api by metasfresh.

the class NotificationRestController method deleteById.

@DeleteMapping("/{notificationId}")
public void deleteById(@PathVariable("notificationId") final String notificationId) {
    userSession.assertLoggedIn();
    final UserId adUserId = userSession.getLoggedUserId();
    userNotificationsService.deleteNotification(adUserId, notificationId);
}
Also used : UserId(de.metas.user.UserId) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping)

Example 20 with UserId

use of de.metas.user.UserId in project metasfresh-webui-api by metasfresh.

the class NotificationRestController method deleteAll.

@DeleteMapping("/all")
public void deleteAll() {
    userSession.assertLoggedIn();
    final UserId adUserId = userSession.getLoggedUserId();
    userNotificationsService.deleteAllNotification(adUserId);
}
Also used : UserId(de.metas.user.UserId) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping)

Aggregations

UserId (de.metas.user.UserId)22 AdempiereException (org.adempiere.exceptions.AdempiereException)4 GetMapping (org.springframework.web.bind.annotation.GetMapping)4 BoilerPlateContext (de.metas.letters.model.MADBoilerPlate.BoilerPlateContext)3 DocumentPath (de.metas.ui.web.window.datatypes.DocumentPath)3 LookupValue (de.metas.ui.web.window.datatypes.LookupValue)3 JSONDocumentPath (de.metas.ui.web.window.datatypes.json.JSONDocumentPath)3 ApiOperation (io.swagger.annotations.ApiOperation)3 DeleteMapping (org.springframework.web.bind.annotation.DeleteMapping)3 PostMapping (org.springframework.web.bind.annotation.PostMapping)3 ImmutableSet (com.google.common.collect.ImmutableSet)2 BPartnerId (de.metas.bpartner.BPartnerId)2 Principal (de.metas.security.Principal)2 Access (de.metas.security.permissions.Access)2 I_AD_User (org.compiere.model.I_AD_User)2 Supplier (com.google.common.base.Supplier)1 ImmutableList (com.google.common.collect.ImmutableList)1 BPartnerLocationId (de.metas.bpartner.BPartnerLocationId)1 DataEntryFieldId (de.metas.dataentry.DataEntryFieldId)1 FieldType (de.metas.dataentry.FieldType)1