| 1 |  |   | 
  | 2 |  |   | 
  | 3 |  |   | 
  | 4 |  |   | 
  | 5 |  |   | 
  | 6 |  |   | 
  | 7 |  |   | 
  | 8 |  |   | 
  | 9 |  |   | 
  | 10 |  |   | 
  | 11 |  |   | 
  | 12 |  |   | 
  | 13 |  |   | 
  | 14 |  |   | 
  | 15 |  |   | 
  | 16 |  |  package org.kuali.rice.kns.web.spring.controller; | 
  | 17 |  |   | 
  | 18 |  |  import java.util.Collections; | 
  | 19 |  |  import java.util.Enumeration; | 
  | 20 |  |  import java.util.HashMap; | 
  | 21 |  |  import java.util.HashSet; | 
  | 22 |  |  import java.util.Map; | 
  | 23 |  |  import java.util.Map.Entry; | 
  | 24 |  |  import java.util.Properties; | 
  | 25 |  |  import java.util.Set; | 
  | 26 |  |   | 
  | 27 |  |  import javax.servlet.http.HttpServletRequest; | 
  | 28 |  |  import javax.servlet.http.HttpServletResponse; | 
  | 29 |  |   | 
  | 30 |  |  import org.apache.commons.lang.StringUtils; | 
  | 31 |  |  import org.kuali.rice.core.api.config.property.ConfigContext; | 
  | 32 |  |  import org.kuali.rice.core.xml.dto.AttributeSet; | 
  | 33 |  |  import org.kuali.rice.kim.service.KIMServiceLocator; | 
  | 34 |  |  import org.kuali.rice.kim.util.KimConstants; | 
  | 35 |  |  import org.kuali.rice.kns.exception.AuthorizationException; | 
  | 36 |  |  import org.kuali.rice.kns.service.KNSServiceLocatorWeb; | 
  | 37 |  |  import org.kuali.rice.kns.service.ModuleService; | 
  | 38 |  |  import org.kuali.rice.kns.uif.UifConstants; | 
  | 39 |  |  import org.kuali.rice.kns.uif.UifParameters; | 
  | 40 |  |  import org.kuali.rice.kns.uif.container.View; | 
  | 41 |  |  import org.kuali.rice.kns.uif.service.ViewService; | 
  | 42 |  |  import org.kuali.rice.kns.uif.util.LookupInquiryUtils; | 
  | 43 |  |  import org.kuali.rice.kns.util.GlobalVariables; | 
  | 44 |  |  import org.kuali.rice.kns.util.KNSConstants; | 
  | 45 |  |  import org.kuali.rice.kns.util.KNSUtils; | 
  | 46 |  |  import org.kuali.rice.kns.util.UrlFactory; | 
  | 47 |  |  import org.kuali.rice.kns.util.WebUtils; | 
  | 48 |  |  import org.kuali.rice.kns.web.spring.form.UifFormBase; | 
  | 49 |  |  import org.springframework.validation.BindingResult; | 
  | 50 |  |  import org.springframework.web.bind.annotation.ModelAttribute; | 
  | 51 |  |  import org.springframework.web.bind.annotation.RequestMapping; | 
  | 52 |  |  import org.springframework.web.bind.annotation.RequestMethod; | 
  | 53 |  |  import org.springframework.web.servlet.ModelAndView; | 
  | 54 |  |   | 
  | 55 |  |   | 
  | 56 |  |   | 
  | 57 |  |   | 
  | 58 |  |   | 
  | 59 |  |   | 
  | 60 |  |   | 
  | 61 |  |   | 
  | 62 |  |   | 
  | 63 |  |   | 
  | 64 |  |   | 
  | 65 |  |   | 
  | 66 |  |   | 
  | 67 |  |   | 
  | 68 |  |   | 
  | 69 |  |   | 
  | 70 |  |   | 
  | 71 |  |   | 
  | 72 |  |   | 
  | 73 |  |   | 
  | 74 |  |   | 
  | 75 | 0 |  public abstract class UifControllerBase { | 
  | 76 | 0 |          private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(UifControllerBase.class); | 
  | 77 |  |   | 
  | 78 |  |          protected static final String REDIRECT_PREFIX = "redirect:"; | 
  | 79 |  |   | 
  | 80 |  |           | 
  | 81 |  |   | 
  | 82 |  |   | 
  | 83 |  |   | 
  | 84 |  |   | 
  | 85 |  |   | 
  | 86 |  |   | 
  | 87 |  |   | 
  | 88 |  |   | 
  | 89 |  |   | 
  | 90 |  |   | 
  | 91 |  |          @ModelAttribute(value = "KualiForm") | 
  | 92 |  |          public UifFormBase initForm(HttpServletRequest request) { | 
  | 93 |  |                  UifFormBase form; | 
  | 94 | 0 |                  String formKeyParam = request.getParameter(UifParameters.FORM_KEY); | 
  | 95 |  |   | 
  | 96 | 0 |                  if (StringUtils.isNotBlank(formKeyParam)) { | 
  | 97 | 0 |                          form = (UifFormBase) request.getSession().getAttribute(formKeyParam); | 
  | 98 |  |                  } | 
  | 99 |  |                  else { | 
  | 100 | 0 |                          form = createInitialForm(request); | 
  | 101 |  |                  } | 
  | 102 |  |   | 
  | 103 | 0 |                  return form; | 
  | 104 |  |          } | 
  | 105 |  |   | 
  | 106 |  |           | 
  | 107 |  |   | 
  | 108 |  |   | 
  | 109 |  |   | 
  | 110 |  |   | 
  | 111 |  |   | 
  | 112 |  |   | 
  | 113 |  |   | 
  | 114 |  |   | 
  | 115 |  |   | 
  | 116 |  |   | 
  | 117 |  |          protected abstract UifFormBase createInitialForm(HttpServletRequest request); | 
  | 118 |  |   | 
  | 119 | 0 |          private Set<String> methodToCallsToNotCheckAuthorization = new HashSet<String>(); | 
  | 120 |  |          { | 
  | 121 | 0 |                  methodToCallsToNotCheckAuthorization.add("performLookup"); | 
  | 122 | 0 |                  methodToCallsToNotCheckAuthorization.add("performQuestion"); | 
  | 123 | 0 |                  methodToCallsToNotCheckAuthorization.add("performQuestionWithInput"); | 
  | 124 | 0 |                  methodToCallsToNotCheckAuthorization.add("performQuestionWithInputAgainBecauseOfErrors"); | 
  | 125 | 0 |                  methodToCallsToNotCheckAuthorization.add("performQuestionWithoutInput"); | 
  | 126 | 0 |                  methodToCallsToNotCheckAuthorization.add("performWorkgroupLookup"); | 
  | 127 | 0 |          } | 
  | 128 |  |   | 
  | 129 |  |           | 
  | 130 |  |   | 
  | 131 |  |   | 
  | 132 |  |   | 
  | 133 |  |   | 
  | 134 |  |          protected final void addMethodToCallToUncheckedList(String methodToCall) { | 
  | 135 | 0 |                  methodToCallsToNotCheckAuthorization.add(methodToCall); | 
  | 136 | 0 |          } | 
  | 137 |  |   | 
  | 138 |  |           | 
  | 139 |  |   | 
  | 140 |  |   | 
  | 141 |  |   | 
  | 142 |  |   | 
  | 143 |  |   | 
  | 144 |  |          public Set<String> getMethodToCallsToNotCheckAuthorization() { | 
  | 145 | 0 |                  return Collections.unmodifiableSet(methodToCallsToNotCheckAuthorization); | 
  | 146 |  |          } | 
  | 147 |  |   | 
  | 148 |  |           | 
  | 149 |  |   | 
  | 150 |  |   | 
  | 151 |  |   | 
  | 152 |  |   | 
  | 153 |  |   | 
  | 154 |  |   | 
  | 155 |  |          public void checkAuthorization(UifFormBase form, String methodToCall) throws AuthorizationException { | 
  | 156 | 0 |                  String principalId = GlobalVariables.getUserSession().getPrincipalId(); | 
  | 157 | 0 |                  AttributeSet roleQualifier = new AttributeSet(getRoleQualification(form, methodToCall)); | 
  | 158 | 0 |                  AttributeSet permissionDetails = KNSUtils.getNamespaceAndActionClass(this.getClass()); | 
  | 159 |  |   | 
  | 160 | 0 |                  if (!KIMServiceLocator.getIdentityManagementService().isAuthorizedByTemplateName(principalId, | 
  | 161 |  |                                  KNSConstants.KNS_NAMESPACE, KimConstants.PermissionTemplateNames.USE_SCREEN, permissionDetails, | 
  | 162 |  |                                  roleQualifier)) { | 
  | 163 | 0 |                          throw new AuthorizationException(GlobalVariables.getUserSession().getPerson().getPrincipalName(), | 
  | 164 |  |                                          methodToCall, this.getClass().getSimpleName()); | 
  | 165 |  |                  } | 
  | 166 | 0 |          } | 
  | 167 |  |   | 
  | 168 |  |           | 
  | 169 |  |   | 
  | 170 |  |   | 
  | 171 |  |   | 
  | 172 |  |   | 
  | 173 |  |   | 
  | 174 |  |   | 
  | 175 |  |          protected Map<String, String> getRoleQualification(UifFormBase form, String methodToCall) { | 
  | 176 | 0 |                  return new HashMap<String, String>(); | 
  | 177 |  |          } | 
  | 178 |  |   | 
  | 179 |  |           | 
  | 180 |  |   | 
  | 181 |  |   | 
  | 182 |  |   | 
  | 183 |  |   | 
  | 184 |  |   | 
  | 185 |  |   | 
  | 186 |  |   | 
  | 187 |  |   | 
  | 188 |  |   | 
  | 189 |  |   | 
  | 190 |  |   | 
  | 191 |  |   | 
  | 192 |  |   | 
  | 193 |  |   | 
  | 194 |  |   | 
  | 195 |  |          @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addLine") | 
  | 196 |  |          public ModelAndView addLine(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result, | 
  | 197 |  |                          HttpServletRequest request, HttpServletResponse response) { | 
  | 198 |  |   | 
  | 199 | 0 |                  String selectedCollectionPath = uifForm.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH); | 
  | 200 | 0 |                  if (StringUtils.isBlank(selectedCollectionPath)) { | 
  | 201 | 0 |                          throw new RuntimeException("Selected collection was not set for add line action, cannot add new line"); | 
  | 202 |  |                  } | 
  | 203 |  |   | 
  | 204 | 0 |                  View view = uifForm.getPreviousView(); | 
  | 205 | 0 |                  view.getViewHelperService().processCollectionAddLine(view, uifForm, selectedCollectionPath); | 
  | 206 |  |   | 
  | 207 | 0 |                  return getUIFModelAndView(uifForm); | 
  | 208 |  |          } | 
  | 209 |  |   | 
  | 210 |  |           | 
  | 211 |  |   | 
  | 212 |  |   | 
  | 213 |  |   | 
  | 214 |  |   | 
  | 215 |  |   | 
  | 216 |  |   | 
  | 217 |  |   | 
  | 218 |  |   | 
  | 219 |  |   | 
  | 220 |  |   | 
  | 221 |  |   | 
  | 222 |  |   | 
  | 223 |  |   | 
  | 224 |  |   | 
  | 225 |  |   | 
  | 226 |  |   | 
  | 227 |  |          @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteLine") | 
  | 228 |  |          public ModelAndView deleteLine(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result, | 
  | 229 |  |                          HttpServletRequest request, HttpServletResponse response) { | 
  | 230 |  |   | 
  | 231 | 0 |                  String selectedCollectionPath = uifForm.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH); | 
  | 232 | 0 |                  if (StringUtils.isBlank(selectedCollectionPath)) { | 
  | 233 | 0 |                          throw new RuntimeException("Selected collection was not set for delete line action, cannot delete line"); | 
  | 234 |  |                  } | 
  | 235 |  |   | 
  | 236 | 0 |                  int selectedLineIndex = -1; | 
  | 237 | 0 |                  String selectedLine = uifForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX); | 
  | 238 | 0 |                  if (StringUtils.isNotBlank(selectedLine)) { | 
  | 239 | 0 |                          selectedLineIndex = Integer.parseInt(selectedLine); | 
  | 240 |  |                  } | 
  | 241 |  |   | 
  | 242 | 0 |                  if (selectedLineIndex == -1) { | 
  | 243 | 0 |                          throw new RuntimeException("Selected line index was not set for delete line action, cannot delete line"); | 
  | 244 |  |                  } | 
  | 245 |  |   | 
  | 246 | 0 |                  View view = uifForm.getPreviousView(); | 
  | 247 | 0 |                  view.getViewHelperService().processCollectionDeleteLine(view, uifForm, selectedCollectionPath, | 
  | 248 |  |                                  selectedLineIndex); | 
  | 249 |  |   | 
  | 250 | 0 |                  return getUIFModelAndView(uifForm); | 
  | 251 |  |          } | 
  | 252 |  |           | 
  | 253 |  |           | 
  | 254 |  |   | 
  | 255 |  |   | 
  | 256 |  |      @RequestMapping(params = "methodToCall=cancel") | 
  | 257 |  |      public ModelAndView cancel(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, HttpServletRequest request, HttpServletResponse response) { | 
  | 258 | 0 |          return close(form, result, request, response); | 
  | 259 |  |      } | 
  | 260 |  |       | 
  | 261 |  |       | 
  | 262 |  |   | 
  | 263 |  |   | 
  | 264 |  |      @RequestMapping(params = "methodToCall=close") | 
  | 265 |  |      public ModelAndView close(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, HttpServletRequest request, HttpServletResponse response) { | 
  | 266 | 0 |          Properties props = new Properties(); | 
  | 267 | 0 |          props.put(UifParameters.METHOD_TO_CALL, UifConstants.MethodToCallNames.REFRESH); | 
  | 268 | 0 |          if (StringUtils.isNotBlank(form.getReturnFormKey())) { | 
  | 269 | 0 |              props.put(UifParameters.FORM_KEY, form.getReturnFormKey()); | 
  | 270 |  |          } | 
  | 271 |  |           | 
  | 272 |  |           | 
  | 273 | 0 |          String returnUrl = form.getReturnLocation(); | 
  | 274 | 0 |          if(StringUtils.isBlank(returnUrl)) { | 
  | 275 | 0 |              returnUrl = ConfigContext.getCurrentContextConfig().getProperty(KNSConstants.APPLICATION_URL_KEY); | 
  | 276 |  |          } | 
  | 277 |  |           | 
  | 278 | 0 |          return performRedirect(form, returnUrl, props); | 
  | 279 |  |      } | 
  | 280 |  |   | 
  | 281 |  |           | 
  | 282 |  |   | 
  | 283 |  |   | 
  | 284 |  |          @RequestMapping(method = RequestMethod.POST, params = "methodToCall=navigate") | 
  | 285 |  |          public ModelAndView navigate(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, | 
  | 286 |  |                          HttpServletRequest request, HttpServletResponse response) { | 
  | 287 | 0 |                  String pageId = form.getActionParamaterValue(UifParameters.NAVIGATE_TO_PAGE_ID); | 
  | 288 |  |                   | 
  | 289 |  |                   | 
  | 290 | 0 |                  form.setRenderFullView(false); | 
  | 291 |  |   | 
  | 292 | 0 |                  return getUIFModelAndView(form, form.getViewId(), pageId); | 
  | 293 |  |          } | 
  | 294 |  |   | 
  | 295 |  |          @RequestMapping(params = "methodToCall=refresh") | 
  | 296 |  |      public ModelAndView refresh(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, HttpServletRequest request, | 
  | 297 |  |              HttpServletResponse response) throws Exception { | 
  | 298 |  |               | 
  | 299 |  |               | 
  | 300 | 0 |              return getUIFModelAndView(form); | 
  | 301 |  |          } | 
  | 302 |  |   | 
  | 303 |  |           | 
  | 304 |  |   | 
  | 305 |  |   | 
  | 306 |  |   | 
  | 307 |  |          @RequestMapping(method = RequestMethod.POST, params = "methodToCall=performLookup") | 
  | 308 |  |          public ModelAndView performLookup(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, | 
  | 309 |  |                          HttpServletRequest request, HttpServletResponse response) { | 
  | 310 | 0 |                  Properties lookupParameters = form.getActionParametersAsProperties(); | 
  | 311 |  |   | 
  | 312 | 0 |                  String lookupObjectClassName = (String) lookupParameters.get(UifParameters.DATA_OBJECT_CLASS_NAME); | 
  | 313 | 0 |                  Class<?> lookupObjectClass = null; | 
  | 314 |  |                  try { | 
  | 315 | 0 |                          lookupObjectClass = Class.forName(lookupObjectClassName); | 
  | 316 |  |                  } | 
  | 317 | 0 |                  catch (ClassNotFoundException e) { | 
  | 318 | 0 |                          LOG.error("Unable to get class for name: " + lookupObjectClassName); | 
  | 319 | 0 |                          throw new RuntimeException("Unable to get class for name: " + lookupObjectClassName, e); | 
  | 320 | 0 |                  } | 
  | 321 |  |   | 
  | 322 |  |                   | 
  | 323 | 0 |                  String lookupParameterString = (String) lookupParameters.get(UifParameters.LOOKUP_PARAMETERS); | 
  | 324 | 0 |                  if (lookupParameterString != null) { | 
  | 325 | 0 |                          Map<String, String> lookupParameterFields = WebUtils.getMapFromParameterString(lookupParameterString); | 
  | 326 | 0 |                          for (Entry<String, String> lookupParameter : lookupParameterFields.entrySet()) { | 
  | 327 | 0 |                                  String lookupParameterValue = LookupInquiryUtils.retrieveLookupParameterValue(form, request, | 
  | 328 |  |                                                  lookupObjectClass, lookupParameter.getValue(), lookupParameter.getKey()); | 
  | 329 | 0 |                                  if (StringUtils.isNotBlank(lookupParameterValue)) { | 
  | 330 | 0 |                                          lookupParameters.put(lookupParameter.getValue(), lookupParameterValue); | 
  | 331 |  |                                  } | 
  | 332 | 0 |                          } | 
  | 333 |  |                  } | 
  | 334 |  |   | 
  | 335 |  |                   | 
  | 336 |  |   | 
  | 337 |  |                   | 
  | 338 |  |   | 
  | 339 | 0 |                  String baseLookupUrl = (String) lookupParameters.get(UifParameters.BASE_LOOKUP_URL); | 
  | 340 | 0 |                  lookupParameters.remove(UifParameters.BASE_LOOKUP_URL); | 
  | 341 |  |   | 
  | 342 |  |                   | 
  | 343 | 0 |                  lookupParameters.put(UifParameters.METHOD_TO_CALL, UifConstants.MethodToCallNames.START); | 
  | 344 | 0 |                  String autoSearchString = (String) lookupParameters.get(UifParameters.AUTO_SEARCH); | 
  | 345 | 0 |                  if (Boolean.parseBoolean(autoSearchString)) { | 
  | 346 | 0 |                          lookupParameters.put(UifParameters.METHOD_TO_CALL, UifConstants.MethodToCallNames.SEARCH); | 
  | 347 |  |                  } | 
  | 348 |  |   | 
  | 349 | 0 |                  lookupParameters.put(UifParameters.RETURN_LOCATION, form.getFormPostUrl()); | 
  | 350 | 0 |                  lookupParameters.put(UifParameters.RETURN_FORM_KEY, form.getFormKey()); | 
  | 351 |  |   | 
  | 352 |  |                   | 
  | 353 | 0 |                  if (lookupObjectClass != null) { | 
  | 354 | 0 |                          ModuleService responsibleModuleService = KNSServiceLocatorWeb.getKualiModuleService() | 
  | 355 |  |                                          .getResponsibleModuleService(lookupObjectClass); | 
  | 356 | 0 |                          if (responsibleModuleService != null && responsibleModuleService.isExternalizable(lookupObjectClass)) { | 
  | 357 | 0 |                                  Map<String, String> parameterMap = new HashMap<String, String>(); | 
  | 358 | 0 |                                  Enumeration<Object> e = lookupParameters.keys(); | 
  | 359 | 0 |                                  while (e.hasMoreElements()) { | 
  | 360 | 0 |                                          String paramName = (String) e.nextElement(); | 
  | 361 | 0 |                                          parameterMap.put(paramName, lookupParameters.getProperty(paramName)); | 
  | 362 | 0 |                                  } | 
  | 363 |  |   | 
  | 364 | 0 |                                  String lookupUrl = responsibleModuleService.getExternalizableBusinessObjectLookupUrl(lookupObjectClass, | 
  | 365 |  |                                                  parameterMap); | 
  | 366 | 0 |                                  return performRedirect(form, lookupUrl, new Properties()); | 
  | 367 |  |                          } | 
  | 368 |  |                  } | 
  | 369 |  |   | 
  | 370 | 0 |                  return performRedirect(form, baseLookupUrl, lookupParameters); | 
  | 371 |  |          } | 
  | 372 |  |   | 
  | 373 |  |           | 
  | 374 |  |   | 
  | 375 |  |   | 
  | 376 |  |   | 
  | 377 |  |   | 
  | 378 |  |   | 
  | 379 |  |   | 
  | 380 |  |   | 
  | 381 |  |   | 
  | 382 |  |   | 
  | 383 |  |   | 
  | 384 |  |   | 
  | 385 |  |          protected ModelAndView performRedirect(UifFormBase form, String baseUrl, Properties urlParameters) { | 
  | 386 |  |                   | 
  | 387 |  |                   | 
  | 388 | 0 |                  if (urlParameters.get("ajaxCall") != null && urlParameters.get("ajaxCall").equals("true")) { | 
  | 389 | 0 |                          urlParameters.remove("ajaxCall"); | 
  | 390 | 0 |                      String redirectUrl = UrlFactory.parameterizeUrl(baseUrl, urlParameters); | 
  | 391 | 0 |                          ModelAndView modelAndView = new ModelAndView("redirectURL");             | 
  | 392 | 0 |              modelAndView.addObject("redirectUrl",  redirectUrl); | 
  | 393 | 0 |              return modelAndView; | 
  | 394 |  |                  }   | 
  | 395 |  |                   | 
  | 396 | 0 |                  String redirectUrl = UrlFactory.parameterizeUrl(baseUrl, urlParameters); | 
  | 397 | 0 |                  ModelAndView modelAndView = new ModelAndView(REDIRECT_PREFIX + redirectUrl); | 
  | 398 |  |   | 
  | 399 | 0 |                  return modelAndView; | 
  | 400 |  |          } | 
  | 401 |  |   | 
  | 402 |  |          protected ModelAndView getUIFModelAndView(UifFormBase form) { | 
  | 403 | 0 |                  return getUIFModelAndView(form, form.getViewId(), form.getPageId()); | 
  | 404 |  |          } | 
  | 405 |  |   | 
  | 406 |  |          protected ModelAndView getUIFModelAndView(UifFormBase form, String viewId) { | 
  | 407 | 0 |                  return getUIFModelAndView(form, viewId, ""); | 
  | 408 |  |          } | 
  | 409 |  |   | 
  | 410 |  |           | 
  | 411 |  |   | 
  | 412 |  |   | 
  | 413 |  |   | 
  | 414 |  |   | 
  | 415 |  |   | 
  | 416 |  |   | 
  | 417 |  |   | 
  | 418 |  |   | 
  | 419 |  |   | 
  | 420 |  |   | 
  | 421 |  |   | 
  | 422 |  |   | 
  | 423 |  |   | 
  | 424 |  |          protected ModelAndView getUIFModelAndView(UifFormBase form, String viewId, String pageId) { | 
  | 425 |  |                   | 
  | 426 |  |                   | 
  | 427 | 0 |                  View view = form.getView(); | 
  | 428 | 0 |                  if ((view == null) || !StringUtils.equals(viewId, view.getId())) { | 
  | 429 | 0 |                          view = getViewService().getView(viewId, form.getViewRequestParameters()); | 
  | 430 |  |                           | 
  | 431 |  |                           | 
  | 432 | 0 |                          form.setRenderFullView(true); | 
  | 433 |  |                  } | 
  | 434 |  |   | 
  | 435 |  |                   | 
  | 436 | 0 |                  if (StringUtils.equals(UifConstants.ViewStatus.FINAL, view.getViewStatus())) { | 
  | 437 | 0 |                          view = getViewService().rebuildView(viewId, form, form.getViewRequestParameters()); | 
  | 438 |  |                  } | 
  | 439 |  |                  else { | 
  | 440 |  |                           | 
  | 441 | 0 |                          getViewService().buildView(view, form); | 
  | 442 |  |                  } | 
  | 443 |  |   | 
  | 444 | 0 |                  if (StringUtils.isNotBlank(pageId)) { | 
  | 445 | 0 |                          view.setCurrentPageId(pageId); | 
  | 446 |  |                  } | 
  | 447 |  |   | 
  | 448 | 0 |                  form.setViewId(viewId); | 
  | 449 | 0 |                  form.setPageId(pageId); | 
  | 450 | 0 |                  form.setView(view); | 
  | 451 |  |   | 
  | 452 |  |                   | 
  | 453 | 0 |                  ModelAndView modelAndView = new ModelAndView(); | 
  | 454 | 0 |                  modelAndView.addObject(UifConstants.DEFAULT_MODEL_NAME, form); | 
  | 455 | 0 |                  modelAndView.setViewName(UifConstants.SPRING_VIEW_ID); | 
  | 456 |  |   | 
  | 457 | 0 |                  return modelAndView; | 
  | 458 |  |          } | 
  | 459 |  |   | 
  | 460 |  |          protected ViewService getViewService() { | 
  | 461 | 0 |                  return KNSServiceLocatorWeb.getViewService(); | 
  | 462 |  |          } | 
  | 463 |  |   | 
  | 464 |  |  } |