Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ dependencyManagement {
}

dependency 'org.owasp.esapi:esapi:2.4.0.0'
dependency 'org.awaitility:awaitility:4.2.0'

dependencySet(group: 'org.apache.poi', version: '5.2.2') {
entry 'poi'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
*/
package org.apache.fineract.notification.api;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
Expand All @@ -28,6 +34,7 @@
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
Expand All @@ -36,37 +43,31 @@
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.notification.data.NotificationData;
import org.apache.fineract.notification.service.NotificationReadPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Path("/notifications")
@Component
@Scope("singleton")

@Tag(name = "Notification", description = "")
@RequiredArgsConstructor
public class NotificationApiResource {

private final PlatformSecurityContext context;
private final NotificationReadPlatformService notificationReadPlatformService;
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final ToApiJsonSerializer<NotificationData> toApiJsonSerializer;

@Autowired
public NotificationApiResource(PlatformSecurityContext context, NotificationReadPlatformService notificationReadPlatformService,
ApiRequestParameterHelper apiRequestParameterHelper, ToApiJsonSerializer<NotificationData> toApiJsonSerializer) {
this.context = context;
this.notificationReadPlatformService = notificationReadPlatformService;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.toApiJsonSerializer = toApiJsonSerializer;
}

@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String getAllNotifications(@Context final UriInfo uriInfo, @QueryParam("orderBy") final String orderBy,
@QueryParam("limit") final Integer limit, @QueryParam("offset") final Integer offset,
@QueryParam("sortOrder") final String sortOrder, @QueryParam("isRead") final boolean isRead) {
@Operation
@ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = NotificationApiResourceSwagger.GetNotificationsResponse.class))) })
public String getAllNotifications(@Context final UriInfo uriInfo,
@QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy,
@QueryParam("limit") @Parameter(description = "limit") final Integer limit,
@QueryParam("offset") @Parameter(description = "offset") final Integer offset,
@QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder,
@QueryParam("isRead") @Parameter(description = "isRead") final boolean isRead) {

this.context.authenticatedUser();
final Page<NotificationData> notificationData;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.notification.api;

import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;

final class NotificationApiResourceSwagger {

private NotificationApiResourceSwagger() {}

@Schema(description = "GetNotificationsResponse")
public static final class GetNotificationsResponse {

private GetNotificationsResponse() {}

static final class GetNotification {

private GetNotification() {}

@Schema(example = "1")
public Long id;
@Schema(example = "a")
public String objectType;
@Schema(example = "1")
public Long objectId;
@Schema(example = "a")
public String action;
@Schema(example = "1")
public Long actorId;
@Schema(example = "a")
public String content;
@Schema(example = "true")
public boolean isRead;
@Schema(example = "true")
public boolean isSystemGenerated;
@Schema(example = "a")
public String tenantIdentifier;
@Schema(example = "a")
public String createdAt;
@Schema(example = "1")
public Long officeId;
@Schema(example = "[]")
public List<Long> userIds;
}

@Schema(example = "10")
public int totalFilteredRecords;

public List<GetNotification> pageItems;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
package org.apache.fineract.notification.data;

import java.io.Serializable;
import java.util.List;
import java.util.Set;
import lombok.Data;

@Data
public class NotificationData implements Serializable {

private Long id;
Expand All @@ -34,12 +36,12 @@ public class NotificationData implements Serializable {
private String tenantIdentifier;
private String createdAt;
private Long officeId;
private List<Long> userIds;
private Set<Long> userIds;

public NotificationData() {}

public NotificationData(String objectType, Long objectId, String action, Long actorId, String content, boolean isSystemGenerated,
boolean isRead, String tenantIdentifier, Long officeId, List<Long> userIds) {
boolean isRead, String tenantIdentifier, Long officeId, Set<Long> userIds) {
this.objectType = objectType;
this.objectId = objectId;
this.action = action;
Expand All @@ -51,100 +53,4 @@ public NotificationData(String objectType, Long objectId, String action, Long ac
this.officeId = officeId;
this.userIds = userIds;
}

public Long getOfficeId() {
return officeId;
}

public void setOfficeId(Long officeId) {
this.officeId = officeId;
}

public List<Long> getUserIds() {
return userIds;
}

public void setUserId(List<Long> userIds) {
this.userIds = userIds;
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public String getCreatedAt() {
return createdAt;
}

public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}

public String getObjectType() {
return objectType;
}

public void setObjectType(String objectType) {
this.objectType = objectType;
}

public Long getObjectIdentfier() {
return objectId;
}

public void entifier(Long objectIdentifier) {
this.objectId = objectIdentifier;
}

public String getAction() {
return action;
}

public void setAction(String action) {
this.action = action;
}

public Long getActor() {
return actorId;
}

public void setActor(Long actorId) {
this.actorId = actorId;
}

public String getContent() {
return content;
}

public void setContent(String content) {
this.content = content;
}

public boolean isRead() {
return this.isRead;
}

public void setRead(boolean isRead) {
this.isRead = isRead;
}

public boolean isSystemGenerated() {
return isSystemGenerated;
}

public void setSystemGenerated(boolean systemGenerated) {
isSystemGenerated = systemGenerated;
}

public String getTenantIdentifier() {
return tenantIdentifier;
}

public void setTenantIdentifier(String tenantIdentifier) {
this.tenantIdentifier = tenantIdentifier;
}
}

This file was deleted.

Loading