Rev 3546 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
/****/package in.shop2020.utils;import in.shop2020.model.v1.catalog.Item;import in.shop2020.model.v1.order.LineItem;import in.shop2020.model.v1.order.Order;/*** @author mandeep**/public class ModelUtils {public static String extractAddressFromOrder(Order order) {StringBuilder address = new StringBuilder();if (order.getCustomer_address1() != null) {address.append(order.getCustomer_address1() + ", ");}if (order.getCustomer_address2() != null) {address.append(order.getCustomer_address2() + ", ");}if (order.getCustomer_city() != null) {address.append(order.getCustomer_city() + ", ");}if (order.getCustomer_state() != null) {address.append(order.getCustomer_state() + "-");}if (order.getCustomer_pincode() != null) {address.append(order.getCustomer_pincode());}return address.toString();}public static String extractProductNameFromLineItem(LineItem lineItem) {StringBuilder productName = new StringBuilder();if (lineItem.getBrand() != null && !lineItem.getBrand().isEmpty()) {productName.append(lineItem.getBrand() + " ");}if (lineItem.getModel_name() != null && !lineItem.getModel_name().isEmpty()) {productName.append(lineItem.getModel_name() + " ");}if (lineItem.getModel_number() != null && !lineItem.getModel_number().isEmpty()) {productName.append(lineItem.getModel_number() + " ");}return productName.toString();}public static String extractProductNameFromItem(Item lineItem) {StringBuilder productName = new StringBuilder();if (lineItem.getBrand() != null && !lineItem.getBrand().isEmpty()) {productName.append(lineItem.getBrand() + " ");}if (lineItem.getModelName() != null && !lineItem.getModelName().isEmpty()) {productName.append(lineItem.getModelName() + " ");}if (lineItem.getModelNumber() != null && !lineItem.getModelNumber().isEmpty()) {productName.append(lineItem.getModelNumber() + " ");}return productName.toString();}}