-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into MODINV-1002
- Loading branch information
Showing
20 changed files
with
355 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"description": "Collection of pairs of item and tenant IDs", | ||
"type": "object", | ||
"properties": { | ||
"tenantItems": { | ||
"type": "array", | ||
"description": "Items with corresponding tenantIds", | ||
"items": { | ||
"type": "object", | ||
"additionalProperties": true | ||
} | ||
}, | ||
"totalRecords": { | ||
"type": "integer" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": ["item", "totalRecords"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/org/folio/inventory/domain/instances/Dates.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.folio.inventory.domain.instances; | ||
|
||
import io.vertx.core.json.JsonObject; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
import static org.apache.commons.lang3.ObjectUtils.anyNotNull; | ||
import static org.folio.inventory.support.JsonHelper.includeIfPresent; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class Dates { | ||
// JSON property names | ||
public static final String DATE_TYPE_ID_KEY = "dateTypeId"; | ||
public static final String DATE1_KEY = "date1"; | ||
public static final String DATE2_KEY = "date2"; | ||
|
||
public final String dateTypeId; | ||
public final String date1; | ||
public final String date2; | ||
|
||
public static JsonObject datesToJson(Dates dates) { | ||
if (dates == null || (dates.getDate1() == null && dates.getDate2() == null && dates.getDateTypeId() == null)) { | ||
return null; | ||
} | ||
var json = new JsonObject(); | ||
includeIfPresent(json, DATE_TYPE_ID_KEY, dates.getDateTypeId()); | ||
includeIfPresent(json, DATE1_KEY, dates.getDate1()); | ||
includeIfPresent(json, DATE2_KEY, dates.getDate2()); | ||
return json; | ||
} | ||
|
||
public static Dates datesFromJson(JsonObject datesJson) { | ||
if (datesJson == null) { | ||
return null; | ||
} | ||
var dateTypeId = datesJson.getString(DATE_TYPE_ID_KEY); | ||
var date1 = datesJson.getString(DATE1_KEY); | ||
var date2 = datesJson.getString(DATE2_KEY); | ||
return anyNotNull(dateTypeId, date1, date2) ? new Dates(dateTypeId, date1, date2) : null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.