Subversion Repositories SmartDukaan

Rev

Rev 9280 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9280 Rev 19685
Line 1... Line 1...
1
package in.shop2020.util;
1
package in.shop2020.util;
2
 
2
 
3
import in.shop2020.metamodel.core.Entity;
3
import in.shop2020.metamodel.core.Entity;
4
import in.shop2020.metamodel.core.FreeformContent;
4
import in.shop2020.metamodel.core.FreeformContent;
5
import in.shop2020.metamodel.core.Media;
5
import in.shop2020.metamodel.core.Media;
-
 
6
import in.shop2020.metamodel.definitions.Category;
-
 
7
import in.shop2020.metamodel.definitions.DefinitionsContainer;
6
import in.shop2020.metamodel.util.ExpandedEntity;
8
import in.shop2020.metamodel.util.ExpandedEntity;
7
 
9
 
-
 
10
import java.text.MessageFormat;
8
import java.util.Map;
11
import java.util.Map;
9
 
12
 
-
 
13
import org.apache.commons.lang.StringUtils;
-
 
14
 
10
public class EntityUtils {
15
public class EntityUtils {
11
    /**
16
    /**
12
     * Get the name of the product from entity. It considers null values also
17
     * Get the name of the product from entity. It considers null values also
13
     * @param expEntity
18
     * @param expEntity
14
     * @return
19
     * @return
Line 96... Line 101...
96
            }
101
            }
97
        }
102
        }
98
 
103
 
99
        return defaultSuffix;
104
        return defaultSuffix;
100
    }
105
    }
-
 
106
    
-
 
107
    public static String getTitle(Entity entity){
-
 
108
    	String brand = entity.getBrand();
-
 
109
    	String modelName = entity.getModelName();
-
 
110
    	String modelNumber = entity.getModelNumber();
-
 
111
    	String titleString = "";
-
 
112
    	if(StringUtils.isEmpty(modelName)){
-
 
113
    		titleString = brand + " " + modelNumber + " Price in India | Specifications, Features and Reviews";
-
 
114
    	}else {
-
 
115
    		titleString = brand + " " + modelName  + " " + modelNumber +" Price in India | Specifications, Features and Reviews";
-
 
116
    	}
-
 
117
    	return titleString;
-
 
118
    }
-
 
119
    
-
 
120
    public static String getMetaDescription(Entity entity, DefinitionsContainer defs){
-
 
121
    	Category cat = defs.getCategory(entity.getCategoryID());
-
 
122
    	Category parentCategory = cat.getParentCategory();
-
 
123
    	String categoryName = parentCategory.getLabel();
-
 
124
    	if (parentCategory.getID()== Utils.MOBILE_ACCESSORIES_CATEGORY){
-
 
125
    		categoryName = cat.getLabel();
-
 
126
    	}
-
 
127
    	String template = "Buy {0} {1} {2} at $minPriceItem.getSellingPrice(). All {3} are 100% Original and carry full Manufacturers Warranty since we procure directly from the Brand. Free Next Day Delivery.";
-
 
128
    	return MessageFormat.format(template, entity.getBrand(), entity.getModelName(), entity.getModelNumber(), categoryName.toLowerCase());
-
 
129
    }
101
}
130
}