@Override protected ActionForward processActionPerform( HttpServletRequest request, HttpServletResponse response, Action action, ActionForm form, ActionMapping mapping) throws IOException, ServletException { // 1,获取要调用的方法 String methodName = "execute"; if (DispatchAction.class.isAssignableFrom(action.getClass())) { methodName = request.getParameter(mapping.getParameter()); if (methodName == null) { methodName = "unspecified"; } } Method method = null; try { method = action.getClass().getDeclaredMethod(methodName, parameterTypes); } catch (NoSuchMethodException e) { throw new ItcastException(e); } catch (Exception e) { throw new ItcastException(e); } // 2,得到这个方法所要求的权限 Privilege privilege = method.getAnnotation(Privilege.class); if (privilege == null) { privilege = action.getClass().getAnnotation(Privilege.class); } if (privilege != null) { // 3,查看用户是否有这个权限 User currentUser = ExecutionContext.get().getCurrentUser(); if (!PrivilegeController.isUserHasPermission( // currentUser, // privilege.resource(), // privilege.action())) { // 4,如果没有权限,抛出异常 String msg = "您没有权限【resource=" + privilege.resource() + ",action=" + privilege.action() // + "】访问方法【" + action.getClass() + "." + methodName + "】"; throw new ItcastPermissionDeniedException(msg); } } return super.processActionPerform(request, response, action, form, mapping); }
public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String forward = ""; ActionUtils.setUpNavLink(mapping.getParameter(), request); NewsUtils.putAppropriateNewsForViewingInRequest(request); User user = LegacySpringUtils.getUserManager().getLoggedInUser(); if (user != null) { final String role = LegacySpringUtils.getUserManager().getCurrentSpecialtyRole(user); // Is user patient or admin? if ("patient".equalsIgnoreCase(role)) { request.setAttribute("isPatient", true); } if ((user.getLastlogon() != null)) { request.setAttribute("lastLogin", format.format(user.getLastlogon())); } user.setLastlogon(new Date()); LegacySpringUtils.getUserManager().save(user); if ("patient".equalsIgnoreCase(role)) { String nhsno = LegacySpringUtils.getUserManager().getUsersRealNhsNoBestGuess(user.getUsername()); if (nhsno != null && !nhsno.equals("")) { LogEntry log = LegacySpringUtils.getLogEntryManager() .getLatestLogEntry(nhsno, AddLog.PATIENT_DATA_FOLLOWUP); if (log != null) { request.setAttribute("lastDataDate", format.format(log.getDate().getTime())); // Get the unit from the unitcode String unitcode = log.getUnitcode(); if (unitcode != null) { Unit unit = LegacySpringUtils.getUnitManager().get(unitcode); if (null == unit) { request.setAttribute("lastDataFrom", "Unit with code: " + unitcode); } else { request.setAttribute("lastDataFrom", unit.getName()); } } } } forward = "patient"; } else { forward = "admin"; } } return LogonUtils.logonChecks(mapping, request, forward); }
/** * Method which is dispatched to when there is no value for specified request parameter included * in the request. Subclasses of <code>DispatchAction</code> should override this method if they * wish to provide default behavior different than producing an HTTP "Bad Request" error. */ protected ActionForward unspecified( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String message = messages.getMessage("dispatch.parameter", mapping.getPath(), mapping.getParameter()); log.error(message); response.sendError(HttpServletResponse.SC_BAD_REQUEST, message); return (null); }
/** * Process the specified HTTP request, and create the corresponding HTTP response (or forward to * another web component that will create it). Return an <code>ActionForward</code> instance * describing where and how control should be forwarded, or <code>null</code> if the response has * already been completed. * * @param mapping The ActionMapping used to select this instance * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @param form The optional ActionForm bean for this request (if any) * @return Describes where and how control should be forwarded. * @exception Exception if an error occurs */ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // identify the request parameter containing the method name String parameter = mapping.getParameter(); if (parameter == null) { throw new ServletException("no dispatch parameter configured"); } // identify the string to look up String name = request.getParameter(parameter); if (name == null) { throw new ServletException("dispatch parameter [" + parameter + "] not found"); } // look up the dispatch method String methodName = getKeyMethodMap().getProperty(name); if (methodName == null) { // Use the dispatch parameter value as the method name, as // DispatchAction was originally designed to do methodName = name; } // execute the dispatch method ActionForward fwd = dispatchMethod(mapping, form, request, response, methodName); // save the return path in case the user clicks into a // workflow. be sure to include the mode parameter. try { Portal tmpPortal = (Portal) request.getAttribute(Constants.PORTAL_KEY); if (tmpPortal.doWorkflow()) { Map<String, Object> params = tmpPortal.getWorkflowParams(); if (params == null) { params = new HashMap<String, Object>(); params.put(Constants.MODE_PARAM, name); } setReturnPath(request, mapping, params); } } catch (ServletException e) { log.debug("Could not save return path: " + e); } catch (ParameterNotFoundException pne) { log.debug("Could not save return path: " + pne); } return fwd; }
/* (non-Javadoc) * @see org.apache.struts.actions.DispatchAction#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ @Override public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { if (request.getSession().getAttribute("userId") == null) { System.out.println("userid123" + request.getSession().getAttribute("userId")); response.sendRedirect("/sec/Login.do"); } Long aptid = (Long) request.getSession().getAttribute("aptID"); MaintenanceRequestForm maintenfrm = (MaintenanceRequestForm) form; ApartmentDAO aptDAO = new ApartmentDAO(); Apartment Apt = aptDAO.findById(aptid); maintenfrm.setApartment(Apt.getApartmentNumber()); HttpSession session = request.getSession(); session.setAttribute("ApartmentNo", maintenfrm.getApartment()); System.out.println("userid" + request.getSession().getAttribute("userId")); System.out.println("a:" + request.getParameter("r:" + mapping.getParameter())); if (FormUtil.isNotNull(request.getParameter(mapping.getParameter())) && request.getParameter(mapping.getParameter()).equals("Submit")) { System.out.println("/////" + request.getParameter(mapping.getParameter())); return this.submit(mapping, form, request, response); } else { UserDAO userDAO = new UserDAO(); User user = userDAO.findById((Long) request.getSession().getAttribute("userId")); MaintenanceRequestForm requestForm = new MaintenanceRequestForm(); requestForm = (MaintenanceRequestForm) form; requestForm.setContactNo(user.getHomePhone()); return mapping.findForward("input"); } }
public ActionForward execute( ActionMapping in_mapping, ActionForm in_form, HttpServletRequest in_request, HttpServletResponse in_response) throws Exception { String lc_parameterName = in_mapping.getParameter(); if (lc_parameterName != null) { String lc_methodName = in_request.getParameter(lc_parameterName); if (lc_methodName != null && ("execute".equals(lc_methodName) || "perform".equals(lc_methodName))) throw new IllegalArgumentException("illegal parameter"); } return super.execute(in_mapping, in_form, in_request, in_response); }
private final StackTraceElement getStackTraceElementForActionMapping( HttpServletRequest request, ActionMapping mapping, StackTraceElement[] elements) { Class<?> actionClass = actionClass(mapping.getType()); setActionErrorClass(actionClass); String methodName = DispatchAction.class.isAssignableFrom(actionClass) ? request.getParameter(mapping.getParameter()) : "execute"; setActionErrorMethod(methodName); for (StackTraceElement element : elements) { if (element.getClassName().equals(mapping.getType()) && element.getMethodName().equals(methodName)) { return element; } } return null; }
/** * Dispatches to the target class' <code>unspecified</code> method, if present, otherwise throws a * ServletException. Classes utilizing <code>EventActionDispatcher</code> should provide an <code> * unspecified</code> method if they wish to provide behavior different than throwing a * ServletException. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The non-HTTP request we are processing * @param response The non-HTTP response we are creating * @return The forward to which control should be transferred, or <code>null</code> if the * response has been completed. * @throws Exception if the application business logic throws an exception. */ protected ActionForward unspecified( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Identify if there is an "unspecified" method to be dispatched to String name = "unspecified"; Method method = null; try { method = getMethod(name); } catch (NoSuchMethodException e) { String message = messages.getMessage("event.parameter", mapping.getPath()); LOG.error(message + " " + mapping.getParameter()); throw new ServletException(message); } return dispatchMethod(mapping, form, request, response, name, method); }
/** * Process the specified HTTP request, and create the corresponding HTTP response (or forward to * another web component that will create it). Return an <code>ActionForward</code> instance * describing where and how control should be forwarded, or <code>null</code> if the response has * already been completed. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @exception Exception if an exception occurs */ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Identify the request parameter containing the method name String parameter = mapping.getParameter(); if (parameter == null) { String message = messages.getMessage("dispatch.handler", mapping.getPath()); log.error(message); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message); return (null); } // Identify the method name to be dispatched to. // dispatchMethod() will call unspecified() if name is null String name = request.getParameter(parameter); // Invoke the named method, and return the result return dispatchMethod(mapping, form, request, response, name); }
protected ActionForward findSuccess( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String parameter = request.getParameter("parameter"); if (parameter == null) { parameter = mapping.getParameter(); } String value = ServletParameterHelper.replaceDynamicParameters(parameter, request.getParameterMap()); ActionForward forward = null; if (StringUtil.asNull(value) != null) { forward = mapping.findForward("success-" + value); } else { forward = mapping.findForward("success-null"); } if (forward != null) { return forward; } else { return super.findSuccess(mapping, form, request, response); } }
protected void executeLogic( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { SelectPictureFB fb = (SelectPictureFB) form; Integer virtualGalleryId = fb.getGallery(); setVirtualGalleryId(request, virtualGalleryId); Gallery gallery = GalleryHelper.getGallery(getEnvironment(), virtualGalleryId); if (gallery == null) { saveErrors(request, Arrays.asList(new String[] {"gallery.gallery.gallery-not-found"})); return; } setGallery(request, gallery); String language = fb.getLanguage(); if (StringUtil.asNull(language) == null) { language = request.getLocale().getLanguage(); } boolean useEnglish = !language.equals( getEnvironment().getConfigurableResources().getParameter("nativelanguage")); Integer galleryId = GalleryHelper.getGalleryId(gallery); setGalleryId(request, galleryId); Integer categoryId = fb.getCategory(); setCategoryId(request, categoryId); LOG.debug("Search pictures: " + fb.getGallery() + "," + fb.getCategory()); initRequestParameters(request); Collection categories = getCategories(request, form); Collection picturesAllowed = getPictures(request, form); QueryFilter filter; Integer max = fb.getMax(); if (max == null) { if (gallery.getNoOfCols() != null && gallery.getNoOfCols().intValue() > 0 && gallery.getNoOfRows() != null && gallery.getNoOfRows().intValue() > 0) { max = new Integer(gallery.getNoOfCols().intValue() * gallery.getNoOfRows().intValue()); } } if (fb.getStart() != null && max != null && max.intValue() != 0) { if (picturesAllowed != null) { if (categories != null) { filter = new QueryFilter(getCategoryTreeFilter(request) + "andpicturelist" + "withlimit"); filter.setAttribute("categories", categories); } else { filter = new QueryFilter(getAllFilter(request) + "andpicturelist" + "withlimit"); } filter.setAttribute("pictures", picturesAllowed); } else { if (categories != null) { filter = new QueryFilter(getCategoryTreeFilter(request) + "withlimit"); filter.setAttribute("categories", categories); } else { filter = new QueryFilter(getAllFilter(request) + "withlimit"); } } filter.setAttribute("start", fb.getStart()); if (max != null) { filter.setAttribute("max", max); } } else { if (picturesAllowed != null) { if (categories != null) { filter = new QueryFilter(getCategoryTreeFilter(request) + "andpicturelist"); filter.setAttribute("categories", categories); } else { filter = new QueryFilter(getAllFilter(request) + "andpicturelist"); } filter.setAttribute("pictures", picturesAllowed); } else { if (categories != null) { filter = new QueryFilter(getCategoryTreeFilter(request)); filter.setAttribute("categories", categories); } else { filter = new QueryFilter(getAllFilter(request)); } } } filter.setAttribute("gallery", galleryId); filter.setOrderName(gallery.getSortOrder()); setFilterAttributes(request, form, filter); EntityInterface[] entities = new EntityInterface[0]; if (picturesAllowed == null || (picturesAllowed != null && picturesAllowed.size() > 0)) { entities = getEnvironment().getEntityStorageFactory().getStorage("gallery-picture").search(filter); } String username = gallery.getUsername(); // String username = fb.getUser(); // if (username == null || username.length() == 0) { // username = request.getRemoteUser(); // } filter = new QueryFilter("allforuser"); filter.setAttribute("username", username); EntityInterface[] storageEntities = getEnvironment() .getEntityStorageFactory() .getStorage("gallery-picturestorage") .search(filter); if (gallery.getMaxWidth() != null && gallery.getMaxWidth().intValue() > 0) { filter = new QueryFilter("all-smaller-than"); filter.setAttribute("width", gallery.getMaxWidth()); } else { filter = new QueryFilter("all"); } EntityInterface[] resolutionEntities = getEnvironment().getEntityStorageFactory().getStorage("gallery-resolution").search(filter); ResolutionPB[] resolutionsPB = null; Integer defaultResolution = null; if (resolutionEntities.length > 0) { for (int i = 0; i < resolutionEntities.length; i++) { if (((Resolution) resolutionEntities[i]) .getId() .equalsIgnoreCase(gallery.getDefaultResolution())) { defaultResolution = ((Resolution) resolutionEntities[i]).getWidth(); break; } } resolutionsPB = new ResolutionPB[resolutionEntities.length]; for (int i = 0; i < resolutionsPB.length; i++) { resolutionsPB[i] = new ResolutionPB(); try { PropertyUtils.copyProperties(resolutionsPB[i], resolutionEntities[i]); } catch (IllegalAccessException e) { } catch (InvocationTargetException e) { } catch (NoSuchMethodException e) { } } } Map pictureParameters = new HashMap(); if (StringUtil.asNull(request.getServerName()) != null) { pictureParameters.put("hostname", request.getServerName()); if (request.getServerPort() != 80) { pictureParameters.put("port", new Integer(request.getServerPort())); } } pictureParameters.put("contextpath", request.getContextPath()); pictureParameters.put("user", username); PicturePB[] picturesPB = new PicturePB[entities.length]; ActionForward updateForward = mapping.findForward("picture-update-link"); ActionForward removeForward = mapping.findForward("picture-remove-link"); ActionForward resolutionForward = mapping.findForward("picture-resolution-link"); ActionForward pictureLinkForward = mapping.findForward("picture-link"); ActionForward pictureImageForward = mapping.findForward("picture-image"); if (defaultResolution != null) { pictureParameters.put("width", defaultResolution.toString()); } if (StringUtil.asNull(request.getParameter("thumbnailwidth")) != null) { pictureParameters.put("thumbnailwidth", request.getParameter("thumbnailwidth")); } else if (gallery.getThumbnailWidth() != null && gallery.getThumbnailWidth().intValue() > 0) { pictureParameters.put("thumbnailwidth", gallery.getThumbnailWidth()); } if (StringUtil.asNull(request.getParameter("thumbnailheight")) != null) { pictureParameters.put("thumbnailheight", request.getParameter("thumbnailheight")); } else if (gallery.getThumbnailHeight() != null && gallery.getThumbnailHeight().intValue() > 0) { pictureParameters.put("thumbnailheight", gallery.getThumbnailHeight()); } List thumbnailInfoList = new ArrayList(); if (StringUtil.asNull(gallery.getThumbnailRow1()) != null) { thumbnailInfoList.add(gallery.getThumbnailRow1()); } if (StringUtil.asNull(gallery.getThumbnailRow2()) != null) { thumbnailInfoList.add(gallery.getThumbnailRow2()); } if (StringUtil.asNull(gallery.getThumbnailRow3()) != null) { thumbnailInfoList.add(gallery.getThumbnailRow3()); } String[] thumbnailInfo = (String[]) thumbnailInfoList.toArray(new String[0]); JPEGMetadataHandler jpegHandler = new JPEGMetadataHandler(false); FileMetadataHandler fileHandler = new FileMetadataHandler(false); Integer currentStart = fb.getStart(); if (currentStart == null) { currentStart = new Integer(0); } Map currentLinkPictureParameters = new HashMap(); Map currentParameters = new HashMap(); currentParameters.put("user", username); if (StringUtil.asNull(request.getServerName()) != null) { currentParameters.put("hostname", request.getServerName()); if (request.getServerPort() != 80) { currentParameters.put("port", new Integer(request.getServerPort())); } } currentParameters.put("contextpath", request.getContextPath()); Enumeration paramEnum = request.getParameterNames(); while (paramEnum.hasMoreElements()) { String parameter = (String) paramEnum.nextElement(); currentParameters.put(parameter, request.getParameter(parameter)); } ActionForward currentForward = mapping.findForward("current-link"); for (int i = 0; i < entities.length; i++) { picturesPB[i] = new PicturePB(); Picture picture = (Picture) entities[i]; if (StringUtil.asNull(picture.getFile()) != null) { picture.setFile(getImagePath(storageEntities, picture.getFile())); } PropertyUtils.copyProperties(picturesPB[i], entities[i]); if (useEnglish && StringUtil.asNull(picture.getTitleEnglish()) != null) { picturesPB[i].setTitle(picture.getTitleEnglish()); } if (useEnglish && StringUtil.asNull(picture.getDescriptionEnglish()) != null) { picturesPB[i].setDescription(picture.getDescriptionEnglish()); } pictureParameters.put("gallery", virtualGalleryId); pictureParameters.put("picture", picturesPB[i].getId()); if (picturesPB[i].getImage().startsWith("{")) { String path = pictureImageForward.getPath(); picturesPB[i].setImage( ServletParameterHelper.replaceDynamicParameters(path, pictureParameters)); } else { picturesPB[i].setImage(getImagePath(storageEntities, picturesPB[i].getImage())); } if (gallery.getUsername().equals(request.getRemoteUser())) { if (updateForward != null) { String path = updateForward.getPath(); picturesPB[i].setUpdateLink( ServletParameterHelper.replaceDynamicParameters(path, pictureParameters)); } if (removeForward != null) { String path = removeForward.getPath(); picturesPB[i].setRemoveLink( ServletParameterHelper.replaceDynamicParameters(path, pictureParameters)); } } else { if (gallery.getShowResolutionLinks() != null && gallery.getShowResolutionLinks().booleanValue() && resolutionForward != null) { ResolutionLinkPB[] resolutionLinksPB = new ResolutionLinkPB[resolutionsPB.length]; Map resolutionParameters = new HashMap(); resolutionParameters.put("gallery", virtualGalleryId); resolutionParameters.put("picture", picturesPB[i].getId()); for (int j = 0; j < resolutionLinksPB.length; j++) { resolutionParameters.put("width", resolutionsPB[j].getWidth()); String path = ServletParameterHelper.replaceDynamicParameters( resolutionForward.getPath(), resolutionParameters); resolutionLinksPB[j] = new ResolutionLinkPB( resolutionsPB[j].getId(), resolutionsPB[j].getDescription(), path); } picturesPB[i].setResolutions(resolutionLinksPB); } } if (picturesPB[i].getLink().startsWith("{")) { String path = null; if (defaultResolution != null) { if (resolutionForward != null) { path = resolutionForward.getPath(); } } if (path == null) { path = pictureLinkForward.getPath(); } picturesPB[i].setLink( ServletParameterHelper.replaceDynamicParameters(path, pictureParameters)); } else { picturesPB[i].setLink(getImagePath(storageEntities, picturesPB[i].getLink())); } if (gallery.getShowPictureTitle() != null && !gallery.getShowPictureTitle().booleanValue()) { picturesPB[i].setTitle(null); } picturesPB[i].setGallery(virtualGalleryId); if (picturesPB[i].getTitle() != null && gallery.getUseShortPictureNames() != null && gallery.getUseShortPictureNames().booleanValue()) { picturesPB[i].setTitle(((Picture) entities[i]).getShortTitle()); } if (StringUtil.asNull(gallery.getThumbnailPictureTitle()) != null) { picturesPB[i].setTitle( getPictureInfo( gallery.getThumbnailPictureTitle(), picture, picturesPB[i], jpegHandler, fileHandler)); } if (picturesPB[i].getTitle() != null && gallery.getCutLongPictureTitles() != null && gallery.getCutLongPictureTitles().booleanValue()) { if (picturesPB[i].getTitle() != null && picturesPB[i].getTitle().length() > 30) { picturesPB[i].setTitle( "..." + picturesPB[i].getTitle().substring(picturesPB[i].getTitle().length() - 27)); } } if (thumbnailInfo.length > 0) { picturesPB[i].setRow1Info( getPictureInfo(thumbnailInfo[0], picture, picturesPB[i], jpegHandler, fileHandler)); } if (thumbnailInfo.length > 1) { picturesPB[i].setRow2Info( getPictureInfo(thumbnailInfo[1], picture, picturesPB[i], jpegHandler, fileHandler)); } if (thumbnailInfo.length > 2) { picturesPB[i].setRow3Info( getPictureInfo(thumbnailInfo[2], picture, picturesPB[i], jpegHandler, fileHandler)); } if (currentForward != null) { currentLinkPictureParameters.clear(); currentLinkPictureParameters.putAll(pictureParameters); currentLinkPictureParameters.putAll(currentParameters); currentLinkPictureParameters.put("start", currentStart.toString()); picturesPB[i].setCurrentLink( ServletParameterHelper.replaceDynamicParameters( currentForward.getPath(), currentLinkPictureParameters)); currentStart = new Integer(currentStart.intValue() + 1); } } PictureCollectionPB pb = new PictureCollectionPB(); pb.setPictures(picturesPB); Map parameters = new HashMap(); parameters.putAll(currentParameters); addParameters(parameters, fb); Integer prevStart = getPreviousPage(fb.getStart(), max); if (prevStart != null) { parameters.put("start", prevStart.toString()); ActionForward forward = mapping.findForward("previous-link"); if (forward != null) { pb.setPrevLink( ServletParameterHelper.replaceDynamicParameters(forward.getPath(), parameters)); } } else { pb.setPrevLink(null); } Integer nextStart = getNextPage(fb.getStart(), max, picturesPB.length); if (nextStart != null) { parameters.put("start", nextStart.toString()); ActionForward forward = mapping.findForward("next-link"); if (forward != null) { pb.setNextLink( ServletParameterHelper.replaceDynamicParameters(forward.getPath(), parameters)); } } else { pb.setNextLink(null); } currentStart = fb.getStart(); if (currentStart == null) { currentStart = new Integer(0); } parameters.put("start", currentStart.toString()); if (currentForward != null) { pb.setCurrentLink( ServletParameterHelper.replaceDynamicParameters(currentForward.getPath(), parameters)); } ActionForward forward = null; if (gallery.getAllowSearch() != null && gallery.getAllowSearch().booleanValue()) { forward = mapping.findForward("search-link"); } else { forward = mapping.findForward("search-private-link"); } if (forward != null) { pb.setSearchLink( ServletParameterHelper.replaceDynamicParameters(forward.getPath(), parameters)); } forward = mapping.findForward("page-link"); if (forward != null) { pb.setPageLink( ServletParameterHelper.replaceDynamicParameters(forward.getPath(), parameters)); } request.setAttribute("picturesPB", pb); GalleryPB galleryPB = new GalleryPB(); PropertyUtils.copyProperties(galleryPB, gallery); if (useEnglish && StringUtil.asNull(gallery.getTitleEnglish()) != null) { galleryPB.setTitle(gallery.getTitleEnglish()); } if (useEnglish && StringUtil.asNull(gallery.getDescriptionEnglish()) != null) { galleryPB.setDescription(gallery.getDescriptionEnglish()); } galleryPB.setVirtual(Boolean.valueOf(!virtualGalleryId.equals(galleryId))); if (galleryPB.getNoOfCols() != null && galleryPB.getNoOfCols().intValue() <= 0) { galleryPB.setNoOfCols(null); } if (galleryPB.getNoOfRows() != null && galleryPB.getNoOfRows().intValue() <= 0) { galleryPB.setNoOfRows(null); } if (max == null || max.intValue() == 0 || (gallery.getNoOfCols() != null && gallery.getNoOfRows() != null && (gallery.getNoOfRows().intValue() * gallery.getNoOfCols().intValue()) < max.intValue())) { galleryPB.setNoOfRows(null); } galleryPB.setNoOfThumnailInfoRows( thumbnailInfo.length > 0 ? new Integer(thumbnailInfo.length + 1) : new Integer(1)); request.setAttribute("galleryPB", galleryPB); String skin = gallery.getSkin(); if (StringUtil.asNull(fb.getSkin()) != null) { skin = fb.getSkin(); } if (mapping.getParameter() != null && mapping.getParameter().equals("useskin")) { SkinFB previous = (SkinFB) request.getSession().getAttribute("skinPB"); if (StringUtil.asNull(skin) == null) { UserAccount template = (UserAccount) getEnvironment().getEntityFactory().create("gallery-useraccount"); template.setUsername(username); UserAccount account = (UserAccount) getEnvironment() .getEntityStorageFactory() .getStorage("gallery-useraccount") .load(template); skin = account.getSkin(); } if (previous == null || previous.getId() == null || !previous.getId().equals(skin)) { SkinFB pbSkin = SkinHelper.loadSkin(mapping, skin); request.getSession().setAttribute("skinPB", pbSkin); } } SkinFB pbSkin = (SkinFB) request.getSession().getAttribute("skinPB"); if (pbSkin == null || StringUtil.asNull(pbSkin.getStylesheet()) == null) { if (gallery != null && gallery.getStylesheet() != null && gallery.getStylesheet().length() > 0) { request.getSession().setAttribute("stylesheetPB", gallery.getStylesheet()); } else { request.getSession().removeAttribute("stylesheetPB"); } } else { request.getSession().setAttribute("stylesheetPB", pbSkin.getStylesheet()); } String pbTitle = (String) request.getSession().getAttribute("titlePB"); if (StringUtil.asNull(pbTitle) == null) { UserAccount template = (UserAccount) getEnvironment().getEntityFactory().create("gallery-useraccount"); template.setUsername(username); UserAccount account = (UserAccount) getEnvironment() .getEntityStorageFactory() .getStorage("gallery-useraccount") .load(template); String title = account.getTitle(); if (useEnglish && StringUtil.asNull(account.getTitleEnglish()) != null) { title = account.getTitleEnglish(); } request.getSession().setAttribute("titlePB", title); } }