/** calculate work pid, */ public String calculatePId() { UUIDGenerator uuidGen = UUIDGenerator.getInstance(); UUID uuidObj = uuidGen.generateTimeBasedUUID(); String executionId = uuidObj.toString(); pId = executionId; return executionId; }
@Test(expected = InvalidSharedIdException.class) public void getMetadataFromShareIdWithInvalidId() { UUID uuid = UUIDGenerator.getInstance().generateRandomBasedUUID(); String sharedId = Base64.encodeBase64URLSafeString( uuid.toByteArray()); // => 22 chars (eg. q3bEKPeDQvmJYgt4hJxOjw) Map<String, Object> metadata = quickShareService.getMetaData(sharedId); }
/** * 生成一个UUID。 * * <p> * * @return strUuid String */ public static String getUUID() { UUIDGenerator generator = UUIDGenerator.getInstance(); UUID uuid = generator.generateTimeBasedUUID(); String strUuid = uuid.toString(); strUuid = strUuid.substring(0, 8) + strUuid.substring(9, 13) + strUuid.substring(14, 18) + strUuid.substring(19, 23) + strUuid.substring(24); return strUuid; }
/** * Genera un identificador único para el String que se le pasa. * * @param id * @param prefijo * @return */ private static String getUUID(String id, String prefijo) { String result = null; if (id != null) { long time = System.currentTimeMillis(); id += Long.toString(time); UUID uuid = UUIDGenerator.getInstance().generateNameBasedUUID(new UUID(UUID.NAMESPACE_DNS), id); if (uuid != null) { result = uuid.toString(); if (prefijo != null) result = prefijo + result; } } return result; }
public static String createNewExecutionId() { String executionId; logger.debug("IN"); executionId = null; try { UUIDGenerator uuidGen = UUIDGenerator.getInstance(); UUID uuidObj = uuidGen.generateTimeBasedUUID(); executionId = uuidObj.toString(); executionId = executionId.replaceAll("-", ""); } catch (Throwable t) { } finally { logger.debug("OUT"); } return executionId; }
private ExecutionInstance createExecutionInstance( Integer biobjectId, Integer biobjectVersion, String aRoleName, String execId, Locale locale) { String executionFlowId = getAttributeAsString("EXECUTION_FLOW_ID"); Boolean displayToolbar = getAttributeAsBoolean(SpagoBIConstants.TOOLBAR_VISIBLE, true); Boolean displaySlider = getAttributeAsBoolean(SpagoBIConstants.SLIDERS_VISIBLE, true); String modality = requestContainsAttribute(ObjectsTreeConstants.MODALITY) ? getAttributeAsString(ObjectsTreeConstants.MODALITY) : SpagoBIConstants.NORMAL_EXECUTION_MODALITY; // create execution id UUIDGenerator uuidGen = UUIDGenerator.getInstance(); UUID uuidObj = uuidGen.generateTimeBasedUUID(); String executionId = uuidObj.toString(); executionId = executionId.replaceAll("-", ""); if (executionFlowId == null) executionFlowId = executionId; // create new execution instance ExecutionInstance instance = null; try { instance = new ExecutionInstance( getUserProfile(), executionFlowId, execId, biobjectId, biobjectVersion, aRoleName, modality, displayToolbar.booleanValue(), displaySlider.booleanValue(), locale); } catch (Exception e) { logger.error(e); } return instance; }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { // Retrieving the file upload defaults from pentaho.xml String relativePath = PentahoSystem.getSystemSetting( "file-upload-defaults/relative-path", String.valueOf(DEFAULT_RELATIVE_UPLOAD_FILE_PATH)); // $NON-NLS-1$ String maxFileLimit = PentahoSystem.getSystemSetting( "file-upload-defaults/max-file-limit", String.valueOf(MAX_FILE_SIZE)); // $NON-NLS-1$ String maxFolderLimit = PentahoSystem.getSystemSetting( "file-upload-defaults/max-folder-limit", String.valueOf(MAX_FOLDER_SIZE)); // $NON-NLS-1$ response.setContentType("text/plain"); FileItem uploadItem = getFileItem(request); if (uploadItem == null) { response .getWriter() .write( Messages.getInstance() .getErrorString("UploadFileServlet.ERROR_0001_NO_FILE_TO_UPLOAD")); return; } if (Long.parseLong(maxFileLimit) < uploadItem.getSize()) { response .getWriter() .write( Messages.getInstance().getErrorString("UploadFileServlet.ERROR_0003_FILE_TOO_BIG")); return; } String path = PentahoSystem.getApplicationContext().getSolutionPath(relativePath); File pathDir = new File(path); // create the path if it doesn't exist yet if (!pathDir.exists()) { pathDir.mkdirs(); } if (uploadItem.getSize() + getFolderSize(pathDir) > Long.parseLong(maxFolderLimit)) { response .getWriter() .write( Messages.getInstance() .getErrorString("UploadFileServlet.ERROR_0004_FOLDER_SIZE_LIMIT_REACHED")); return; } byte[] fileContents = uploadItem.get(); UUID id = UUIDUtil.getUUID(); String filename = id.toString() + CSV_EXT; if (doesFileExists(new File(path + filename))) { response .getWriter() .write( Messages.getInstance() .getErrorString("UploadFileServlet.ERROR_0002_FILE_ALREADY_EXIST")); return; } FileOutputStream outputStream = new FileOutputStream(path + filename); outputStream.write(fileContents); outputStream.flush(); outputStream.close(); response.getWriter().write(new String(filename)); } catch (Exception e) { response .getWriter() .write( Messages.getInstance() .getErrorString( "UploadFileServlet.ERROR_0005_UNKNOWN_ERROR", e.getLocalizedMessage())); } }
public void doService() { ExecutionInstance instance; Integer documentId; String documentLabel; Integer documentVersion; String executionRole; String userProvidedParametersStr; BIObject obj; IEngUserProfile profile; List roles; logger.debug("IN"); try { profile = getUserProfile(); documentId = requestContainsAttribute(DOCUMENT_ID) ? getAttributeAsInteger(DOCUMENT_ID) : null; documentVersion = requestContainsAttribute(DOCUMENT_VERSION) ? getAttributeAsInteger(DOCUMENT_VERSION) : null; documentLabel = getAttributeAsString(DOCUMENT_LABEL); executionRole = getAttributeAsString(EXECUTION_ROLE); userProvidedParametersStr = getAttributeAsString(ObjectsTreeConstants.PARAMETERS); logger.debug("Parameter [" + DOCUMENT_ID + "] is equals to [" + documentId + "]"); logger.debug("Parameter [" + DOCUMENT_LABEL + "] is equals to [" + documentLabel + "]"); logger.debug("Parameter [" + DOCUMENT_VERSION + "] is equals to [" + documentVersion + "]"); logger.debug("Parameter [" + EXECUTION_ROLE + "] is equals to [" + executionRole + "]"); Assert.assertTrue( !StringUtilities.isEmpty(documentLabel) || documentId != null, "At least one between [" + DOCUMENT_ID + "] and [" + DOCUMENT_LABEL + "] parameter must be specified on request"); Assert.assertTrue( !StringUtilities.isEmpty(executionRole), "Parameter [" + EXECUTION_ROLE + "] cannot be null"); // load object to chek if it exists obj = null; if (!StringUtilities.isEmpty(documentLabel)) { logger.debug("Loading document with label = [" + documentLabel + "] ..."); try { obj = DAOFactory.getBIObjectDAO().loadBIObjectByLabel(documentLabel); } catch (EMFUserError error) { logger.error("Object with label equals to [" + documentLabel + "] not found"); throw new SpagoBIServiceException( SERVICE_NAME, "Object with label equals to [" + documentId + "] not found", error); } } else if (documentId != null) { logger.info("Loading biobject with id = [" + documentId + "] ..."); try { obj = DAOFactory.getBIObjectDAO().loadBIObjectById(documentId); } catch (EMFUserError error) { logger.error("Object with id equals to [" + documentId + "] not found"); throw new SpagoBIServiceException( SERVICE_NAME, "Object with id equals to [" + documentId + "] not found", error); } } else { Assert.assertUnreachable( "At least one between [" + DOCUMENT_ID + "] and [" + DOCUMENT_LABEL + "] parameter must be specified on request"); } Assert.assertNotNull(obj, "Impossible to load document"); logger.debug("... docuemnt loaded succesfully"); // if into the request is specified a version of the template to use it's signed into the // object. if (documentVersion != null) obj.setDocVersion(documentVersion); // retrive roles for execution try { roles = ObjectsAccessVerifier.getCorrectRolesForExecution(obj.getId(), profile); } catch (Throwable t) { throw new SpagoBIServiceException(SERVICE_NAME, t); } if (roles != null && !roles.contains(executionRole)) { logger.error( "Document [id: " + obj.getId() + "; label: " + obj.getLabel() + " ] cannot be executed by any role of the user [" + profile.getUserUniqueIdentifier() + "]"); throw new SpagoBIServiceException( SERVICE_NAME, "Document [id: " + obj.getId() + "; label: " + obj.getLabel() + " ] cannot be executed by any role of the user [" + profile.getUserUniqueIdentifier() + "]"); } // so far so good: everything has been validated successfully. Let's create a new // ExecutionInstance. // instance = createExecutionInstance(obj.getId(), executionRole); UUIDGenerator uuidGen = UUIDGenerator.getInstance(); UUID uuidObj = uuidGen.generateTimeBasedUUID(); String executionContextId = uuidObj.toString(); executionContextId = executionContextId.replaceAll("-", ""); CoreContextManager ccm = createContext(executionContextId); // so far so good: everything has been validated successfully. Let's create a new // ExecutionInstance. instance = createExecutionInstance( obj.getId(), obj.getDocVersion(), executionRole, executionContextId, getLocale()); createContext(executionContextId).set(ExecutionInstance.class.getName(), instance); // instance.refreshParametersValues(getSpagoBIRequestContainer().getRequest(), true); // instance.setParameterValues(userProvidedParametersStr, true); // refresh obj variable because createExecutionInstance load the BIObject in a different way // obj = instance.getBIObject(); // ExecutionInstance has been created it's time to prepare the response with the instance // unique id and flush it to the client JSONObject responseJSON = null; responseJSON = new JSONObject(); try { responseJSON.put("execContextId", executionContextId); } catch (JSONException e) { throw new SpagoBIServiceException("Impossible to serialize response", e); } try { writeBackToClient(new JSONSuccess(responseJSON)); } catch (IOException e) { throw new SpagoBIServiceException("Impossible to write back the responce to the client", e); } } finally { logger.debug("OUT"); } }
/** * Returns an url for execute the document with the engine associated. It calls relative driver. * * @param objLabel the logical label of the document (gets from the template file) * @param sessionContainer session object * @param requestSB request object * @return String the complete url. It use this format: <code_error>|<url>. If there is an error * during the execution <code_error> is valorized and url is null, else it is null and the url * is complete. */ public static String getExecutionUrl( String objLabel, SessionContainer sessionContainer, SourceBean requestSB) { logger.debug("IN"); Monitor monitor = MonitorFactory.start("spagobi.engines.DocumentCompositionUtils.getExecutionUrl"); String baseUrlReturn = ""; String urlReturn = ""; if (objLabel == null || objLabel.equals("")) { logger.error("Object Label is null: cannot get engine's url."); return "1008|"; } try { // get the user profile from session SessionContainer permSession = sessionContainer.getPermanentContainer(); IEngUserProfile profile = (IEngUserProfile) permSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE); // get the execution role CoreContextManager contextManager = new CoreContextManager( new SpagoBISessionContainer(sessionContainer), new LightNavigatorContextRetrieverStrategy(requestSB)); ExecutionInstance instance = contextManager.getExecutionInstance(ExecutionInstance.class.getName()); String executionRole = instance.getExecutionRole(); Integer objId = DAOFactory.getBIObjectDAO().loadBIObjectByLabel(objLabel).getId(); BIObject obj = DAOFactory.getBIObjectDAO().loadBIObjectForExecutionByIdAndRole(objId, executionRole); // BIObject obj = // DAOFactory.getBIObjectDAO().loadBIObjectForExecutionByLabelAndRole(objLabel, // executionRole); // BIObject obj = DAOFactory.getBIObjectDAO().loadBIObjectByLabel(objLabel); if (obj == null) { logger.error( "Cannot obtain engine url. Document with label " + objLabel + " doesn't exist into database."); List l = new ArrayList(); l.add(objLabel); throw new EMFUserError(EMFErrorSeverity.ERROR, "1005", l, messageBundle); } // Engine engine = obj.getEngine(); /*ALL CONTROLS OF COMPATIBILITY ARE REMANDED TO THE SINGLE ENGINE CALLED // GET THE TYPE OF ENGINE (INTERNAL / EXTERNAL) AND THE SUITABLE BIOBJECT TYPES Domain engineType = null; Domain compatibleBiobjType = null; try { engineType = DAOFactory.getDomainDAO().loadDomainById(engine.getEngineTypeId()); compatibleBiobjType = DAOFactory.getDomainDAO().loadDomainById(engine.getBiobjTypeId()); } catch (EMFUserError error) { logger.error("Error retrieving document's engine information", error); return "1009|"; } catch (Exception error) { logger.error("Error retrieving document's engine information", error); return "1009|"; } String compatibleBiobjTypeCd = compatibleBiobjType.getValueCd(); String biobjTypeCd = obj.getBiObjectTypeCode(); // CHECK IF THE BIOBJECT IS COMPATIBLE WITH THE TYPES SUITABLE FOR THE ENGINE if (!compatibleBiobjTypeCd.equalsIgnoreCase(biobjTypeCd)) { // the engine document type and the biobject type are not compatible logger.error("Engine cannot execute input document type: " + "the engine " + engine.getName() + " can execute '" + compatibleBiobjTypeCd + "' type documents " + "while the input document is a '" + biobjTypeCd + "'."); Vector params = new Vector(); params.add(engine.getName()); params.add(compatibleBiobjTypeCd); params.add(biobjTypeCd); //errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR, 2002, params)); return "2002|"; } */ // IF USER CAN'T EXECUTE THE OBJECT RETURN // if (!ObjectsAccessVerifier.canSee(obj, profile)) return "1010|"; // get object configuration DocumentCompositionConfiguration docConfig = null; docConfig = (DocumentCompositionConfiguration) contextManager.get("docConfig"); Document document = null; // get correct document configuration List lstDoc = docConfig.getLabelsArray(); boolean foundDoc = false; for (int i = 0; i < lstDoc.size(); i++) { document = (Document) docConfig.getDocument((String) lstDoc.get(i)); if (document != null) { if (!obj.getLabel().equalsIgnoreCase(document.getSbiObjLabel())) continue; else { foundDoc = true; break; } } } if (!foundDoc) { List l = new ArrayList(); l.add(obj.getLabel()); EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 1079, l); logger.error( "The object with label " + obj.getLabel() + " hasn't got a document into template"); return "1002|"; } String className = obj.getEngine().getClassName(); if ((className == null || className.trim().equals("")) && (document.getSnapshot() == null || !document.getSnapshot())) { // external engine // baseUrlReturn = obj.getEngine().getUrl() + "?"; baseUrlReturn = obj.getEngine().getUrl(); if (baseUrlReturn.indexOf("?") < 0) baseUrlReturn += "?"; String driverClassName = obj.getEngine().getDriverName(); IEngineDriver aEngineDriver = (IEngineDriver) Class.forName(driverClassName).newInstance(); Map mapPars = aEngineDriver.getParameterMap(obj, profile, executionRole); String id = (String) requestSB.getAttribute("vpId"); if (id != null) { IViewpointDAO VPDAO = DAOFactory.getViewpointDAO(); Viewpoint vp = VPDAO.loadViewpointByID(new Integer(id)); String[] vpParameters = vp.getVpValueParams().split("%26"); if (vpParameters != null) { for (int i = 0; i < vpParameters.length; i++) { String param = (String) vpParameters[i]; String name = param.substring(0, param.indexOf("%3D")); String value = param.substring(param.indexOf("%3D") + 3); if (mapPars.get(name) != null) { mapPars.remove(name); mapPars.put(name, value); } else mapPars.put(name, value); } } } mapPars.put(SpagoBIConstants.SBI_CONTEXT, GeneralUtilities.getSpagoBiContext()); mapPars.put(SpagoBIConstants.SBI_HOST, GeneralUtilities.getSpagoBiHost()); UUIDGenerator uuidGen = UUIDGenerator.getInstance(); UUID uuidObj = uuidGen.generateRandomBasedUUID(); String executionId = uuidObj.toString(); executionId = executionId.replaceAll("-", ""); mapPars.put("SBI_EXECUTION_ID", executionId); mapPars.put("EXECUTION_CONTEXT", "DOCUMENT_COMPOSITION"); // Auditing AuditManager auditManager = AuditManager.getInstance(); Integer executionAuditId = auditManager.insertAudit( instance.getBIObject(), null, profile, executionRole, instance.getExecutionModality()); // adding parameters for AUDIT updating if (executionAuditId != null) { mapPars.put(AuditManager.AUDIT_ID, executionAuditId.toString()); } Set parKeys = mapPars.keySet(); Iterator parKeysIter = parKeys.iterator(); do { if (!parKeysIter.hasNext()) { break; } String parkey = parKeysIter.next().toString(); String parvalue = mapPars.get(parkey).toString(); urlReturn = (new StringBuilder()) .append(urlReturn) .append("&") .append(parkey) .append("=") .append(parvalue) .toString(); } while (true); } else { // internal engine baseUrlReturn = GeneralUtilities.getSpagoBIProfileBaseUrl(profile.getUserUniqueIdentifier().toString()); urlReturn = "&" + ObjectsTreeConstants.OBJECT_LABEL + "=" + objLabel; // identity string for context UUIDGenerator uuidGen = UUIDGenerator.getInstance(); UUID uuid = uuidGen.generateRandomBasedUUID(); urlReturn += "&" + LightNavigationManager.LIGHT_NAVIGATOR_ID + "=" + uuid.toString(); if (document.getSnapshot() != null && document.getSnapshot()) { Snapshot snap = DAOFactory.getSnapshotDAO().getLastSnapshot(objId); if (snap != null) { urlReturn += "&SNAPSHOT_ID=" + snap.getId(); } urlReturn += "&OBJECT_ID=" + objId; urlReturn += "&ACTION_NAME=GET_SNAPSHOT_CONTENT"; } else { urlReturn += "&PAGE=ExecuteBIObjectPage&" + SpagoBIConstants.IGNORE_SUBOBJECTS_VIEWPOINTS_SNAPSHOTS + "=true"; urlReturn += "&" + ObjectsTreeConstants.MODALITY + "=" + SpagoBIConstants.DOCUMENT_COMPOSITION; } } // I add passing of SBI_LANGUAGE and SBI_COUNTRY // on session container they are called AF_COUNTRY and AF_LANGUAGE SessionContainer sContainer = sessionContainer.getPermanentContainer(); if (sContainer != null) { Object language = sContainer.getAttribute("AF_LANGUAGE"); Object country = sContainer.getAttribute("AF_COUNTRY"); if (language == null) { language = sContainer.getAttribute("SBI_LANGUAGE"); } if (country == null) { country = sContainer.getAttribute("SBI_COUNTRY"); } if (language != null && country != null) { urlReturn += "&" + SpagoBIConstants.SBI_LANGUAGE + "=" + language + "&" + SpagoBIConstants.SBI_COUNTRY + "=" + country; } } urlReturn += "&" + SpagoBIConstants.ROLE + "=" + executionRole; urlReturn += getParametersUrl(obj, document, requestSB, instance); // adds '|' char for management error into jsp if is necessary. urlReturn = baseUrlReturn + urlReturn; logger.debug("urlReturn: " + "|" + urlReturn); } catch (Exception ex) { logger.error("Error while getting execution url: " + ex); return null; } finally { monitor.stop(); } logger.debug("OUT"); return "|" + urlReturn; }
/** * Builds list navigation buttons inside the list tag. If the number of elements is higher than * 10, they are divided into pages; this methods creates forward and backward arrows and page * number information for navigation. * * @throws JspException If any Exception occurs */ protected void makeNavigationButton() throws JspException { String pageNumberString = (String) _content.getAttribute("PAGED_LIST.PAGE_NUMBER"); if (_session.getAttribute("PAGE_NUMBER") != null) _session.delAttribute("PAGE_NUMBER"); _session.setAttribute("PAGE_NUMBER", pageNumberString); int pageNumber = 1; try { pageNumber = Integer.parseInt(pageNumberString); } catch (NumberFormatException ex) { TracerSingleton.log( Constants.NOME_MODULO, TracerSingleton.WARNING, "ListTag::makeNavigationButton:: PAGE_NUMBER nullo"); } String pagesNumberString = (String) _content.getAttribute("PAGED_LIST.PAGES_NUMBER"); int pagesNumber = 1; try { pagesNumber = Integer.parseInt(pagesNumberString); } catch (NumberFormatException ex) { TracerSingleton.log( Constants.NOME_MODULO, TracerSingleton.WARNING, "ListTag::makeNavigationButton:: PAGES_NUMBER nullo"); } int prevPage = pageNumber - 1; if (prevPage < 1) prevPage = 1; int nextPage = pageNumber + 1; if (nextPage > pagesNumber) nextPage = pagesNumber; // get the right parameters of the request // HashMap paramsMap = getQueryStringParameter(); // add the parameter for the provider // paramsMap.putAll(_providerUrlMap); _htmlStream.append(" <TABLE CELLPADDING=0 CELLSPACING=0 WIDTH='100%' BORDER=0>\n"); _htmlStream.append(" <TR>\n"); _htmlStream.append( " <TD class='portlet-section-footer' valign='center' align='left' width='14'>\n"); // create link for previous page HashMap prevParamsMap = new HashMap(); prevParamsMap.putAll(_providerUrlMap); prevParamsMap.put("MESSAGE", "LIST_PAGE"); prevParamsMap.put("LIST_PAGE", String.valueOf(prevPage)); PortletURL prevUrl = createUrl(prevParamsMap); HashMap nextParamsMap = new HashMap(); nextParamsMap.putAll(_providerUrlMap); nextParamsMap.put("MESSAGE", "LIST_PAGE"); nextParamsMap.put("LIST_PAGE", String.valueOf(nextPage)); PortletURL nextUrl = createUrl(nextParamsMap); // identity string for object of the page UUIDGenerator uuidGen = UUIDGenerator.getInstance(); UUID uuid = uuidGen.generateTimeBasedUUID(); String requestIdentity = uuid.toString(); requestIdentity = requestIdentity.replaceAll("-", ""); String formId = "formFilter" + requestIdentity; String valueFilter = (String) _serviceRequest.getAttribute(SpagoBIConstants.VALUE_FILTER); String columnFilter = (String) _serviceRequest.getAttribute(SpagoBIConstants.COLUMN_FILTER); String typeFilter = (String) _serviceRequest.getAttribute(SpagoBIConstants.TYPE_FILTER); if (valueFilter != null && columnFilter != null && typeFilter != null) { prevUrl.setParameter(SpagoBIConstants.VALUE_FILTER, valueFilter); prevUrl.setParameter(SpagoBIConstants.COLUMN_FILTER, columnFilter); prevUrl.setParameter(SpagoBIConstants.TYPE_FILTER, typeFilter); nextUrl.setParameter(SpagoBIConstants.VALUE_FILTER, valueFilter); nextUrl.setParameter(SpagoBIConstants.COLUMN_FILTER, columnFilter); nextUrl.setParameter(SpagoBIConstants.TYPE_FILTER, typeFilter); } else { valueFilter = ""; columnFilter = ""; typeFilter = ""; } if (pageNumber != 1) { // _htmlStream.append(" <A href=\""+prevUrl.toString()+"\"><IMG // src='"+renderResponse.encodeURL(renderRequest.getContextPath() + "/img/prevPage.gif")+"' // ALIGN=RIGHT border=0></a>\n"); _htmlStream.append( "<input type='image' " + "name='" + "prevPage" + "' " + "src ='" + renderResponse.encodeURL(renderRequest.getContextPath() + "/img/prevPage.gif") + "' " + "align='left' border=0" + "alt='" + "GO To Previous Page" + "'>\n"); } else { _htmlStream.append( " <IMG src='" + renderResponse.encodeURL(renderRequest.getContextPath() + "/img/prevPage.gif") + "' ALIGN=RIGHT border=0>\n"); } _htmlStream.append(" </TD>\n"); // create center blank cell // _htmlStream.append(" <TD class='portlet-section-footer'> </TD>\n"); // visualize page numbers String pageLabel = msgBuilder.getMessage("ListTag.pageLable", _bundle, httpRequest); String pageOfLabel = msgBuilder.getMessage("ListTag.pageOfLable", _bundle, httpRequest); _htmlStream.append(" <TD class='portlet-section-footer' align='center'>\n"); _htmlStream.append( " <font class='aindice'> " + pageLabel + " " + pageNumber + " " + pageOfLabel + " " + pagesNumber + " </font>\n"); _htmlStream.append(" \n"); // Form for list filtering; if not specified, the filter is enabled if (_filter == null || _filter.equalsIgnoreCase("enabled")) { PortletURL allUrl = createUrl(_providerUrlMap); PortletURL filterURL = createUrl(_providerUrlMap); String label = msgBuilder.getMessage("SBIListLookPage.labelFilter", _bundle, httpRequest); String labelStart = msgBuilder.getMessage("SBIListLookPage.startWith", _bundle, httpRequest); ; String labelEnd = msgBuilder.getMessage("SBIListLookPage.endWith", _bundle, httpRequest); ; String labelContain = msgBuilder.getMessage("SBIListLookPage.contains", _bundle, httpRequest); ; String labelEqual = msgBuilder.getMessage("SBIListLookPage.isEquals", _bundle, httpRequest); ; String labelFilter = msgBuilder.getMessage("SBIListLookPage.filter", _bundle, httpRequest); String labelAll = msgBuilder.getMessage("SBIListLookPage.all", _bundle, httpRequest); _htmlStream.append(" <br/><br/>\n"); _htmlStream.append( " <form action='" + filterURL + "' id='" + formId + "' method='post'>\n"); _htmlStream.append(" " + label + "\n"); _htmlStream.append(" <select name='" + SpagoBIConstants.COLUMN_FILTER + "'>\n"); for (int i = 0; i < _columns.size(); i++) { String nameColumn = (String) ((SourceBean) _columns.elementAt(i)).getAttribute("NAME"); String labelColumnCode = (String) ((SourceBean) _columns.elementAt(i)).getAttribute("LABEL"); String labelColumn = new String(nameColumn); if (labelColumnCode != null) labelColumn = msgBuilder.getMessage(labelColumnCode, _bundle, httpRequest); String selected = ""; if (nameColumn.equalsIgnoreCase(columnFilter)) selected = " selected='selected' "; _htmlStream.append( " <option value='" + nameColumn + "' " + selected + " >" + labelColumn + "</option>\n"); } String selected = ""; _htmlStream.append(" </select>\n"); _htmlStream.append(" <select name='" + SpagoBIConstants.TYPE_FILTER + "'>\n"); if (typeFilter.equalsIgnoreCase(SpagoBIConstants.START_FILTER)) selected = " selected='selected' "; else selected = ""; _htmlStream.append( " <option value='" + SpagoBIConstants.START_FILTER + "' " + selected + " >" + labelStart + "</option>\n"); if (typeFilter.equalsIgnoreCase(SpagoBIConstants.END_FILTER)) selected = " selected='selected' "; else selected = ""; _htmlStream.append( " <option value='" + SpagoBIConstants.END_FILTER + "' " + selected + " >" + labelEnd + "</option>\n"); if (typeFilter.equalsIgnoreCase(SpagoBIConstants.EQUAL_FILTER)) selected = " selected='selected' "; else selected = ""; _htmlStream.append( " <option value='" + SpagoBIConstants.EQUAL_FILTER + "' " + selected + " >" + labelEqual + "</option>\n"); if (typeFilter.equalsIgnoreCase(SpagoBIConstants.CONTAIN_FILTER)) selected = " selected='selected' "; else selected = ""; _htmlStream.append( " <option value='" + SpagoBIConstants.CONTAIN_FILTER + "' " + selected + " >" + labelContain + "</option>\n"); _htmlStream.append(" </select>\n"); _htmlStream.append( " <input type=\"text\" name=\"" + SpagoBIConstants.VALUE_FILTER + "\" size=\"10\" value=\"" + valueFilter + "\" /> \n"); _htmlStream.append( " <a href='javascript:document.getElementById(\"" + formId + "\").submit()'>" + labelFilter + "</a> \n"); _htmlStream.append(" <a href='" + allUrl.toString() + "'>" + labelAll + "</a> \n"); _htmlStream.append(" </form> \n"); } // create link for next page _htmlStream.append( " <TD class='portlet-section-footer' valign='center' align='right' width='14'>\n"); if (pageNumber != pagesNumber) { // _htmlStream.append(" <A href=\""+nextUrl.toString()+"\"><IMG // src='"+renderResponse.encodeURL(renderRequest.getContextPath() + "/img/nextPage.gif")+"' // ALIGN=RIGHT border=0></a>\n"); _htmlStream.append( "<input type='image' " + "name='" + "nextPage" + "' " + "src ='" + renderResponse.encodeURL(renderRequest.getContextPath() + "/img/nextPage.gif") + "' " + "align='right' border='0'" + "alt='" + "GO To Next Page" + "'>\n"); } else { _htmlStream.append( " <IMG src='" + renderResponse.encodeURL(renderRequest.getContextPath() + "/img/nextPage.gif") + "' ALIGN=RIGHT border=0>\n"); } _htmlStream.append(" </TD>\n"); _htmlStream.append(" </TR>\n"); _htmlStream.append("</TABLE>\n"); }