// get from session the form associated with windowid
HttpSession session = request.getSession();
// hashMap
HashMap literatureHashMap = null;
// literature form from session
LiteratureForm sessionForm = null;
// get from request windowid
String windowId = (String) request.getParameter(MarketingConstantKeys.WINDOWID);
String previousTab = (String) request.getParameter(MarketingConstantKeys.CURRENTTAB);
if ((request.getParameter(MarketingConstantKeys.TYPEOFOPERATION).toString()).equals(MarketingConstantKeys.ADD))
{
// hash map for add literature
literatureHashMap = (HashMap) session.getAttribute(MarketingConstantKeys.NEWMLHASHMAP);
// get form from hashmap
sessionForm = (LiteratureForm) literatureHashMap.get(windowId);
}
else if ((request.getParameter(MarketingConstantKeys.TYPEOFOPERATION).toString()).equals(MarketingConstantKeys.EDIT))
{
// hash map for edit literature
literatureHashMap = (HashMap) session.getAttribute(MarketingConstantKeys.NEWMLHASHMAP);
// get form from hashmap
sessionForm = (LiteratureForm) literatureHashMap.get(windowId);
}
// get previous form values
LiteratureForm previousForm = (LiteratureForm) form;
// set form for previous permission values
if (MarketingConstantKeys.DETAIL.equals(previousTab))
{
sessionForm.setTitle(previousForm.getTitle());
sessionForm.setDetail(previousForm.getDetail());
sessionForm.setEntityname(previousForm.getEntityname());
sessionForm.setEntityid(previousForm.getEntityid());
sessionForm.setIndividualid(previousForm.getIndividualid());
sessionForm.setIndividualname(previousForm.getIndividualname());
sessionForm.setAssignedtoname(previousForm.getAssignedtoname());
sessionForm.setAssignedtoid(previousForm.getAssignedtoid());
sessionForm.setDeliverymethodid(previousForm.getDeliverymethodid());
sessionForm.setDeliverymethodname(previousForm.getDeliverymethodname());
sessionForm.setStatusid(previousForm.getStatusid());
sessionForm.setStatusname(previousForm.getStatusname());
sessionForm.setDuebymonth(previousForm.getDuebymonth());
sessionForm.setDuebyday(previousForm.getDuebyday());
sessionForm.setDuebytime(previousForm.getDuebytime());
sessionForm.setDuebyyear(previousForm.getDuebyyear());
sessionForm.setLiteraturenamevec(previousForm.getLiteraturenamevec());
sessionForm.setLiteraturename(previousForm.getLiteraturename());
}
/* else if (MarketingConstantKeys.PERMISSION.equals(previousTab))
{
// view permission
String[] viewPermissionS = previousForm.getViewpermission();
Vector viewPermisionV = new Vector();
DDNameValue viewPermissionListBox = null;
String idName = "";
String displayName = "";
// if user have selected records
if (previousForm.getViewpermission() != null)
{
int sizeOfListBox = viewPermissionS.length;
for (int i=0;i<sizeOfListBox;i++)
{
int indexOfHash = viewPermissionS[i].indexOf("#");
idName = viewPermissionS[i].substring(0, indexOfHash);
displayName = viewPermissionS[i].substring(indexOfHash+1, viewPermissionS[i].length());
viewPermissionListBox = new DDNameValue(viewPermissionS[i], displayName);
viewPermisionV.add(viewPermissionListBox);
}
previousForm.setViewpermissionvec(viewPermisionV);
}
// if user have not selected records
else
{
previousForm.setViewpermissionvec(new Vector());
}
// modify permission
String[] modifyPermissionS = previousForm.getViewpermission();
Vector modifyPermisionV = new Vector();
DDNameValue modifyPermissionListBox = null;
idName = "";
displayName = "";
// if user have selected records
if (previousForm.getViewpermission() != null)
{
int sizeOfListBox = modifyPermissionS.length;
for (int i=0;i<sizeOfListBox;i++)
{
int indexOfHash = modifyPermissionS[i].indexOf("#");
idName = modifyPermissionS[i].substring(0, indexOfHash);
displayName = modifyPermissionS[i].substring(indexOfHash+1, modifyPermissionS[i].length());
modifyPermissionListBox = new DDNameValue(modifyPermissionS[i], displayName);
modifyPermisionV.add(modifyPermissionListBox);
}
previousForm.setViewpermissionvec(modifyPermisionV);
}
// if user have not selected records
else
{
previousForm.setViewpermissionvec(new Vector());
}
// delete permission
String[] deletePermissionS = previousForm.getViewpermission();
Vector deletePermisionV = new Vector();
DDNameValue deletePermissionListBox = null;
idName = "";
displayName = "";
// if user have selected records
if (previousForm.getViewpermission() != null)
{
int sizeOfListBox = deletePermissionS.length;
for (int i=0;i<sizeOfListBox;i++)
{
int indexOfHash = deletePermissionS[i].indexOf("#");
idName = deletePermissionS[i].substring(0, indexOfHash);
displayName = deletePermissionS[i].substring(indexOfHash+1, deletePermissionS[i].length());
deletePermissionListBox = new DDNameValue(deletePermissionS[i], displayName);
deletePermisionV.add(deletePermissionListBox);
}
previousForm.setViewpermissionvec(deletePermisionV);
}
// if user have not selected records
else
{
previousForm.setViewpermissionvec(new Vector());
}
sessionForm.setAllindividual(previousForm.getAllindividual());
sessionForm.setViewpermission(previousForm.getViewpermission());
sessionForm.setViewpermissionvec(previousForm.getViewpermissionvec());
sessionForm.setModifypermission(previousForm.getModifypermission());
sessionForm.setModifypermissionvec(previousForm.getModifypermissionvec());
sessionForm.setDeletepermission(previousForm.getDeletepermission());
sessionForm.setDeletepermissionvec(previousForm.getDeletepermissionvec());
}
*/
// set the form back in session
if ((request.getParameter(MarketingConstantKeys.TYPEOFOPERATION).toString()).equals(MarketingConstantKeys.ADD))
{
literatureHashMap.put(windowId, sessionForm);
session.setAttribute(MarketingConstantKeys.NEWMLHASHMAP, literatureHashMap);
}
else if ((request.getParameter(MarketingConstantKeys.TYPEOFOPERATION).toString()).equals(MarketingConstantKeys.EDIT))
{
literatureHashMap.put(windowId, sessionForm);
session.setAttribute(MarketingConstantKeys.EDITMLHASHMAP, literatureHashMap);
}
}
catch (Exception e)
{