Site site = adminBean.getSite();
initSiteProfiles(form, site);
HomePage homePage = HomePageDAO.load(Format.getLong(form.getHomePageId()));
HomePageDetail feature = homePage.getFeatureData();
JSONEscapeObject JSONEscapeObject = new JSONEscapeObject();
JSONEscapeObject.put("homePageId", homePage.getHomePageId());
Vector<JSONEscapeObject> vector = new Vector<JSONEscapeObject>();
for (HomePageDetail homePageDetail : homePage.getHomePageDetails()) {
JSONEscapeObject jsonDetail = new JSONEscapeObject();
jsonDetail.put("homePageDetailId", homePageDetail.getHomePageDetailId());
jsonDetail.put("seqNum", homePageDetail.getSeqNum());
Item item = homePageDetail.getItem();
Content content = homePageDetail.getContent();
if (item != null) {
ItemLanguage itemLanguage = null;
for (ItemLanguage language : item.getItemLanguages()) {
if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassDefaultId())) {
itemLanguage = language;
}
}
jsonDetail.put("type", "Item");
jsonDetail.put("homePageDesc", itemLanguage.getItemShortDesc() + " - " + item.getItemSkuCd());
}
if (content != null) {
ContentLanguage contentLanguage = null;
for (ContentLanguage language : content.getContentLanguages()) {
if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassDefaultId())) {
contentLanguage = language;
}
}
jsonDetail.put("type", "Content");
jsonDetail.put("homePageDesc", contentLanguage.getContentTitle());
}
if (feature != null) {
if (feature.getHomePageDetailId().equals(homePageDetail.getHomePageDetailId())) {
jsonDetail.put("feature", true);
}
}
else {
jsonDetail.put("feature", false);
}
vector.add(jsonDetail);
}
JSONEscapeObject.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
JSONEscapeObject.put("homePageDetails", vector);