Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated product #32

Merged
merged 1 commit into from
Aug 22, 2024
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 @@ -63,6 +63,9 @@ public class ProductFieldNameDecorator implements FieldNameDecorator {
m.put("root_productProvenances_productIndications_indication", "Indication");

m.put("root_productManufactureItems_dosageForm", "Dosage Form Name");
m.put("root_productManufactureItems_dosageFormCode", "Dosage Form Code");
m.put("root_productManufactureItems_dosageFormCodeType", "Dosage Form Code Type");
m.put("root_productManufactureItems_routeOfAdministration", "Manufacture Item Route of Administration");
m.put("root_productManufactureItems_charColor", "Manufacture Item Color");
m.put("root_productManufactureItems_charShape", "Manufacture Item Shape");
m.put("root_productManufactureItems_unit", "Manufacture Item Unit");
Expand All @@ -74,15 +77,21 @@ public class ProductFieldNameDecorator implements FieldNameDecorator {
m.put("root_productManufactureItems_productManufacturers_manufacturedItemCode", "Manufactured Item Code");
m.put("root_productManufactureItems_productManufacturers_manufacturedItemCodeType", "Manufactured Item Code Type");

m.put("root_productManufactureItems_productLots_productIngredients_applicantIngredName", "Manufacturer Role");
m.put("root_productManufactureItems_productLots_productIngredients_applicantIngredName", "Applicant Ingredient Name");
m.put("root_productManufactureItems_productLots_productIngredients_substanceKey", "Substance Key");
m.put("root_productManufactureItems_productLots_productIngredients_substanceKeyType", "Substance Key Type");
m.put("root_productManufactureItems_productLots_productIngredients_ingredientType", "Ingredient Type");
m.put("root_productManufactureItems_productLots_productIngredients_ingredientFunction", "Ingredient Function");
m.put("root_productManufactureItems_productLots_productIngredients_ingredientLocation", "Ingredient Location");
m.put("root_productManufactureItems_productLots_productIngredients_grade", "Ingredient Grade");
m.put("root_productManufactureItems_productLots_productIngredients_average", "Ingredient Average");
m.put("root_productManufactureItems_productLots_productIngredients_unit", "Ingredient Average Unit");
m.put("root_productManufactureItems_productLots_productIngredients_originalNumeratorUnit", "Original Numerator Unit");
m.put("root_productManufactureItems_productLots_productIngredients_originalDenominatorUnit", "Original Denominator Unit");
m.put("root_productManufactureItems_productLots_productIngredients_originalNumeratorNumber", "Ingredient Original Numerator Number");
m.put("root_productManufactureItems_productLots_productIngredients_originalNumeratorUnit", "Ingredient Original Numerator Unit");
m.put("root_productManufactureItems_productLots_productIngredients_originalDenominatorNumber", "Ingredient Original Denominator Number");
m.put("root_productManufactureItems_productLots_productIngredients_originalDenominatorUnit", "Ingredient Original Denominator Unit");
m.put("root_productManufactureItems_productLots_productIngredients_notes", "Ingredient Notes");
m.put("root_productManufactureItems_productLots_productIngredients_manufacturer", "Ingredient Manufacturer");

displayNames = m;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ public Class<Product> getIndexedEntityClass() {
@Override
public void createIndexableValues(Product product, Consumer<IndexableValue> consumer) {
try {
int numberOfIngredents = 0;

for (ProductManufactureItem prodManuItems : product.productManufactureItems) {

for (ProductLot prodLot : prodManuItems.productLots) {
for (ProductIngredient prodIng : prodLot.productIngredients) {

Expand Down Expand Up @@ -79,16 +82,19 @@ public void createIndexableValues(Product product, Consumer<IndexableValue> cons

// Number of Ingredients in the Product
if (prodLot.productIngredients != null) {
String ingredientSize = "0";
if (prodLot.productIngredients.size() > 0) {
ingredientSize = Integer.toString(prodLot.productIngredients.size());
// Count total number of Ingredients in a product. Since there can be multiple Manufacture Items,
// need to count all the ingredients under each Manufacuture Item record.
numberOfIngredents = numberOfIngredents + prodLot.productIngredients.size();
}
consumer.accept(IndexableValue.simpleFacetStringValue("Number of Ingredients", ingredientSize));
}

} // for productLots
} // for productManufactureItems

// Create facet "Number of Ingredients" that counts total number of Ingredients in a Product.
String numberOfIngredientsStr = numberOfIngredents > 0 ? Integer.toString(numberOfIngredents) : "0";
consumer.accept(IndexableValue.simpleFacetStringValue("Number of Ingredients", numberOfIngredientsStr));

// Facet: Application Type Number - Create a facet by combining Application Type and Application Number
for (ProductProvenance prodProv : product.productProvenances) {
Expand Down
Loading