Skip to content

Commit

Permalink
updated product
Browse files Browse the repository at this point in the history
  • Loading branch information
Newatia authored and Newatia committed Aug 22, 2024
1 parent 7c83a7e commit 9aa5375
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
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

0 comments on commit 9aa5375

Please sign in to comment.