Skip to content

Commit

Permalink
Merge the changes for UXPROD-5001
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonAntonich authored and gurleenkaurbp committed Jan 20, 2025
1 parent efa4789 commit 1cdeae9
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ramls/raml-util
Submodule raml-util updated 54 files
+89 −0 .github/workflows/api-doc.yml
+59 −0 .github/workflows/api-lint.yml
+40 −0 .github/workflows/api-schema-lint.yml
+0 −65 Jenkinsfile
+2 −3 README.md
+25 −16 examples/codex/packageCollection.sample
+0 −169 examples/mod-users/userdata.json.sample
+0 −53 examples/mod-users/users.raml.sample
+0 −7 examples/moduleInfo.sample
+0 −23 examples/tagged-record-example/user.sample
+7 −0 examples/tenantAttributes.sample
+17 −0 examples/tenantJob.sample
+14 −0 library/ramltojaxrs.raml
+0 −3 ramls/codex/codex-instances-sources.raml
+0 −1 ramls/codex/codex-packages.raml
+0 −1 ramls/codex/codex.raml
+1 −2 ramls/jsonSchemas.raml
+1 −2 ramls/ramls.raml
+0 −53 ramls/tagged-record-example/users.raml
+62 −46 ramls/tenant.raml
+0 −1 rtypes/attachments.raml
+0 −1 rtypes/collection-get-with-json-response.raml
+0 −1 rtypes/collection-get.raml
+1 −2 rtypes/collection-stream.raml
+0 −1 rtypes/collection-with-json-response.raml
+0 −1 rtypes/collection.raml
+0 −1 rtypes/get-delete-with-json-response.raml
+0 −1 rtypes/get-delete.raml
+0 −1 rtypes/get-only-with-json-response.raml
+0 −1 rtypes/get-only.raml
+0 −1 rtypes/item-collection-get-with-json-response.raml
+0 −1 rtypes/item-collection-get.raml
+5 −1 rtypes/item-collection-with-json-response.raml
+5 −2 rtypes/item-collection.raml
+0 −1 rtypes/post-empty-body.raml
+1 −0 schemas/codex/codex_instance_cqlschema-ext.json
+1 −0 schemas/codex/codex_instance_cqlschema.json
+1 −0 schemas/codex/codex_package_cqlschema-ext.json
+1 −0 schemas/codex/codex_package_cqlschema.json
+3 −1 schemas/codex/packageType.json
+2 −2 schemas/codex/source.json
+1 −1 schemas/error.schema
+1 −0 schemas/errors.schema
+1 −0 schemas/metadata.schema
+0 −24 schemas/moduleInfo.schema
+1 −0 schemas/parameters.schema
+10 −1 schemas/resultInfo.schema
+1 −0 schemas/tags.schema
+24 −0 schemas/tenantAttributes.schema
+36 −0 schemas/tenantJob.schema
+1 −0 schemas/uuid.schema
+8 −0 traits/internal-error.raml
+0 −9 traits/language.raml
+9 −1 traits/pageable.raml
56 changes: 55 additions & 1 deletion ramls/request.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"requestLevel": {
"description": "Level of the request - Item or Title",
"type": "string",
"enum": ["Item"]
"enum": ["Item", "Title"]
},
"requestDate": {
"description": "Date the request was made",
Expand Down Expand Up @@ -358,6 +358,56 @@
}
}
},
"printDetails": {
"description": "The print details of the request",
"type": "object",
"readonly": true,
"properties": {
"printCount": {
"description": "Total no of times the request is printed",
"type": "integer",
"readOnly": true
},
"requesterId": {
"description": "User uuid of last print requester",
"type": "string",
"readOnly": true
},
"isPrinted": {
"description": "Whether the request is ever printed",
"type": "boolean",
"readOnly": true
},
"printEventDate": {
"description": "Recent printed time of the request",
"type": "string",
"format": "date-time",
"readOnly": true
},
"lastPrintRequester": {
"description": "Details of the User who printed the request recently",
"readonly": true,
"type": "object",
"properties": {
"firstName": {
"description": "first name of the user",
"type": "string",
"readonly": true
},
"lastName": {
"description": "last name of the user",
"type": "string",
"readonly": true
},
"middleName": {
"description": "middle name of the user",
"type": "string",
"readonly": true
}
}
}
}
},
"tags": {
"type": "object",
"description": "Tags",
Expand All @@ -383,6 +433,10 @@
"description": "Request fields used for search",
"type": "object",
"$ref": "request-search-index.json"
},
"isDcbReRequestCancellation": {
"description": "Indicates whether the request was cancelled during a DCB transaction update",
"type": "boolean"
}
},
"additionalProperties": false,
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/folio/circulation/domain/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import static org.folio.circulation.domain.representations.RequestProperties.REQUEST_LEVEL;
import static org.folio.circulation.domain.representations.RequestProperties.REQUEST_TYPE;
import static org.folio.circulation.domain.representations.RequestProperties.STATUS;
import static org.folio.circulation.support.json.JsonPropertyFetcher.getBooleanProperty;
import static org.folio.circulation.support.json.JsonPropertyFetcher.getDateTimeProperty;
import static org.folio.circulation.support.json.JsonPropertyFetcher.getIntegerProperty;
import static org.folio.circulation.support.json.JsonPropertyFetcher.getProperty;
Expand Down Expand Up @@ -406,6 +407,10 @@ public boolean hasLoan() {
return loan != null;
}

public boolean getDcbReRequestCancellationValue() {
return getBooleanProperty(requestRepresentation, "isDcbReRequestCancellation");
}

public enum Operation {
CREATE, REPLACE, MOVE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@ public Result<RequestAndRelatedRecords> sendNoticeOnRequestCancelled(
log.debug("sendNoticeOnRequestCancelled:: parameters records: {}", () -> records);
Request request = records.getRequest();

if (request.hasItemId()) {
sendCancellationNoticeForRequestWithItemId(request);
} else {
sendCancellationNoticeForRequestWithoutItemId(request);
if (!request.getDcbReRequestCancellationValue()) {
if (request.hasItemId()) {
sendCancellationNoticeForRequestWithItemId(request);
} else {
sendCancellationNoticeForRequestWithoutItemId(request);
}
}

return succeeded(records);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.folio.circulation.resources;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.times;

import org.folio.circulation.domain.Request;
import org.folio.circulation.domain.RequestAndRelatedRecords;
import org.folio.circulation.domain.notice.ImmediatePatronNoticeService;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;

import api.support.builders.RequestBuilder;
import io.vertx.core.json.JsonObject;

@ExtendWith(MockitoExtension.class)
class RequestNoticeSenderTest {

@Mock
private ImmediatePatronNoticeService immediatePatronNoticeService;
@InjectMocks
private RequestNoticeSender requestNoticeSender;

@Test
void shouldNotSendNotificationWhenIsDcbCancellationTrue() {
JsonObject representation = new RequestBuilder().create();
representation.put("isDcbReRequestCancellation", true);
requestNoticeSender.sendNoticeOnRequestCancelled(
new RequestAndRelatedRecords(Request.from(representation)));
Mockito.verify(immediatePatronNoticeService, times(0)).acceptNoticeEvent(any());
Mockito.verify(immediatePatronNoticeService, times(0)).sendNotice(any(), any());
}
}

0 comments on commit 1cdeae9

Please sign in to comment.