viewForm.setListType(listType);
// get userid from session
HttpSession session = request.getSession();
int IndividualId = ((UserObject)session.getAttribute("userobject")).getIndividualID();
ViewVO viewVO = new ViewVO();
viewId = 0;
if (viewForm.getViewId() != null && viewForm.getViewId().length() > 0)
{
viewVO.setViewId(Integer.parseInt(viewForm.getViewId()));
viewId = Integer.parseInt(viewForm.getViewId());
} //end of if statement (viewForm.getViewId() != null && viewForm.getViewId().length() > 0)
viewVO.setListType(viewForm.getListType());
if (viewForm.getNoOfRecord() != null)
{
viewVO.setNoOfRecord(Integer.parseInt(viewForm.getNoOfRecord()));
} //end of if statement (viewForm.getNoOfRecord() != null)
if (viewForm.getSearchId() != null)
{
viewVO.setSearchId(Integer.parseInt(viewForm.getSearchId()));
} //end of if statement (viewForm.getSearchId() != null)
viewVO.setSortMember(viewForm.getSortMember());
viewVO.setSortType(viewForm.getSortType());
viewVO.setSearchType(viewForm.getSearchType());
viewVO.setViewName(viewForm.getViewName());
viewVO.setCreatedBy(IndividualId);
viewVO.setOwner(IndividualId);
// get listpreference
// get user object from session
UserObject userObject = (UserObject)session.getAttribute( "userobject" );
// get listpreference associated with the user for required listtype
ListPreference listPreference = userObject.getListPreference(listType);
String userDefaultId = ""+listPreference.getDefaultView();
// set column info
Vector columnInfo = new Vector();
Vector selectedColumn = new Vector();
if (viewForm.getSelectedColumn() != null)
{
int sizeOfSelectedColumn = viewForm.getSelectedColumn().length;
String[] selectedColumnArray = viewForm.getSelectedColumn();
for (int i = 0; i < sizeOfSelectedColumn; i++)
{
ViewColumnVO columnVO = new ViewColumnVO();
DDNameValue ddSelectedColumn = new DDNameValue(selectedColumnArray[i], selectedColumnArray[i]);
columnVO.setColumnOrder(i+1);
columnVO.setColumnName(selectedColumnArray[i]);
columnInfo.add(columnVO);
selectedColumn.add(ddSelectedColumn);
} //end of for loop (int i = 0; i < sizeOfSelectedColumn; i++)
} //end of if statement (viewForm.getSelectedColumn() != null)
viewVO.setViewColumnVO(columnInfo);
ViewHome viewHome = (ViewHome)CVUtility.getHomeObject("com.centraview.view.ViewHome","View");
View remote =viewHome.create();
remote.setDataSource(dataSource);
if (request.getParameter("TYPEOFOPERATION").equals("new"))
{
viewId = remote.addView(IndividualId, viewVO);
viewForm.setViewId(viewId+"");
request.setAttribute("TYPEOFOPERATION", "edit");
} //end of if statement (request.getParameter("TYPEOFOPERATION").equals("ADD"))
else if (request.getParameter("TYPEOFOPERATION").equals("edit"))
{
remote.updateView(IndividualId, viewVO);
} //end of else if statement (request.getParameter("TYPEOFOPERATION").equals("EDIT"))
ListView listView = new ListView(viewId);
listView.setListType(listType);
listView.setViewName(viewVO.getViewName());
listView.setViewID(viewId);
listView.setSearchID(viewVO.getSearchId());
if (viewForm.getSelectedColumn() != null)
{
int sizeOfSelectedColumn = viewForm.getSelectedColumn().length;
String[] selectedColumnArray = viewForm.getSelectedColumn();
for (int i = 0; i < sizeOfSelectedColumn; i++)