Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
69fe2ac
Core - API - Added search query to search results
GregJohnStewart Nov 15, 2025
926e306
Lib - Core API for Quarkus - Added new search param for inventory item
GregJohnStewart Nov 15, 2025
412956a
Core - API - Work towards initial rework of printouts
GregJohnStewart Nov 15, 2025
61306c5
Core - Base Station - work towards initial rework of printouts
GregJohnStewart Nov 15, 2025
283fb06
Core - Base Station - Most of the way up to reworked bulk stored tabl…
GregJohnStewart Nov 16, 2025
331a305
Core - Base Station - Got bulk item table working for printouts
GregJohnStewart Nov 17, 2025
df40ab5
Core - API - fixed storage block stats in new item
GregJohnStewart Nov 17, 2025
9d13000
Core - Base Station - Iconography in printouts and work towards amoun…
GregJohnStewart Nov 18, 2025
f8a932e
Merge branch 'development' into dev/982-fr-base-station-printouts
GregJohnStewart Nov 20, 2025
5eb61e5
Merge branch 'development' into dev/982-fr-base-station-printouts
GregJohnStewart Dec 3, 2025
ef8fc21
Core - Base Station - core api lib version bump
GregJohnStewart Dec 3, 2025
3c0607c
Lib - Core API for Quarkus - version bump for dev
GregJohnStewart Dec 3, 2025
0808857
Core - API - version bump for dev
GregJohnStewart Dec 3, 2025
ee97cfc
Core - Base Station - Now including amt list table (unfinished in pri…
GregJohnStewart Dec 4, 2025
7eeadc2
Lib - Core API for Quarkus - version bump for dev
GregJohnStewart Dec 4, 2025
afb1e63
Merge branch 'development' into dev/982-fr-base-station-printouts
GregJohnStewart Jan 13, 2026
85299f5
Core - API - Fixing some test after merge
GregJohnStewart Jan 13, 2026
9597806
Merge branch 'development' into dev/982-fr-base-station-printouts
GregJohnStewart Jan 23, 2026
3c930e4
Core - API - Fix from merge
GregJohnStewart Jan 23, 2026
fd53c49
Merge branch 'development' into dev/982-fr-base-station-printouts
GregJohnStewart Jan 23, 2026
ac84ed1
Lib - Core API for Quarkus - Tweaked quarkus exgtension info
GregJohnStewart Jan 23, 2026
a20ac82
Core - Base Station - Updated to latest quarkus version
GregJohnStewart Jan 23, 2026
04e7b46
Lib - Core API for Quarkus - Version bump to Quarkus, organization, a…
GregJohnStewart Jan 24, 2026
8f1e210
Lib - Core API for Quarkus - Achieved tying db management into the de…
GregJohnStewart Jan 26, 2026
e3acd6f
Lib - Core API for Quarkus - beginnings of populating data
GregJohnStewart Jan 27, 2026
d7617d8
Lib - Core API for Quarkus - More filling out populating
GregJohnStewart Jan 27, 2026
cad7609
Core - Base Station - Adjustments to logging
GregJohnStewart Jan 27, 2026
6129aca
Lib - Core API for Quarkus - Populated items in dev/test dataset
GregJohnStewart Jan 28, 2026
a97c0c1
Lib - Core API for Quarkus - Tweaks to added stuff
GregJohnStewart Jan 29, 2026
68a9836
Core - Base Station - Finished basic printouts
GregJohnStewart Jan 29, 2026
043fa72
Lib - Core API for Quarkus - Cleanup from review
GregJohnStewart Jan 29, 2026
1d1b18e
Core - API - Fix from review
GregJohnStewart Jan 29, 2026
103b3e8
Core - Base Station - Cleanup from review
GregJohnStewart Jan 29, 2026
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 @@ -11,6 +11,7 @@
import org.bson.types.ObjectId;
import tech.ebp.oqm.core.api.interfaces.endpoints.media.FileGet;
import tech.ebp.oqm.core.api.model.object.FileMainObject;
import tech.ebp.oqm.core.api.model.object.MainObject;
import tech.ebp.oqm.core.api.model.object.history.ObjectHistoryEvent;
import tech.ebp.oqm.core.api.model.object.media.FileMetadata;
import tech.ebp.oqm.core.api.model.rest.media.file.FileUploadBody;
Expand All @@ -32,7 +33,7 @@
*/
@Slf4j
@NoArgsConstructor
public abstract class MainFileObjectProvider<T extends FileMainObject, U extends FileUploadBody, S extends FileSearchObject<T>, G extends FileGet> extends ObjectProvider {
public abstract class MainFileObjectProvider<T extends FileMainObject, U extends FileUploadBody, S extends FileSearchObject<T>, G extends MainObject & FileGet> extends ObjectProvider {


@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import tech.units.indriya.quantity.Quantities;
Expand All @@ -23,6 +24,7 @@ public StatsWithTotalContaining(Unit<?> unit){
this();
this.total = Quantities.getQuantity(0, unit);
}


// @NonNull //TODO:: this
private Quantity<?> total;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class StoredInBlockStats extends StatsWithTotalContaining {
public StoredInBlockStats(Unit<?> unit){
super(unit);
}

@lombok.Builder.Default
private boolean hasStored = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.bson.conversions.Bson;
import org.bson.types.ObjectId;
import tech.ebp.oqm.core.api.model.object.storage.items.InventoryItem;
import tech.ebp.oqm.core.api.model.object.storage.items.StorageType;
import tech.ebp.oqm.core.api.service.mongo.search.SearchUtils;

import java.util.ArrayList;
Expand All @@ -20,6 +21,7 @@
@Setter
public class InventoryItemSearch extends SearchKeyAttObject<InventoryItem> {
@QueryParam("name") String name;
@QueryParam("storageTypes") List<StorageType> storageTypes;
@QueryParam("itemCategories") List<ObjectId> categories;
@QueryParam("inStorageBlock") List<ObjectId> inStorageBlocks;
@QueryParam("hasExpired") Boolean hasExpired;
Expand All @@ -42,7 +44,17 @@ public List<Bson> getSearchFilters() {
SearchUtils.getBasicSearchFilter("name", this.getName())
);
}
if (this.getCategories() != null && !this.categories.isEmpty()) {
if (this.getStorageTypes() != null && !this.getStorageTypes().isEmpty()) {
List<Bson> typeFilterList = new ArrayList<>(this.getStorageTypes().size());
for (StorageType curType : this.getStorageTypes()) {
typeFilterList.add(eq(
"storageType",
curType
));
}
filters.add(Filters.or(typeFilterList));
}
if (this.getCategories() != null && !this.getCategories().isEmpty()) {
List<Bson> catsFilterList = new ArrayList<>(this.getCategories().size());
for (ObjectId curCategoryId : this.getCategories()) {
catsFilterList.add(in(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package tech.ebp.oqm.core.api.model.rest.search;

import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.ws.rs.QueryParam;
import lombok.Getter;
import lombok.Setter;
Expand All @@ -26,14 +27,17 @@ public class SearchObject<T extends MainObject> {
@QueryParam("sortBy") String sortField;
@QueryParam("sortType") SortType sortType;

@JsonIgnore
public Bson getSortBson(){
return SearchUtils.getSortBson(this.sortField, this.sortType);
}

@JsonIgnore
public PagingOptions getPagingOptions(){
return PagingOptions.from(this);
}

@JsonIgnore
public List<Bson> getSearchFilters(){
return new ArrayList<>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ private static <T extends MainObject, S extends SearchObject<T>> void recordReco
sw.stop();
log.info("Took {} to write all data for {}", sw, dataTypeName);
}
private static <T extends FileMainObject, S extends SearchObject<T>, G extends FileGet> void recordRecords(

private static <T extends FileMainObject, S extends SearchObject<T>, G extends MainObject & FileGet> void recordRecords(
String oqmDbIdOrName,
File tempDir,
MongoFileService<T, S, ?, G> fileService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.bson.types.ObjectId;
import tech.ebp.oqm.core.api.interfaces.endpoints.media.FileGet;
import tech.ebp.oqm.core.api.model.object.FileMainObject;
import tech.ebp.oqm.core.api.model.object.MainObject;
import tech.ebp.oqm.core.api.model.object.interactingEntity.InteractingEntity;
import tech.ebp.oqm.core.api.model.rest.media.file.FileUploadBody;
import tech.ebp.oqm.core.api.model.rest.search.FileSearchObject;
Expand All @@ -22,7 +23,7 @@ public abstract class FileImporter<
T extends FileMainObject,
U extends FileUploadBody,
S extends FileSearchObject<T>,
G extends FileGet,
G extends MainObject & FileGet,
M extends MongoHistoriedFileService<T, U, S, G>
>
extends Importer<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.bson.types.ObjectId;
import tech.ebp.oqm.core.api.interfaces.endpoints.media.FileGet;
import tech.ebp.oqm.core.api.model.object.FileMainObject;
import tech.ebp.oqm.core.api.model.object.MainObject;
import tech.ebp.oqm.core.api.model.object.ObjectUtils;
import tech.ebp.oqm.core.api.model.object.interactingEntity.InteractingEntity;
import tech.ebp.oqm.core.api.model.object.media.FileMetadata;
Expand All @@ -30,7 +31,7 @@ public class GenericFileImporter<
T extends FileMainObject,
U extends FileUploadBody,
S extends FileSearchObject<T>,
G extends FileGet
G extends MainObject & FileGet
>
extends FileImporter<T, U, S, G, MongoHistoriedFileService<T, U, S, G>> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public void ensureObjectValid(String oqmDbIdOrName, boolean newObject, Inventory
throw new ValidationException("New unit not compatible with current unit.");
}
} else {
//TODO:: move to massage
//if new item, and stats are null, set new stats. No stored should exist so this should be representative enough to start. Maybe generate stats?
if (newOrChangedObject.getStats() == null) {
newOrChangedObject.setStats(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,10 @@ public SearchResult<T> search(String oqmDbIdOrName, ClientSession cs, @NonNull S

return new SearchResult<>(
list,
this.count(oqmDbIdOrName, filter),
(int) this.count(oqmDbIdOrName, filter),
!filters.isEmpty(),
pagingOptions
pagingOptions,
searchObject
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@ public SearchResult<T> search(@NonNull S searchObject) {

return new SearchResult<>(
list,
this.count(filter),
(int) this.count(filter),
!filters.isEmpty(),
pagingOptions
pagingOptions,
searchObject
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import tech.ebp.oqm.core.api.interfaces.endpoints.media.FileGet;
import tech.ebp.oqm.core.api.model.collectionStats.CollectionStats;
import tech.ebp.oqm.core.api.model.object.FileMainObject;
import tech.ebp.oqm.core.api.model.object.MainObject;
import tech.ebp.oqm.core.api.model.object.media.FileHashes;
import tech.ebp.oqm.core.api.model.object.media.FileMetadata;
import tech.ebp.oqm.core.api.model.rest.management.CollectionClearResult;
Expand Down Expand Up @@ -67,7 +68,8 @@
* @param <G>
*/
@Slf4j
public abstract class MongoFileService<T extends FileMainObject, S extends SearchObject<T>, X extends CollectionStats, G extends FileGet> extends MongoDbAwareService<T, S, X> {
public abstract class MongoFileService<T extends FileMainObject, S extends SearchObject<T>, X extends CollectionStats, G extends MainObject & FileGet> extends MongoDbAwareService<T, S,
X> {

private Map<ObjectId, GridFSBucket> gridBuckets = new HashMap<>();

Expand Down Expand Up @@ -199,9 +201,10 @@ public SearchResult<G> search(String dbIdOrName, S search){

return new SearchResult<>(
results,
this.getFileObjectService().count(dbIdOrName, filter),
(int) this.getFileObjectService().count(dbIdOrName, filter),
!filters.isEmpty(),
search.getPagingOptions()
search.getPagingOptions(),
search
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.bson.types.ObjectId;
import tech.ebp.oqm.core.api.model.object.MainObject;
import tech.ebp.oqm.core.api.service.mongo.media.FileObjectService;
import tech.ebp.oqm.core.api.interfaces.endpoints.media.FileGet;
import tech.ebp.oqm.core.api.model.collectionStats.CollectionStats;
Expand All @@ -37,7 +38,7 @@
* @param <T> The type of object stored.
*/
@Slf4j
public abstract class MongoHistoriedFileService<T extends FileMainObject, U extends FileUploadBody, S extends FileSearchObject<T>, G extends FileGet>
public abstract class MongoHistoriedFileService<T extends FileMainObject, U extends FileUploadBody, S extends FileSearchObject<T>, G extends MainObject & FileGet>
extends MongoFileService<T, S, CollectionStats, G> {

public static final String NULL_USER_EXCEPT_MESSAGE = "User must exist to perform action.";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tech.ebp.oqm.core.api.service.mongo.search;

import lombok.*;
import tech.ebp.oqm.core.api.model.object.MainObject;
import tech.ebp.oqm.core.api.model.object.storage.items.InventoryItem;

import java.util.List;
Expand All @@ -10,7 +11,7 @@
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ItemAwareSearchResult<T> extends SearchResult<T> {
public class ItemAwareSearchResult<T extends MainObject> extends SearchResult<T> {

private InventoryItem inventoryItem;

Expand All @@ -21,7 +22,8 @@ public ItemAwareSearchResult(InventoryItem inventoryItem, SearchResult<T> search
searchResult.getNumResultsForEntireQuery(),
searchResult.isHadSearchQuery(),
searchResult.getPagingOptions(),
searchResult.getPagingCalculations()
searchResult.getPagingCalculations(),
searchResult.getSearchObject()
);
this.inventoryItem = inventoryItem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@
public class PagingCalculations {
private boolean onFirstPage;
private boolean onLastPage;
private long numPages;
private long lastPage;
private long curPage;
private long nextPage;
private long previousPage;
private long pageResultIndexStart;
private long pageResultIndexEnd;
private int numPages;
private int pageSize;
private int lastPage;
private int curPage;
private int nextPage;
private int previousPage;
private int pageResultIndexStart;
private int pageResultIndexEnd;

protected PagingCalculations(long curPageNum, long numPages, long startIndex, long endIndex) {
protected PagingCalculations(int curPageNum, int numPages, int pageSize, int startIndex, int endIndex) {
this(
curPageNum <= 1,
curPageNum == numPages,
numPages,
pageSize,
numPages,
curPageNum,
(Math.min(curPageNum + 1, numPages)),
Expand All @@ -39,12 +41,13 @@ protected PagingCalculations(long curPageNum, long numPages, long startIndex, lo
);
}

public PagingCalculations(PagingOptions options, long numResults) {
public PagingCalculations(PagingOptions options, int numResults) {
this(
options.getPageNum(),
(long) Math.ceil((double) numResults / (double) options.getPageSize()),
(int) Math.ceil((double) numResults / (double) options.getPageSize()),
options.getPageSize(),
options.getSkipVal(),
options.getSkipVal() + options.pageSize - 1
options.getSkipVal() + options.getPageSize() - 1
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import tech.ebp.oqm.core.api.model.object.MainObject;
import tech.ebp.oqm.core.api.model.rest.search.SearchObject;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class SearchResult<T> {
public class SearchResult<T extends MainObject> {

private List<T> results;
private long numResults;
private long numResultsForEntireQuery;
private int numResults;
private int numResultsForEntireQuery;
private boolean hadSearchQuery;
private PagingOptions pagingOptions;
private PagingCalculations pagingCalculations;
private SearchObject<?> searchObject;

public SearchResult(List<T> results) {
this(
Expand All @@ -26,18 +29,20 @@ public SearchResult(List<T> results) {
results.size(),
false,
null,
null,
null
);
}

public SearchResult(List<T> results, long numResultsForEntireQuery, boolean hadSearchQuery, PagingOptions pagingOptions) {
public SearchResult(List<T> results, int numResultsForEntireQuery, boolean hadSearchQuery, PagingOptions pagingOptions, SearchObject<?> searchObject) {
this(
results,
results.size(),
numResultsForEntireQuery,
hadSearchQuery,
pagingOptions,
new PagingCalculations(pagingOptions, numResultsForEntireQuery)
new PagingCalculations(pagingOptions, numResultsForEntireQuery),
searchObject
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.http.TestHTTPEndpoint;
import io.quarkus.test.junit.QuarkusTest;
Expand Down Expand Up @@ -187,11 +188,15 @@ public void testSearchSimple() throws JsonProcessingException {

log.info("Search result: {}", response.extract().asString());

SearchResult<AmountStored> result = OBJECT_MAPPER.readValue(response.extract().asString(), new TypeReference<>() {});
ObjectNode result = (ObjectNode) OBJECT_MAPPER.readTree(response.extract().asString());

assertEquals(1, result.getNumResults());
assertEquals(1, result.get("numResults").asInt());

AmountStored storedResult = (AmountStored) result.getResults().getFirst();
// SearchResult<AmountStored> result = OBJECT_MAPPER.readValue(response.extract().asString(), new TypeReference<>() {});
//
// assertEquals(1, result.getNumResults());
//
// AmountStored storedResult = (AmountStored) result.getResults().getFirst();
// assertNotNull(storedResult.getCalculatedPrices());
}

Expand Down
Loading
Loading