query.setParameter("siteId", site.getSiteId());
iterator = query.getResultList().iterator();
Vector<LabelValueBean> shippingTypeList = new Vector<LabelValueBean>();
while (iterator.hasNext()) {
ShippingType shippingType = (ShippingType) iterator.next();
LabelValueBean bean = new LabelValueBean(shippingType.getShippingTypeName(), shippingType.getShippingTypeId().toString());
shippingTypeList.add(bean);
}
LabelValueBean shippingTypes[] = new LabelValueBean[shippingTypeList.size()];
shippingTypeList.copyInto(shippingTypes);
form.setShippingTypes(shippingTypes);
String sql = "select productClass " +
"from ProductClass productClass " +
"left join productClass.site site " +
"where site.siteId = :siteId " +
"order by productClass.productClassName ";
query = em.createQuery(sql);
query.setParameter("siteId", site.getSiteId());
iterator = query.getResultList().iterator();
Vector<LabelValueBean> productClassList = new Vector<LabelValueBean>();
while (iterator.hasNext()) {
ProductClass productClass = (ProductClass) iterator.next();
LabelValueBean bean = new LabelValueBean(productClass.getProductClassName(), productClass.getProductClassId().toString());;
productClassList.add(bean);
}
LabelValueBean productClasses[] = new LabelValueBean[productClassList.size()];
productClassList.copyInto(productClasses);
form.setProductClasses(productClasses);
sql = "select customAttributeGroup " +
"from CustomAttributeGroup customAttributeGroup " +
"left join customAttributeGroup.site site " +
"where site.siteId = :siteId " +
"order by customAttributeGroup.customAttribGroupName";
query = em.createQuery(sql);
query.setParameter("siteId", adminBean.getSite().getSiteId());
iterator = query.getResultList().iterator();
Vector<LabelValueBean> customAttributesList = new Vector<LabelValueBean>();
customAttributesList.add(new LabelValueBean("", ""));
while (iterator.hasNext()) {
CustomAttributeGroup customAttributeGroup = (CustomAttributeGroup) iterator.next();
LabelValueBean bean = new LabelValueBean(customAttributeGroup.getCustomAttribGroupName(),
customAttributeGroup.getCustomAttribGroupId().toString());
customAttributesList.add(bean);
}
LabelValueBean customAttributeGroups[] = new LabelValueBean[customAttributesList.size()];
customAttributesList.copyInto(customAttributeGroups);
form.setCustomAttributeGroups(customAttributeGroups);
ItemAttributeDetailDisplayForm itemAttributeDetails[] = form.getItemAttributeDetails();
if (itemAttributeDetails != null) {
for (int i = 0; i < itemAttributeDetails.length; i++) {
ItemAttributeDetailDisplayForm displayForm = itemAttributeDetails[i];
CustomAttribute customAttribute = CustomAttributeDAO.load(site.getSiteId(), Format.getLong(displayForm.getCustomAttribId()));
if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_USER_INPUT) {
continue;
}
if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_CUST_SELECT_DROPDOWN) {
continue;
}
Vector<LabelValueBean> options = new Vector<LabelValueBean>();
for (CustomAttributeOption customAttributeOption : customAttribute.getCustomAttributeOptions()) {
String value = "";
if (customAttribute.getCustomAttribDataTypeCode() == Constants.CUSTOM_ATTRIBUTE_DATA_TYPE_CURRENCY) {
value = customAttributeOption.getCustomAttributeOptionCurrency().getCustomAttribValue();
if (!form.isSiteCurrencyClassDefault()) {
for (CustomAttributeOptionCurrency optionCurrency : customAttributeOption.getCustomAttributeOptionCurrencies()) {
if (optionCurrency.getSiteCurrencyClass().getSiteCurrencyClassId().equals(siteCurrencyClassId)) {
if (optionCurrency.getCustomAttribValue() != null) {
value = optionCurrency.getCustomAttribValue();
}
break;
}
}
}
}
else {
value = customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue();
if (!form.isSiteProfileClassDefault()) {
for (CustomAttributeOptionLanguage optionLanguage : customAttributeOption.getCustomAttributeOptionLanguages()) {
if (optionLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
if (optionLanguage.getCustomAttribValue() != null) {
value = optionLanguage.getCustomAttribValue();
}
break;
}
}
}
}
LabelValueBean option = new LabelValueBean(value, customAttributeOption.getCustomAttribOptionId().toString());
options.add(option);
}
LabelValueBean customAttribOptions[] = new LabelValueBean[options.size()];
options.copyInto(customAttribOptions);
displayForm.setCustomAttribOptions(customAttribOptions);
}
}
if (!form.getMode().equals(Constants.MODE_CREATE)) {
sql = "select itemTierPrice " +
"from ItemTierPrice itemTierPrice " +
"left join itemTierPrice.item item " +
"left join itemTierPrice.customerClass customerClass " +
"where item.itemId = :itemId " +
"order by customerClass.custClassName, itemTierPrice.itemTierQty";
query = em.createQuery(sql);
query.setParameter("itemId", item.getItemId());
iterator = query.getResultList().iterator();
Vector<ItemTierPriceDisplayForm> vector = new Vector<ItemTierPriceDisplayForm>();
while (iterator.hasNext()) {
ItemTierPrice itemTierPrice = (ItemTierPrice) iterator.next();
ItemTierPriceDisplayForm priceForm = new ItemTierPriceDisplayForm();
priceForm.setItemTierPriceId(itemTierPrice.getItemTierPriceId().toString());
priceForm.setCustClassId("");
if (itemTierPrice.getCustomerClass() != null) {
priceForm.setCustClassId(itemTierPrice.getCustomerClass().getCustClassId().toString());
}
priceForm.setItemTierQty(itemTierPrice.getItemTierQty().toString());
priceForm.setItemTierPrice(Format.getFloat(itemTierPrice.getItemTierPriceCurrency().getItemPrice()));
priceForm.setItemTierPricePublishOn(Format.getDate(itemTierPrice.getItemTierPricePublishOn()));
priceForm.setItemTierPriceExpireOn(Format.getDate(itemTierPrice.getItemTierPriceExpireOn()));
vector.add(priceForm);
}
ItemTierPriceDisplayForm itemTierPrices[] = new ItemTierPriceDisplayForm[vector.size()];
vector.copyInto(itemTierPrices);
form.setItemTierPrices(itemTierPrices);
}
Vector<LabelValueBean> siteDomainList = new Vector<LabelValueBean>();
for (SiteDomain siteDomain : site.getSiteDomains()) {
siteDomainList.add(new LabelValueBean(siteDomain.getSiteDomainLanguage().getSiteName(), siteDomain.getSiteDomainId().toString()));
}
LabelValueBean siteDomains[] = new LabelValueBean[siteDomainList.size()];
siteDomainList.copyInto(siteDomains);
form.setSiteDomains(siteDomains);
form.setShareInventory(false);
if (site.getShareInventory() == Constants.VALUE_YES) {