this();
init(site);
this.exportLocation = exportLocation;
EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
IeProfileHeader ieProfileHeader = (IeProfileHeader) em.find(IeProfileHeader.class, ieProfileHeaderId);
Vector<ItemSimpleCsvMapping> vector = new Vector<ItemSimpleCsvMapping>();
for (IeProfileDetail ieProfileDetail : ieProfileHeader.getIeProfileDetails()) {
if (ieProfileDetail.getIeProfilePosition() == null && ieProfileDetail.getIeProfileFieldValue() == null) {
continue;
}
ItemSimpleCsvMapping mapping = new ItemSimpleCsvMapping();
mapping.setIeProfileGroupName(ieProfileDetail.getIeProfileGroupName());
mapping.setIeProfileGroupIndex(ieProfileDetail.getIeProfileGroupIndex());
mapping.setIeProfileFieldName(ieProfileDetail.getIeProfileFieldName());
mapping.setIeProfilePosition(ieProfileDetail.getIeProfilePosition());
mapping.setIeProfileFieldValue(ieProfileDetail.getIeProfileFieldValue());
if (Format.isNullOrEmpty(ieProfileDetail.getIeProfileGroupName())) {
for (ItemSimpleCsvMapping field : FIELDS_GENERAL) {
if (field.getIeProfileFieldName().equals(ieProfileDetail.getIeProfileFieldName())) {
mapping.setIeProfileFieldType(field.getIeProfileFieldType());
break;
}
}
}
else if (ieProfileDetail.getIeProfileGroupName().equals("itemsRelated")) {
for (ItemSimpleCsvMapping field : FIELDS_ITEM_RELATED) {
if (field.getIeProfileFieldName().equals(ieProfileDetail.getIeProfileFieldName())) {
mapping.setIeProfileFieldType(field.getIeProfileFieldType());
break;
}
}
}
else if (ieProfileDetail.getIeProfileGroupName().equals("itemsUpSell")) {
for (ItemSimpleCsvMapping field : FIELDS_ITEM_UPSELL) {
if (field.getIeProfileFieldName().equals(ieProfileDetail.getIeProfileFieldName())) {
mapping.setIeProfileFieldType(field.getIeProfileFieldType());
break;
}
}
}
else if (ieProfileDetail.getIeProfileGroupName().equals("itemsCrossSell")) {
for (ItemSimpleCsvMapping field : FIELDS_ITEM_CROSSSELL) {
if (field.getIeProfileFieldName().equals(ieProfileDetail.getIeProfileFieldName())) {
mapping.setIeProfileFieldType(field.getIeProfileFieldType());
break;
}
}
}
else if (ieProfileDetail.getIeProfileGroupName().equals("itemTierPrices")) {
for (ItemSimpleCsvMapping field : FIELDS_ITEM_TIERPRICE) {
if (field.getIeProfileFieldName().equals(ieProfileDetail.getIeProfileFieldName())) {
mapping.setIeProfileFieldType(field.getIeProfileFieldType());
break;
}
}
}
else if (ieProfileDetail.getIeProfileGroupName().equals("itemAttributeDetails")) {
for (ItemSimpleCsvMapping field : FIELDS_ITEM_ATTRIBUTEDETAIL) {
if (field.getIeProfileFieldName().equals(ieProfileDetail.getIeProfileFieldName())) {
mapping.setIeProfileFieldType(field.getIeProfileFieldType());
break;
}
}
}
else if (ieProfileDetail.getIeProfileGroupName().equals("itemImages")) {
for (ItemSimpleCsvMapping field : FIELDS_ITEM_IMAGE) {
if (field.getIeProfileFieldName().equals(ieProfileDetail.getIeProfileFieldName())) {
mapping.setIeProfileFieldType(field.getIeProfileFieldType());
break;
}
}
}
else if (ieProfileDetail.getIeProfileGroupName().equals("others")) {
for (ItemSimpleCsvMapping field : FIELDS_OTHERS) {
if (field.getIeProfileFieldName().equals(ieProfileDetail.getIeProfileFieldName())) {
mapping.setIeProfileFieldType(field.getIeProfileFieldType());
break;
}
}
}
vector.add(mapping);
}
if (ieProfileHeader.getIeProfileType() == Constants.IE_PROFILE_TYPE_EXPORT) {
Enumeration<ItemSimpleCsvMapping> enumeration = vector.elements();
int max = 0;
while (enumeration.hasMoreElements()) {
ItemSimpleCsvMapping mapping = enumeration.nextElement();
if (mapping.getIeProfilePosition() > max) {