// ---------------------------------------------------------------------------- public String ToHtml(HttpSession Sess) { String CadHtml = " <ul class=\"Showed\">"; for (int i = 0; i < ListRows.size(); i++) { CadHtml += ((Branch) ListRows.get(i)).HtmlPropio("RefreshDocs", "MainFrame"); } return (CadHtml + "</ul>"); }
/** Expand the current node and return the list of leaves (MaterialVO objects). */ private ArrayList getComponents(DefaultMutableTreeNode node) { ArrayList list = new ArrayList(); for (int i = 0; i < node.getChildCount(); i++) list.addAll(getComponents((DefaultMutableTreeNode) node.getChildAt(i))); if (node.isLeaf()) list.add(node.getUserObject()); return list; }
public void removePhaseListener(PhaseListener listener) { if (listener == null) throw new NullPointerException(); synchronized (_phaseList) { _phaseList.remove(listener); _phaseListeners = new PhaseListener[_phaseList.size()]; _phaseList.toArray(_phaseListeners); } }
/** Gets all Genomic Data. */ private ProfileDataSummary getGenomicData( String cancerStudyId, HashMap<String, GeneticProfile> defaultGeneticProfileSet, SampleList defaultSampleSet, String geneListStr, ArrayList<SampleList> sampleList, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, DaoException { // parse geneList, written in the OncoPrintSpec language (except for changes by XSS clean) double zScore = ZScoreUtil.getZScore( new HashSet<String>(defaultGeneticProfileSet.keySet()), new ArrayList<GeneticProfile>(defaultGeneticProfileSet.values()), request); double rppaScore = ZScoreUtil.getRPPAScore(request); ParserOutput theOncoPrintSpecParserOutput = OncoPrintSpecificationDriver.callOncoPrintSpecParserDriver( geneListStr, new HashSet<String>(defaultGeneticProfileSet.keySet()), new ArrayList<GeneticProfile>(defaultGeneticProfileSet.values()), zScore, rppaScore); ArrayList<String> geneList = new ArrayList<String>(); geneList.addAll(theOncoPrintSpecParserOutput.getTheOncoPrintSpecification().listOfGenes()); ArrayList<ProfileData> profileDataList = new ArrayList<ProfileData>(); Set<String> warningUnion = new HashSet<String>(); for (GeneticProfile profile : defaultGeneticProfileSet.values()) { try { GetProfileData remoteCall = new GetProfileData( profile, geneList, StringUtils.join(defaultSampleSet.getSampleList(), " ")); ProfileData pData = remoteCall.getProfileData(); warningUnion.addAll(remoteCall.getWarnings()); profileDataList.add(pData); } catch (IllegalArgumentException e) { e.getStackTrace(); } } ProfileMerger merger = new ProfileMerger(profileDataList); ProfileData mergedProfile = merger.getMergedProfile(); ProfileDataSummary dataSummary = new ProfileDataSummary( mergedProfile, theOncoPrintSpecParserOutput.getTheOncoPrintSpecification(), zScore, rppaScore); return dataSummary; }
private void level2level3catalog( RadarType radarType, String pathInfo, PrintWriter pw, HttpServletRequest req, HttpServletResponse res) throws IOException { try { String type; if (pathInfo.contains("level2")) type = radarType.toString() + "/level2"; else type = radarType.toString() + "/level3"; ByteArrayOutputStream os = new ByteArrayOutputStream(10000); InvCatalogFactory factory = InvCatalogFactory.getDefaultFactory(false); factory.writeXML(cat, os, true); InvCatalogImpl tCat = factory.readXML(new ByteArrayInputStream(os.toByteArray()), catURI); Iterator parents = tCat.getDatasets().iterator(); while (parents.hasNext()) { ArrayList<InvDatasetImpl> delete = new ArrayList<InvDatasetImpl>(); InvDatasetImpl top = (InvDatasetImpl) parents.next(); Iterator tDatasets = top.getDatasets().iterator(); while (tDatasets.hasNext()) { InvDatasetImpl ds = (InvDatasetImpl) tDatasets.next(); if (ds instanceof InvDatasetScan) { InvDatasetScan ids = (InvDatasetScan) ds; if (ids.getPath() == null) continue; if (ids.getPath().contains(type)) { ids.setXlinkHref(ids.getPath() + "/dataset.xml"); } else { delete.add(ds); } } } // remove datasets for (InvDatasetImpl idi : delete) { top.removeDataset(idi); } } if (pathInfo.endsWith("xml")) { String catAsString = factory.writeXML(tCat); pw.println(catAsString); pw.flush(); } else { HtmlWriter.getInstance().writeCatalog(req, res, tCat, true); // show catalog as HTML } } catch (Throwable e) { log.error("RadarServer.level2level3catalog failed", e); if (!res.isCommitted()) res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } return; }
static void returnOembed(HttpServletRequest request, HttpServletResponse response) throws Exception { String url = request.getParameter("url"); if (url == null) throw new Exception("No subject URL found."); String retUrl = request.getParameter(S3Servlet.URL_PARAM); if (retUrl == null && !S3Servlet.testing) throw new Exception("Recieved no launch presentation return url"); Enumeration<String> en = request.getParameterNames(); ArrayList<String> keys = new ArrayList<String>(), vals = new ArrayList<String>(); String key, value; while (en.hasMoreElements()) { key = en.nextElement(); if ("action".equals(key)) continue; if ("launch_presentation_return_url".equals(key)) continue; if ("url".equals(key)) continue; if ((value = request.getParameter(key)) != null) { keys.add(key); vals.add(value); } // if// } // while// String endpoint = S3Servlet.makeUrl( S3Servlet.server + S3Servlet.prefix + "/" + S3Action.oembed, keys.toArray(new String[keys.size()]), vals.toArray(new String[vals.size()])); String oembedUrl = S3Servlet.makeUrl( retUrl, new String[] {"embed_type", "endpoint", "url"}, new String[] {"oembed", endpoint, url}); response.reset(); response.sendRedirect(oembedUrl); } // returnOembed//
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); Connection conn = null; try { conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); String sql = "select WAR04_WAREHOUSE_MOTIVES.QTY_SIGN,WAR04_WAREHOUSE_MOTIVES.ITEM_TYPE,WAR02_WAREHOUSE_MOVEMENTS.PROGRESSIVE,WAR02_WAREHOUSE_MOVEMENTS.COMPANY_CODE_SYS01," + "WAR02_WAREHOUSE_MOVEMENTS.WAREHOUSE_CODE_WAR01,WAR02_WAREHOUSE_MOVEMENTS.ITEM_CODE_ITM01,WAR02_WAREHOUSE_MOVEMENTS.PROGRESSIVE_HIE01," + "SYS10_LOC.DESCRIPTION,WAR02_WAREHOUSE_MOVEMENTS.MOVEMENT_DATE,WAR02_WAREHOUSE_MOVEMENTS.USERNAME,WAR02_WAREHOUSE_MOVEMENTS.NOTE," + "WAR02_WAREHOUSE_MOVEMENTS.DELTA_QTY,WAR02_WAREHOUSE_MOVEMENTS.WAREHOUSE_MOTIVE_WAR04,SYS10_WAR04.DESCRIPTION,SYS10_ITM01.DESCRIPTION," + "WAR01_WAREHOUSES.DESCRIPTION," + "WAR02_WAREHOUSE_MOVEMENTS.VARIANT_TYPE_ITM06,WAR02_WAREHOUSE_MOVEMENTS.VARIANT_CODE_ITM11," + "WAR02_WAREHOUSE_MOVEMENTS.VARIANT_TYPE_ITM07,WAR02_WAREHOUSE_MOVEMENTS.VARIANT_CODE_ITM12," + "WAR02_WAREHOUSE_MOVEMENTS.VARIANT_TYPE_ITM08,WAR02_WAREHOUSE_MOVEMENTS.VARIANT_CODE_ITM13," + "WAR02_WAREHOUSE_MOVEMENTS.VARIANT_TYPE_ITM09,WAR02_WAREHOUSE_MOVEMENTS.VARIANT_CODE_ITM14," + "WAR02_WAREHOUSE_MOVEMENTS.VARIANT_TYPE_ITM10,WAR02_WAREHOUSE_MOVEMENTS.VARIANT_CODE_ITM15 " + " from " + "WAR04_WAREHOUSE_MOTIVES,WAR02_WAREHOUSE_MOVEMENTS,SYS10_TRANSLATIONS SYS10_LOC,SYS10_TRANSLATIONS SYS10_WAR04," + "SYS10_TRANSLATIONS SYS10_ITM01,WAR01_WAREHOUSES,ITM01_ITEMS where " + "WAR02_WAREHOUSE_MOVEMENTS.WAREHOUSE_MOTIVE_WAR04=WAR04_WAREHOUSE_MOTIVES.WAREHOUSE_MOTIVE and " + "WAR04_WAREHOUSE_MOTIVES.PROGRESSIVE_SYS10=SYS10_WAR04.PROGRESSIVE and " + "SYS10_WAR04.LANGUAGE_CODE=? and " + "WAR02_WAREHOUSE_MOVEMENTS.PROGRESSIVE_HIE01=SYS10_LOC.PROGRESSIVE and " + "SYS10_LOC.LANGUAGE_CODE=? and " + "WAR02_WAREHOUSE_MOVEMENTS.COMPANY_CODE_SYS01=ITM01_ITEMS.COMPANY_CODE_SYS01 and " + "WAR02_WAREHOUSE_MOVEMENTS.ITEM_CODE_ITM01=ITM01_ITEMS.ITEM_CODE and " + "ITM01_ITEMS.PROGRESSIVE_SYS10=SYS10_ITM01.PROGRESSIVE and " + "SYS10_ITM01.LANGUAGE_CODE=? and " + "WAR02_WAREHOUSE_MOVEMENTS.COMPANY_CODE_SYS01=WAR01_WAREHOUSES.COMPANY_CODE_SYS01 and " + "WAR02_WAREHOUSE_MOVEMENTS.WAREHOUSE_CODE_WAR01=WAR01_WAREHOUSES.WAREHOUSE_CODE "; Map attribute2dbField = new HashMap(); attribute2dbField.put("qtySignWAR04", "WAR04_WAREHOUSE_MOTIVES.QTY_SIGN"); attribute2dbField.put("itemTypeWAR04", "WAR04_WAREHOUSE_MOTIVES.ITEM_TYPE"); attribute2dbField.put("progressiveWAR02", "WAR02_WAREHOUSE_MOVEMENTS.PROGRESSIVE"); attribute2dbField.put( "companyCodeSys01WAR02", "WAR02_WAREHOUSE_MOVEMENTS.COMPANY_CODE_SYS01"); attribute2dbField.put( "warehouseCodeWar01WAR02", "WAR02_WAREHOUSE_MOVEMENTS.WAREHOUSE_CODE_WAR01"); attribute2dbField.put("itemCodeItm01WAR02", "WAR02_WAREHOUSE_MOVEMENTS.ITEM_CODE_ITM01"); attribute2dbField.put("progressiveHie01WAR02", "WAR02_WAREHOUSE_MOVEMENTS.PROGRESSIVE_HIE01"); attribute2dbField.put("locationDescriptionSYS10", "SYS10_LOC.DESCRIPTION"); attribute2dbField.put("movementDateWAR02", "WAR02_WAREHOUSE_MOVEMENTS.MOVEMENT_DATE"); attribute2dbField.put("usernameWAR02", "WAR02_WAREHOUSE_MOVEMENTS.USERNAME"); attribute2dbField.put("noteWAR02", "WAR02_WAREHOUSE_MOVEMENTS.NOTE"); attribute2dbField.put("deltaQtyWAR02", "WAR02_WAREHOUSE_MOVEMENTS.DELTA_QTY"); attribute2dbField.put( "warehouseMotiveWar04WAR02", "WAR02_WAREHOUSE_MOVEMENTS.WAREHOUSE_MOTIVE_WAR04"); attribute2dbField.put("motiveDescriptionSYS10", "SYS10_WAR04.DESCRIPTION"); attribute2dbField.put("itemDescriptionSYS10", "SYS10_ITM01.DESCRIPTION"); attribute2dbField.put("descriptionWAR01", "WAR01_WAREHOUSES.DESCRIPTION"); attribute2dbField.put( "variantTypeItm06WAR02", "WAR02_WAREHOUSE_MOVEMENTS.VARIANT_TYPE_ITM06"); attribute2dbField.put( "variantCodeItm11WAR02", "WAR02_WAREHOUSE_MOVEMENTS.VARIANT_CODE_ITM11"); attribute2dbField.put( "variantTypeItm07WAR02", "WAR02_WAREHOUSE_MOVEMENTS.VARIANT_TYPE_ITM07"); attribute2dbField.put( "variantCodeItm12WAR02", "WAR02_WAREHOUSE_MOVEMENTS.VARIANT_CODE_ITM12"); attribute2dbField.put( "variantTypeItm08WAR02", "WAR02_WAREHOUSE_MOVEMENTS.VARIANT_TYPE_ITM08"); attribute2dbField.put( "variantCodeItm13WAR02", "WAR02_WAREHOUSE_MOVEMENTS.VARIANT_CODE_ITM13"); attribute2dbField.put( "variantTypeItm09WAR02", "WAR02_WAREHOUSE_MOVEMENTS.VARIANT_TYPE_ITM09"); attribute2dbField.put( "variantCodeItm14WAR02", "WAR02_WAREHOUSE_MOVEMENTS.VARIANT_CODE_ITM14"); attribute2dbField.put( "variantTypeItm10WAR02", "WAR02_WAREHOUSE_MOVEMENTS.VARIANT_TYPE_ITM10"); attribute2dbField.put( "variantCodeItm15WAR02", "WAR02_WAREHOUSE_MOVEMENTS.VARIANT_CODE_ITM15"); ArrayList values = new ArrayList(); values.add(serverLanguageId); values.add(serverLanguageId); values.add(serverLanguageId); GridParams gridParams = (GridParams) inputPar; // read from WAR02 table... Response answer = QueryUtil.getQuery( conn, userSessionPars, sql, values, attribute2dbField, MovementVO.class, "Y", "N", context, gridParams, true); // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while fetching warehouse movements list", ex); return new ErrorResponse(ex.getMessage()); } finally { try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Connection conn = null; try { conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); CallOutTaskVO vo = null; ArrayList list = (ArrayList) inputPar; Map attribute2dbField = new HashMap(); attribute2dbField.put("callOutCodeSch10SCH12", "CALL_OUT_CODE_SCH10"); attribute2dbField.put("companyCodeSys01SCH12", "COMPANY_CODE_SYS01"); attribute2dbField.put("taskCodeReg07SCH12", "TASK_CODE_REG07"); Response res = null; for (int i = 0; i < list.size(); i++) { vo = (CallOutTaskVO) list.get(i); // insert into SCH12... res = QueryUtil.insertTable( conn, userSessionPars, vo, "SCH12_CALL_OUT_TASKS", attribute2dbField, "Y", "N", context, true); if (res.isError()) { conn.rollback(); return res; } } Response answer = new VOListResponse(list, false, list.size()); // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); conn.commit(); // fires the GenericEvent.AFTER_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.AFTER_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while inserting new call-out tasks", ex); try { conn.rollback(); } catch (Exception ex3) { } return new ErrorResponse(ex.getMessage()); } finally { try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); PrintWriter out = res.getWriter(); Connection con = null; String bnm[] = req.getParameterValues("Comics"); String qty[] = new String[bnm.length]; ArrayList al1 = new ArrayList(); ArrayList al2 = new ArrayList(); for (int i = 0; i < bnm.length; i++) { qty[i] = req.getParameter(bnm[i]); al1.add(bnm[i]); al2.add(qty[i]); } HttpSession HSession = req.getSession(true); ArrayList alo1 = (ArrayList) HSession.getValue("bNames"); ArrayList alo2 = (ArrayList) HSession.getValue("bQty"); al1.addAll(alo1); al2.addAll(alo2); HSession.putValue("bNames", al1); HSession.putValue("bQty", al2); out.println("<html>"); out.println("<title>Categories..</title>"); out.println("<body bgcolor=gold >"); out.println("<b><font face=\"Papyrus\" size=36 color= #806F7E><center>"); out.println("<big>Category</big></center>"); out.println("<ul type=disc>"); out.println("<font face=\"Maiandra GD\" color=black size=4>"); out.println("<li type=square>Choose your category.."); out.println("</li></font><br>"); out.println( "<A href=\"FictionClick\"><font face=\"Mistral\" size=8 color=#208234><b>Fiction</b></A><br>"); out.println( "<A href=\"NonFictionClick\"><font face=\"Mistral\" size=8 color=#208234><b>Non-Fiction</b></A><br>"); out.println( "<A href=\"AutobiographyClick\"><font face=\"Mistral\" size=8 color=#208234><b>Autobiography</b></A><br>"); out.println( "<A href=\"HistoryClick\"><font face=\"Mistral\" size=8 color=#208234><b>History</b></A><br>"); out.println( "<A href=\"ComicsClick\"><font face=\"Mistral\" size=8 color=#208234><b>Comics</b></A></font><br><br>"); out.println("<center><form action=\"http://localhost:8080/servlet/FinalList\">"); out.println("<input type=submit value=\" Finalize List >>\"></form>"); out.println("<font face=\"Maiandra GD\" color=black size=4>"); out.println("Moves to final List..</center>"); out.println("</font></body>"); out.println("</html>"); } // service
/** * Checks a function for RESTFful annotations. * * @return {@code true} if module contains relevant annotations * @throws QueryException query exception */ boolean analyze() throws QueryException { // parse all annotations final EnumSet<HTTPMethod> mth = EnumSet.noneOf(HTTPMethod.class); final boolean[] declared = new boolean[function.args.length]; boolean found = false; final int as = function.ann.size(); for (int a = 0; a < as; a++) { final QNm name = function.ann.names[a]; final Value value = function.ann.values[a]; final byte[] local = name.local(); final byte[] uri = name.uri(); final boolean rexq = eq(uri, QueryText.RESTXQURI); if (rexq) { if (eq(PATH, local)) { // annotation "path" if (path != null) error(ANN_TWICE, "%", name.string()); path = new RestXqPath(toString(value, name)); for (final String s : path) { if (s.trim().startsWith("{")) checkVariable(s, AtomType.AAT, declared); } } else if (eq(CONSUMES, local)) { // annotation "consumes" strings(value, name, consumes); } else if (eq(PRODUCES, local)) { // annotation "produces" strings(value, name, produces); } else if (eq(QUERY_PARAM, local)) { // annotation "query-param" queryParams.add(param(value, name, declared)); } else if (eq(FORM_PARAM, local)) { // annotation "form-param" formParams.add(param(value, name, declared)); } else if (eq(HEADER_PARAM, local)) { // annotation "header-param" headerParams.add(param(value, name, declared)); } else if (eq(COOKIE_PARAM, local)) { // annotation "cookie-param" cookieParams.add(param(value, name, declared)); } else { // method annotations final HTTPMethod m = HTTPMethod.get(string(local)); if (m == null) error(ANN_UNKNOWN, "%", name.string()); if (!value.isEmpty()) { // remember post/put variable if (requestBody != null) error(ANN_TWICE, "%", name.string()); if (m != POST && m != PUT) error(METHOD_VALUE, m); requestBody = checkVariable(toString(value, name), declared); } if (mth.contains(m)) error(ANN_TWICE, "%", name.string()); mth.add(m); } } else if (eq(uri, QueryText.OUTPUTURI)) { // serialization parameters final String key = string(local); final String val = toString(value, name); if (output.get(key) == null) error(UNKNOWN_SER, key); output.set(key, val); } found |= rexq; } if (!mth.isEmpty()) methods = mth; if (found) { if (path == null) error(ANN_MISSING, PATH); for (int i = 0; i < declared.length; i++) if (!declared[i]) error(VAR_UNDEFINED, function.args[i].name.string()); } return found; }
/** Business logic to execute. */ public VOListResponse loadItemVariants(GridParams pars, String serverLanguageId, String username) throws Throwable { PreparedStatement pstmt = null; Connection conn = null; try { if (this.conn == null) conn = getConn(); else conn = this.conn; String tableName = (String) pars.getOtherGridParams().get(ApplicationConsts.TABLE_NAME); ItemPK pk = (ItemPK) pars.getOtherGridParams().get(ApplicationConsts.ITEM_PK); String productVariant = (String) productVariants.get(tableName); String variantType = (String) variantTypes.get(tableName); String variantTypeJoin = (String) variantTypeJoins.get(tableName); String variantCodeJoin = (String) variantCodeJoins.get(tableName); String sql = "select " + tableName + "." + variantTypeJoin + "," + tableName + ".VARIANT_CODE,A.DESCRIPTION,B.DESCRIPTION, " + tableName + ".PROGRESSIVE_SYS10," + variantType + ".PROGRESSIVE_SYS10 " + "from " + tableName + "," + variantType + ",SYS10_COMPANY_TRANSLATIONS A,SYS10_COMPANY_TRANSLATIONS B " + "where " + tableName + ".COMPANY_CODE_SYS01=? and " + tableName + ".COMPANY_CODE_SYS01=" + variantType + ".COMPANY_CODE_SYS01 and " + tableName + "." + variantTypeJoin + "=" + variantType + ".VARIANT_TYPE and " + tableName + ".COMPANY_CODE_SYS01=A.COMPANY_CODE_SYS01 and " + tableName + ".PROGRESSIVE_SYS10=A.PROGRESSIVE and A.LANGUAGE_CODE=? and " + variantType + ".COMPANY_CODE_SYS01=B.COMPANY_CODE_SYS01 and " + variantType + ".PROGRESSIVE_SYS10=B.PROGRESSIVE and B.LANGUAGE_CODE=? and " + tableName + ".ENABLED='Y' and " + variantType + ".ENABLED='Y' and " + // and not "+tableName+"."+variantTypeJoin+"=? and "+ "not " + tableName + ".VARIANT_CODE=? " + "order by " + tableName + "." + variantTypeJoin + "," + tableName + ".CODE_ORDER"; Map attribute2dbField = new HashMap(); attribute2dbField.put("variantType", tableName + "." + variantTypeJoin); attribute2dbField.put("variantCode", tableName + ".VARIANT_CODE"); attribute2dbField.put("variantDesc", "A.DESCRIPTION"); attribute2dbField.put("variantTypeDesc", "B.DESCRIPTION"); attribute2dbField.put("variantProgressiveSys10", tableName + ".PROGRESSIVE_SYS10"); attribute2dbField.put("variantTypeProgressiveSys10", variantType + ".PROGRESSIVE_SYS10"); ArrayList values = new ArrayList(); values.add(pk.getCompanyCodeSys01ITM01()); values.add(serverLanguageId); values.add(serverLanguageId); // values.add(ApplicationConsts.JOLLY); values.add(ApplicationConsts.JOLLY); // read from ITMxxx table... Response answer = QueryUtil.getQuery( conn, new UserSessionParameters(username), sql, values, attribute2dbField, ItemVariantVO.class, "Y", "N", null, pars, 50, true); if (!answer.isError()) { java.util.List vos = ((VOListResponse) answer).getRows(); HashMap map = new HashMap(); ItemVariantVO vo = null; for (int i = 0; i < vos.size(); i++) { vo = (ItemVariantVO) vos.get(i); vo.setCompanyCodeSys01(pk.getCompanyCodeSys01ITM01()); vo.setItemCodeItm01(pk.getItemCodeITM01()); vo.setTableName(tableName); map.put(vo.getVariantType() + "." + vo.getVariantCode(), vo); } pstmt = conn.prepareStatement( "select " + productVariant + "." + variantTypeJoin + "," + productVariant + "." + variantCodeJoin + " " + "from " + productVariant + " " + "where " + productVariant + ".COMPANY_CODE_SYS01=? and " + productVariant + ".ITEM_CODE_ITM01=? and " + productVariant + ".ENABLED='Y' "); pstmt.setString(1, pk.getCompanyCodeSys01ITM01()); pstmt.setString(2, pk.getItemCodeITM01()); ResultSet rset = pstmt.executeQuery(); while (rset.next()) { vo = (ItemVariantVO) map.get(rset.getString(1) + "." + rset.getString(2)); if (vo != null) vo.setSelected(Boolean.TRUE); } rset.close(); pstmt.close(); } if (answer.isError()) throw new Exception(answer.getErrorMessage()); else return (VOListResponse) answer; } catch (Throwable ex) { Logger.error( username, this.getClass().getName(), "getItemVariants", "Error while fetching item variants list", ex); throw new Exception(ex.getMessage()); } finally { try { pstmt.close(); } catch (Exception ex2) { } try { if (this.conn == null && conn != null) { // close only local connection conn.commit(); conn.close(); } } catch (Exception exx) { } } }
/** * Binds the annotated variables. * * @param http http context * @param arg argument array * @throws QueryException query exception * @throws IOException I/O exception */ void bind(final HTTPContext http, final Expr[] arg) throws QueryException, IOException { // bind variables from segments for (int s = 0; s < path.size; s++) { final Matcher m = TEMPLATE.matcher(path.segment[s]); if (!m.find()) continue; final QNm qnm = new QNm(token(m.group(1)), context); bind(qnm, arg, new Atm(http.segment(s))); } // cache request body final String ct = http.contentType(); IOContent body = null; if (requestBody != null) { body = cache(http, null); try { // bind request body in the correct format body.name(http.method + IO.XMLSUFFIX); bind(requestBody, arg, Parser.item(body, context.context.prop, ct)); } catch (final IOException ex) { error(INPUT_CONV, ex); } } // bind query parameters final Map<String, String[]> params = http.params(); for (final RestXqParam rxp : queryParams) bind(rxp, arg, params.get(rxp.key)); // bind form parameters if (!formParams.isEmpty()) { if (MimeTypes.APP_FORM.equals(ct)) { // convert parameters encoded in a form body = cache(http, body); addParams(body.toString(), params); } for (final RestXqParam rxp : formParams) bind(rxp, arg, params.get(rxp.key)); } // bind header parameters for (final RestXqParam rxp : headerParams) { final StringList sl = new StringList(); final Enumeration<?> en = http.req.getHeaders(rxp.key); while (en.hasMoreElements()) { for (final String s : en.nextElement().toString().split(", *")) sl.add(s); } bind(rxp, arg, sl.toArray()); } // bind cookie parameters final Cookie[] ck = http.req.getCookies(); for (final RestXqParam rxp : cookieParams) { String v = null; if (ck != null) { for (final Cookie c : ck) { if (rxp.key.equals(c.getName())) v = c.getValue(); } } if (v == null) bind(rxp, arg); else bind(rxp, arg, v); } }
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<br><h4>we are getting data</h4>"); String code = request.getParameter("code"); out.println("<br>code: " + code); out.println("<br>"); try { OAuthClientRequest requestOAuth = OAuthClientRequest.tokenLocation("https://graph.facebook.com/oauth/access_token") .setGrantType(GrantType.AUTHORIZATION_CODE) .setClientId(apiKey) .setClientSecret(secretKey) .setRedirectURI(redirectUri) .setCode(code) .buildBodyMessage(); OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient()); GitHubTokenResponse oAuthResponse = oAuthClient.accessToken(requestOAuth, GitHubTokenResponse.class); accessToken = oAuthResponse.getAccessToken(); expiresIn = oAuthResponse.getExpiresIn(); } catch (OAuthSystemException ae) { ae.printStackTrace(); } catch (OAuthProblemException pe) { pe.printStackTrace(); } // out.println("<br>Access Token: " + accessToken); // out.println("<br>Expires In: " + expiresIn); try { FacebookClient facebookClient = new DefaultFacebookClient(accessToken); myFriends = facebookClient.fetchConnection("me/friends", User.class); myFeeds = facebookClient.fetchConnection("me/home", Post.class); for (User myFriend : myFriends.getData()) { f.add(myFriend.getName()); out.println("<br>id: " + myFriend.getId() + " Name: " + myFriend.getName()); } // out.println("<br>"); out.println("<br>f count: " + f.size()); } catch (FacebookException e) { e.printStackTrace(); } facebookDataBean fdb = new facebookDataBean(); fdb.setName("zishan ali khan"); HttpSession session = request.getSession(); if (session != null) { session.setAttribute("myfdb", fdb); session.setAttribute("yourFriends", f); session.setAttribute("feeds", myFeeds); RequestDispatcher view = request.getRequestDispatcher("result.jsp"); view.forward(request, response); f.clear(); // out.println("<br>I am in"); } else { // out.println("<br>Session Over"); } }
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * * @param request servlet request * @param response servlet response * @throws javax.servlet.ServletException if a servlet-specific error occurs * @throws java.io.IOException if an I/O error occurs */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { XDebug xdebug = new XDebug(); xdebug.startTimer(); response.setContentType("application/json"); PrintWriter writer = response.getWriter(); try { List resultsList = new LinkedList(); // Get the gene list String geneList = request.getParameter(QueryBuilder.GENE_LIST); if (request instanceof XssRequestWrapper) { geneList = ((XssRequestWrapper) request).getRawParameter(QueryBuilder.GENE_LIST); } String cancerStudyIdListString = request.getParameter(QueryBuilder.CANCER_STUDY_LIST); String[] cancerStudyIdList = cancerStudyIdListString.split(","); // Get the priority Integer dataTypePriority; try { dataTypePriority = Integer.parseInt(request.getParameter(QueryBuilder.DATA_PRIORITY).trim()); } catch (NumberFormatException e) { dataTypePriority = 0; } // Cancer All Cancer Studies List<CancerStudy> cancerStudiesList = accessControl.getCancerStudies(); HashMap<String, Boolean> studyMap = new HashMap<>(); for (String studyId : cancerStudyIdList) { studyMap.put(studyId, Boolean.TRUE); } for (CancerStudy cancerStudy : cancerStudiesList) { String cancerStudyId = cancerStudy.getCancerStudyStableId(); if (!studyMap.containsKey(cancerStudyId)) { continue; } if (cancerStudyId.equalsIgnoreCase("all")) continue; Map cancerMap = new LinkedHashMap(); cancerMap.put("studyId", cancerStudyId); cancerMap.put("typeOfCancer", cancerStudy.getTypeOfCancerId()); // Get all Genetic Profiles Associated with this Cancer Study ID. ArrayList<GeneticProfile> geneticProfileList = GetGeneticProfiles.getGeneticProfiles(cancerStudyId); // Get all Patient Lists Associated with this Cancer Study ID. ArrayList<SampleList> sampleSetList = GetSampleLists.getSampleLists(cancerStudyId); // Get the default patient set AnnotatedSampleSets annotatedSampleSets = new AnnotatedSampleSets(sampleSetList, dataTypePriority); SampleList defaultSampleSet = annotatedSampleSets.getDefaultSampleList(); if (defaultSampleSet == null) { continue; } List<String> sampleIds = defaultSampleSet.getSampleList(); // Get the default genomic profiles CategorizedGeneticProfileSet categorizedGeneticProfileSet = new CategorizedGeneticProfileSet(geneticProfileList); HashMap<String, GeneticProfile> defaultGeneticProfileSet = null; switch (dataTypePriority) { case 2: defaultGeneticProfileSet = categorizedGeneticProfileSet.getDefaultCopyNumberMap(); break; case 1: defaultGeneticProfileSet = categorizedGeneticProfileSet.getDefaultMutationMap(); break; case 0: default: defaultGeneticProfileSet = categorizedGeneticProfileSet.getDefaultMutationAndCopyNumberMap(); } String mutationProfile = "", cnaProfile = ""; for (GeneticProfile geneticProfile : defaultGeneticProfileSet.values()) { GeneticAlterationType geneticAlterationType = geneticProfile.getGeneticAlterationType(); if (geneticAlterationType.equals(GeneticAlterationType.COPY_NUMBER_ALTERATION)) { cnaProfile = geneticProfile.getStableId(); } else if (geneticAlterationType.equals(GeneticAlterationType.MUTATION_EXTENDED)) { mutationProfile = geneticProfile.getStableId(); } } cancerMap.put("mutationProfile", mutationProfile); cancerMap.put("cnaProfile", cnaProfile); cancerMap.put("caseSetId", defaultSampleSet.getStableId()); cancerMap.put("caseSetLength", sampleIds.size()); ProfileDataSummary genomicData = getGenomicData( cancerStudyId, defaultGeneticProfileSet, defaultSampleSet, geneList, sampleSetList, request, response); ArrayList<GeneWithScore> geneFrequencyList = genomicData.getGeneFrequencyList(); ArrayList<String> genes = new ArrayList<String>(); for (GeneWithScore geneWithScore : geneFrequencyList) genes.add(geneWithScore.getGene()); int noOfMutated = 0, noOfCnaUp = 0, noOfCnaDown = 0, noOfCnaLoss = 0, noOfCnaGain = 0, noOfOther = 0, noOfAll = 0; boolean skipStudy = defaultGeneticProfileSet.isEmpty(); if (!skipStudy) { for (String sampleId : sampleIds) { if (sampleId == null) { continue; } if (!genomicData.isCaseAltered(sampleId)) continue; boolean isAnyMutated = false, isAnyCnaUp = false, isAnyCnaDown = false, isAnyCnaLoss = false, isAnyCnaGain = false; for (String gene : genes) { isAnyMutated |= genomicData.isGeneMutated(gene, sampleId); GeneticTypeLevel cnaLevel = genomicData.getCNALevel(gene, sampleId); boolean isCnaUp = cnaLevel != null && cnaLevel.equals(GeneticTypeLevel.Amplified); isAnyCnaUp |= isCnaUp; boolean isCnaDown = cnaLevel != null && cnaLevel.equals(GeneticTypeLevel.HomozygouslyDeleted); isAnyCnaDown |= isCnaDown; boolean isCnaLoss = cnaLevel != null && cnaLevel.equals(GeneticTypeLevel.HemizygouslyDeleted); isAnyCnaLoss |= isCnaLoss; boolean isCnaGain = cnaLevel != null && cnaLevel.equals(GeneticTypeLevel.Gained); isAnyCnaGain |= isCnaGain; } boolean isAnyCnaChanged = isAnyCnaUp || isAnyCnaDown; if (isAnyMutated && !isAnyCnaChanged) noOfMutated++; else if (isAnyMutated && isAnyCnaChanged) noOfOther++; else if (isAnyCnaUp) noOfCnaUp++; else if (isAnyCnaDown) noOfCnaDown++; else if (isAnyCnaGain) noOfCnaGain++; else if (isAnyCnaLoss) noOfCnaLoss++; noOfAll++; } } Map alterations = new LinkedHashMap(); cancerMap.put("alterations", alterations); alterations.put("all", noOfAll); alterations.put("mutation", noOfMutated); alterations.put("cnaUp", noOfCnaUp); alterations.put("cnaDown", noOfCnaDown); alterations.put("cnaLoss", noOfCnaLoss); alterations.put("cnaGain", noOfCnaGain); alterations.put("other", noOfOther); cancerMap.put("genes", genes); cancerMap.put("skipped", skipStudy); resultsList.add(cancerMap); } JSONValue.writeJSONString(resultsList, writer); } catch (DaoException e) { throw new ServletException(e); } catch (ProtocolException e) { throw new ServletException(e); } finally { writer.close(); } }
/** * ] * * @param aWebForm AddForm * @param request HttpServletRequest * @param response HttpServletResponse * @throws CDealException * @throws Exception */ public static void setEdit1( EditForm aWebForm, HttpServletRequest request, HttpServletResponse response) throws CDealException, Exception { EditForm aWebForm1 = (EditForm) aWebForm; Connection mConn = null; PreparedStatement pstmt = null; String str = ""; // 要返回的 string String sKey = ""; // 取出的TREEMAP的KEY String sValue = ""; // 取出的TREEMAP的value TreeMap itemtype; // 初始化页面,初始化事项类别下拉菜单 // 初始化页面,初始化投诉形式下拉菜单 TreeMap COMPLAINVERSIONListName2 = new TreeMap(); // 取出aWebForm COMPLAINVERSIONListName2 = CCodeMap.getMapByType("行政过错职级"); aWebForm.setCOMPLAINEDGRADELIST(COMPLAINVERSIONListName2); TreeMap COMPLAINVERSIONListName3 = new TreeMap(); // 取出aWebForm COMPLAINVERSIONListName3 = CCodeMap.getMapByType("行政管理分类"); aWebForm.setXZGLFLList(COMPLAINVERSIONListName3); TreeMap COMPLAINVERSIONListName4 = new TreeMap(); // 取出aWebForm COMPLAINVERSIONListName4 = CCodeMap.getMapByType("行政过错表现形式"); aWebForm.setXZGCBXXSList(COMPLAINVERSIONListName4); try { // 从CODEMAP表里取 来源分类 菜单 ArrayList comeList = CCodeMap.getSortedMap("行政过错行为分类"); // 从CODEMAP表里取 本级政府任务督办 菜单 ArrayList localList = CCodeMap.getSortedMap("违反规定履行社会管理职责"); // 从CODEMAP表里取 上级任务督办 菜单 ArrayList upList = CCodeMap.getSortedMap("违反内部管理制度"); // 从CODEMAP表里取 上级任务督办 菜单 ArrayList lbList = CCodeMap.getSortedMap("其他贻误行政管理工作"); // 添加 来源分类 到一个数组里面去.然后统一输出到页面 str = "var XZGCXYFL=new Array('','全部'"; int k = 0; for (; k < comeList.size(); k++) { LabelValueBean aLabelValueBean = (LabelValueBean) comeList.get(k); sKey = aLabelValueBean.getValue(); // 名字 str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY sValue = aLabelValueBean.getLabel(); // 值 str += "'" + sValue + "'\n"; // 取出的TREEMAP的value } // CLog.println(str); str += ");\n"; str += " var permissionitem = new Array (" + k + ");\n"; str += "permissionitem[0]=new Array('','全部');\n"; // 添加 违反规定履行社会管理职责 int j = 1; str += "permissionitem[" + j + "]=new Array('','全部'"; for (int i = 0; i < localList.size(); i++) { LabelValueBean aLabelValueBean = (LabelValueBean) localList.get(i); sKey = aLabelValueBean.getValue(); // 值 // 添加每个部门对应的事项类别列表 str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY sValue = aLabelValueBean.getLabel(); // 名字 str += "'" + sValue + "'\n"; // 取出的TREEMAP的value } str += ");\n"; // 添加 违反内部管理制度 j = 2; str += "permissionitem[" + j + "]=new Array('','全部'"; for (int i = 0; i < upList.size(); i++) { LabelValueBean aLabelValueBean = (LabelValueBean) upList.get(i); sKey = aLabelValueBean.getValue(); // 值 // 添加每个部门对应的事项类别列表 str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY sValue = aLabelValueBean.getLabel(); // 名字 str += "'" + sValue + "'\n"; // 取出的TREEMAP的value } str += ");\n"; // 添加 其他贻误行政管理工作 j = 3; str += "permissionitem[" + j + "]=new Array('','全部'"; for (int i = 0; i < lbList.size(); i++) { LabelValueBean aLabelValueBean = (LabelValueBean) lbList.get(i); sKey = aLabelValueBean.getValue(); // 值 // 添加每个部门对应的事项类别列表 str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY sValue = aLabelValueBean.getLabel(); // 名字 str += "'" + sValue + "'\n"; // 取出的TREEMAP的value } str += ");\n"; // 把部门数组和许可事项输出到页面上 aWebForm1.setPrintSql(str); } catch (Exception e) { throw new CDealException("设置进入时限监察查询处理的初始值时失败。", e); } finally { if (pstmt != null) { try { pstmt.close(); } catch (Exception e) { } ; } if (mConn != null) { try { mConn.close(); } catch (Exception e) { } ; } } }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Connection conn = null; PreparedStatement pstmt = null; try { String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); ArrayList oldVOs = ((ArrayList[]) inputPar)[0]; ArrayList newVOs = ((ArrayList[]) inputPar)[1]; Map attribute2dbField = new HashMap(); attribute2dbField.put("companyCodeSys01DOC20", "COMPANY_CODE_SYS01"); attribute2dbField.put("progressiveDoc14DOC20", "PROGRESSIVE_DOC14"); attribute2dbField.put("progressiveSys10DOC20", "PROGRESSIVE_SYS10"); attribute2dbField.put("textValueDOC20", "TEXT_VALUE"); attribute2dbField.put("numValueDOC20", "NUM_VALUE"); attribute2dbField.put("dateValueDOC20", "DATE_VALUE"); HashSet pkAttributes = new HashSet(); pkAttributes.add("companyCodeSys01DOC20"); pkAttributes.add("progressiveDoc14DOC20"); pkAttributes.add("progressiveSys10DOC20"); Response res = null; DocPropertyVO oldVO = null; DocPropertyVO newVO = null; pstmt = conn.prepareStatement( "select PROGRESSIVE_DOC14 from DOC20_DOC_PROPERTIES where " + "COMPANY_CODE_SYS01=? and PROGRESSIVE_DOC14=? and PROGRESSIVE_SYS10=?"); ResultSet rset = null; for (int i = 0; i < oldVOs.size(); i++) { oldVO = (DocPropertyVO) oldVOs.get(i); newVO = (DocPropertyVO) newVOs.get(i); // check if the record already exists: if it does not exist, then insert it... pstmt.setString(1, newVO.getCompanyCodeSys01DOC20()); pstmt.setBigDecimal(2, newVO.getProgressiveDoc14DOC20()); pstmt.setBigDecimal(3, newVO.getProgressiveSys10DOC20()); rset = pstmt.executeQuery(); if (rset.next()) { // the record exixts: it will be updated... res = QueryUtil.updateTable( conn, userSessionPars, pkAttributes, oldVO, newVO, "DOC20_DOC_PROPERTIES", attribute2dbField, "Y", "N", context, true); if (res.isError()) { conn.rollback(); return res; } } else { // the record does not exixt: it will be inserted... res = QueryUtil.insertTable( conn, userSessionPars, newVO, "DOC20_DOC_PROPERTIES", attribute2dbField, "Y", "N", context, true); if (res.isError()) { conn.rollback(); return res; } } rset.close(); } Response answer = new VOListResponse(newVOs, false, newVOs.size()); // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); conn.commit(); // fires the GenericEvent.AFTER_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.AFTER_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while updating property values for the specified document", ex); try { conn.rollback(); } catch (Exception ex3) { } return new ErrorResponse(ex.getMessage()); } finally { try { pstmt.close(); } catch (Exception ex2) { } try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }
/** * メソッド概要 ・ユーザー名一覧を設定する * * @param ・なし * @return ・なし */ public void fEtexExecuteRecognitionSetAllStaffName() { /* 社員名 */ String stgSelectStaff = null; /* 選択オプション */ String stgSelect = null; /* DB接続ハンドル */ CEtexGeneralDbHandle clsParamDbHandle = null; /* 一覧情報格納リスト */ ArrayList arrayDispData = null; /* 画面表示データBean */ CEtexRecognitionDispBean clsDispBean = null; /* リクエスト情報 */ HttpServletRequest hpRequest = null; /* リクエスト情報取得 */ hpRequest = clsRecognitionCtlBean.getRecognitionRequest(); /* DB接続ハンドル生成 */ clsParamDbHandle = new CEtexGeneralDbHandle(); /* リストデータ生成 */ arrayDispData = new ArrayList(); /* 選択されているユーザ情報取得 */ stgSelectStaff = clsRecognitionCtlBean.getRecognitionSerchStaffCode(); /* 「全員」項目情報設定 */ clsDispBean = new CEtexRecognitionDispBean(); /* 選択オプション情報設定 */ clsDispBean.setRecognitionDispStaffSelect(ETEX_RECOGNITION_SELECT); /* 対象ユーザー社員コード設定 */ clsDispBean.setRecognitionDispStaffCode("000-0000"); /* 対象ユーザー名前設定 */ clsDispBean.setRecognitionDispStaffName("全員"); /* 対象ユーザーよみがな設定 */ clsDispBean.setRecognitionDispStaffKana("ALL"); /* リスト追加 */ arrayDispData.add(clsDispBean); /* DBオープン */ fEtexGeneralDbUtilOpen(clsParamDbHandle); /* DBのExceptionエラー用のtry */ try { /* DB検索 */ fEtexGeneralDbUtilSelect( clsParamDbHandle, fEtexExecuteRecognitionPublishSql(ETEX_RECOGNITION_DB_SELECT_EIMD010_EX, null)); /* 検索結果が存在するかチェック */ while (fEtexGeneralDbUtilSeek(clsParamDbHandle) == true) { /* 画面表示Bean生成 */ clsDispBean = new CEtexRecognitionDispBean(); /* リスト追加 */ /* 対象ユーザと検索結果のユーザー情報が一致するかチェック */ if (stgSelectStaff.equals(fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "md010010v")) == true) { stgSelect = ETEX_RECOGNITION_SELECT; } else { stgSelect = ETEX_GENERAL_STRING_EMPTY; } /* 選択オプション情報設定 */ clsDispBean.setRecognitionDispStaffSelect(stgSelect); /* 対象ユーザー社員コード設定 */ clsDispBean.setRecognitionDispStaffCode( fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "md010010v")); /* 対象ユーザー名前設定 */ clsDispBean.setRecognitionDispStaffName( fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "md010110v")); /* 対象ユーザーよみがな設定 */ clsDispBean.setRecognitionDispStaffKana( fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "md010120v")); /* リスト追加 */ arrayDispData.add(clsDispBean); } } catch (Exception e) { /* DBのExceptionエラーをCatchする為のcatch */ /* 例外情報設定 */ fEtexGeneralExceptionUtilSetRequest(hpRequest, e); /* 例外情報表示 */ System.err.println( "CEtexRecognitionExecute:fEtexExecuteRecognitionSetAllStaffName:" + e.toString()); } /* DBクローズ */ fEtexGeneralDbUtilClose(clsParamDbHandle); /* 設定 */ clsRecognitionCtlBean.setRecognitionArrayDispBean(arrayDispData); }
/** * メソッド概要 ・データ(精算情報表示用)の読み込みコントロール * * @param ・なし * @return ・なし */ public void fEtexExecuteRecognitionReadCtl() { /* DB接続ハンドル */ CEtexGeneralDbHandle clsParamDbHandle = null; /* データ情報 */ CEtexRecognitionDataBean clsDataBean = null; /* データ情報格納リスト */ ArrayList arraData = null; /* 編集バッファ */ String stgbuf = null; /* DB接続ハンドル生成 */ clsParamDbHandle = new CEtexGeneralDbHandle(); /* リストデータ生成 */ arraData = new ArrayList(); /* DBオープン */ fEtexGeneralDbUtilOpen(clsParamDbHandle); /* DBのExceptionエラー用のtry */ try { /* DB検索 */ fEtexGeneralDbUtilSelect( clsParamDbHandle, fEtexExecuteRecognitionPublishSql(ETEX_RECOGNITION_DB_SELECT_EITD100, null)); /* データ読み込み */ for (int intCnt = 0; fEtexGeneralDbUtilSeek(clsParamDbHandle); intCnt++) { clsDataBean = new CEtexRecognitionDataBean(); /* 承認チェックボックス */ clsDataBean.setRecognitionDark_1( fEtexExecuteRecognitionGetDark_1( fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "TD100170C"))); /* 解除チェックボックス */ clsDataBean.setRecognitionDark_2( fEtexExecuteRecognitionGetDark_2( fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "TD100170C"))); /* 社員コード */ clsDataBean.setRecognitionDataStaff( fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "MD010010V")); /* 社員名 */ clsDataBean.setRecognitionDataName( fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "MD010110V")); /* 年/月/日(yyyy/mm/dd) */ stgbuf = fEtexGeneralStringUtilFormatChk( ETEX_RECOGNITION_FORMAT_YYYYMMDD, fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "TD100020V"), ETEX_RECOGNITION_STRING_EMPTY_YYYYMMDD); clsDataBean.setRecognitionDataDate(stgbuf); /* 月/日(mm/dd) */ stgbuf = fEtexGeneralStringUtilFormatChk( ETEX_RECOGNITION_FORMAT_MMDD, fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "TD100020V").substring(5, 10), ETEX_RECOGNITION_STRING_EMPTY_MMDD); clsDataBean.setRecognitionDataMMDD( fEtexGeneralStringUtilReplace( stgbuf, 2, ETEX_RECOGNITION_STRING_SLASH, ETEX_RECOGNITION_STRING_EMPTY_MMDD)); /* 曜日(d) */ stgbuf = fEtexGeneralStringUtilFormatChk( ETEX_RECOGNITION_FORMAT_YYYYMMDD, fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "TD100020V"), ETEX_RECOGNITION_STRING_EMPTY_YYYYMMDD); clsDataBean.setRecognitionDataToday("(" + fEtexGeneralDbUtilGetDayOfWeek(stgbuf) + ")"); /* 曜日(カラー)*/ clsDataBean.setRecognitionDataTodayColor(fEtexGeneralDbUtilGetDayOfWeekColor(stgbuf)); /* index */ clsDataBean.setRecognitionDataIndex( ETEX_GENERAL_STRING_EMPTY + fEtexGeneralDbUtilGetDataInt(clsParamDbHandle, "TD100030I")); /* 精算区分 */ clsDataBean.setRecognitionDataClassify( fEtexExecuteRecognitionGetClassify( fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "TD100170C"))); /* 訪問先 */ clsDataBean.setRecognitionDataVisit( fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "TD100100V")); /* 用件 */ clsDataBean.setRecognitionDataMatter( fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "TD100110V")); /* from */ clsDataBean.setRecognitionDataFrom( fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "TD100120V")); /* きごう*/ clsDataBean.setRecognitionDataArrow( fEtexExecuteRecognitionGetArrow( fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "TD100130C"))); /* to */ clsDataBean.setRecognitionDataTo( fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "TD100140V")); /* 機関 */ clsDataBean.setRecognitionDataFacility( fEtexGeneralDbUtilGetFacility( fEtexGeneralDbUtilGetDataString(clsParamDbHandle, "MD120010C"))); /* 金額*/ clsDataBean.setRecognitionDataMoney( fEexGeneralNumericalUtilCnvStringMoney( fEtexGeneralDbUtilGetDataInt(clsParamDbHandle, "TD100150N"))); /* リスト追加 */ arraData.add(clsDataBean); } } catch (Exception e) { /* DBのExceptionエラーをCatchする為のcatch */ /* 例外情報設定 */ fEtexGeneralExceptionUtilSetRequest(clsRecognitionCtlBean.getRecognitionRequest(), e); /* 例外情報表示 */ System.err.println("CEtexRecognitionExecute:fEtexExecuteRecognitionReadCtl:" + e.toString()); } /* DBクローズ */ fEtexGeneralDbUtilClose(clsParamDbHandle); /* リストデータ格納 */ clsRecognitionCtlBean.setRecognitionArrayDataBean(arraData); /* 次フェーズの設定 */ clsRecognitionCtlBean.setRecognitionPhase(ETEX_RECOGNITION_PHASE_SCREEN_ADJUST); }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); Connection conn = null; try { conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); String sql = "select SCH01_EMPLOYEES.COMPANY_CODE_SYS01,SCH01_EMPLOYEES.PROGRESSIVE_REG04,SCH01_EMPLOYEES.EMPLOYEE_CODE," + "REG07_TASKS.TASK_CODE,REG04_SUBJECTS.NAME_1,REG04_SUBJECTS.NAME_2,SYS10_TRANSLATIONS.DESCRIPTION,SCH01_EMPLOYEES.PHONE_NUMBER,SCH01_EMPLOYEES.OFFICE " + "from SCH01_EMPLOYEES,SYS10_TRANSLATIONS,REG07_TASKS,REG04_SUBJECTS where " + "SCH01_EMPLOYEES.COMPANY_CODE_SYS01=REG07_TASKS.COMPANY_CODE_SYS01 and " + "SCH01_EMPLOYEES.TASK_CODE_REG07=REG07_TASKS.TASK_CODE and " + "REG07_TASKS.PROGRESSIVE_SYS10=SYS10_TRANSLATIONS.PROGRESSIVE and " + "SYS10_TRANSLATIONS.LANGUAGE_CODE=? and " + "SCH01_EMPLOYEES.COMPANY_CODE_SYS01=REG04_SUBJECTS.COMPANY_CODE_SYS01 and " + "SCH01_EMPLOYEES.PROGRESSIVE_REG04=REG04_SUBJECTS.PROGRESSIVE and " + "SCH01_EMPLOYEES.ENABLED='Y'"; GridParams gridParams = (GridParams) inputPar; if (gridParams.getOtherGridParams().get(ApplicationConsts.COMPANY_CODE_SYS01) != null) { sql += " and SCH01_EMPLOYEES.COMPANY_CODE_SYS01='" + gridParams.getOtherGridParams().get(ApplicationConsts.COMPANY_CODE_SYS01) + "'"; } else { // retrieve companies list... ArrayList companiesList = ((JAIOUserSessionParameters) userSessionPars).getCompanyBa().getCompaniesList("SCH01"); String companies = ""; for (int i = 0; i < companiesList.size(); i++) companies += "'" + companiesList.get(i).toString() + "',"; companies = companies.substring(0, companies.length() - 1); sql += " and SCH01_EMPLOYEES.COMPANY_CODE_SYS01 in (" + companies + ")"; } Map attribute2dbField = new HashMap(); attribute2dbField.put("companyCodeSys01SCH01", "SCH01_EMPLOYEES.COMPANY_CODE_SYS01"); attribute2dbField.put("progressiveReg04SCH01", "SCH01_EMPLOYEES.PROGRESSIVE_REG04"); attribute2dbField.put("name_1REG04", "REG04_SUBJECTS.NAME_1"); attribute2dbField.put("name_2REG04", "REG04_SUBJECTS.NAME_2"); attribute2dbField.put("phoneNumberSCH01", "SCH01_EMPLOYEES.PHONE_NUMBER"); attribute2dbField.put("officeSCH01", "SCH01_EMPLOYEES.OFFICE"); attribute2dbField.put("employeeCodeSCH01", "SCH01_EMPLOYEES.EMPLOYEE_CODE"); attribute2dbField.put("descriptionSYS10", "SYS10_TRANSLATIONS.DESCRIPTION"); attribute2dbField.put("taskCodeReg07SCH01", "REG07_TASKS.TASK_CODE"); ArrayList values = new ArrayList(); values.add(serverLanguageId); if (gridParams.getOtherGridParams().get(ApplicationConsts.TASK_CODE_REG07) != null) { sql += " and SCH01_EMPLOYEES.TASK_CODE_REG07='" + gridParams.getOtherGridParams().get(ApplicationConsts.TASK_CODE_REG07) + "'"; } // read from SCH01 table... Response answer = QueryUtil.getQuery( conn, userSessionPars, sql, values, attribute2dbField, GridEmployeeVO.class, "Y", "N", context, gridParams, 50, true); // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while fetching employees list", ex); return new ErrorResponse(ex.getMessage()); } finally { try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }
// getUserSources - private Map<String, String> getUserSourcesAndShares( HttpServletRequest request, HttpServletResponse response) { Map<String, String> userSources = new HashMap<String, String>(); String userIdStr = null; // publishedSources - array of source._ids of published sources ArrayList<String> publishedSources = new ArrayList<String>(); try { JSONObject personObj = new JSONObject(getPerson(request, response)); if (personObj.has("data")) { JSONObject person = new JSONObject(personObj.getString("data")); userIdStr = person.getString("_id"); } // Get the user's shares from social.share where type = source or source_published String tempJson = getSourceShares(request, response); // Covert to JSONObject JSONObject json = new JSONObject(tempJson); JSONObject json_response = json.getJSONObject("response"); if (json_response.getString("success").equalsIgnoreCase("true")) { if (json.has("data")) { // Iterate over share objects and write to our collection JSONArray data = json.getJSONArray("data"); for (int i = 0; i < data.length(); i++) { JSONObject shareObj = data.getJSONObject(i); String tempTitle = shareObj.getString("title"); JSONObject sourceObj = new JSONObject(shareObj.getString("share")); if (sourceObj.has("_id")) publishedSources.add(sourceObj.getString("_id")); if (sourceObj.has("ownerId") && !sourceObj.getString("ownerId").equalsIgnoreCase(userIdStr)) tempTitle += " (+)"; tempTitle += " (*)"; userSources.put(tempTitle, shareObj.getString("_id")); } } } // Get sources that the user owns from ingest.source tempJson = getUserSources(request, response); if (tempJson != null) { json = new JSONObject(tempJson); json_response = json.getJSONObject("response"); if (json_response.getString("success").equalsIgnoreCase("true")) { if (json.has("data")) { // Iterate over source objects and write to our collection JSONArray data = json.getJSONArray("data"); for (int i = 0; i < data.length(); i++) { JSONObject sourceObj = data.getJSONObject(i); // Only add the source to our list if it isn't already in our if (!publishedSources.contains(sourceObj.getString("_id"))) { String tempTitle = sourceObj.getString("title"); if (sourceObj.has("ownerId") && !sourceObj.getString("ownerId").equalsIgnoreCase(userIdStr)) tempTitle += " (+)"; userSources.put(tempTitle, sourceObj.getString("_id")); } } } } } } catch (Exception e) { System.out.println(e.getMessage()); } return userSources; }
/** * Check if components required by specified products are available. * * @param products list of ProdOrderProductVO objects * @params compAltComps collection of <component item code,HashSet of alternative component item * codes>; filled by this method (and given back by reference) * @return VOListResponse of ProdOrderComponentVO objects */ public final Response checkComponentsAvailability( Connection conn, Hashtable compAltComps, ArrayList products, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); try { // retrieve internationalization settings (Resources object)... ServerResourcesFactory factory = (ServerResourcesFactory) context.getAttribute(Controller.RESOURCES_FACTORY); Resources resources = factory.getResources(userSessionPars.getLanguageId()); if (products.size() == 0) { return new VOListResponse(new ArrayList(), false, 0); } // fill in comps hashtable with the collection of required components... ItemPK pk = null; ProdOrderProductVO prodVO = null; ArrayList components = null; MaterialVO compVO = null; Response res = null; ProdOrderComponentVO componentVO = null; Hashtable comps = new Hashtable(); // collection of <component item code,ProdOrderComponentVO object> for (int i = 0; i < products.size(); i++) { // retrieve bill of materials for each product... prodVO = (ProdOrderProductVO) products.get(i); pk = new ItemPK(prodVO.getCompanyCodeSys01DOC23(), prodVO.getItemCodeItm01DOC23()); res = bean.getBillOfMaterials( conn, pk, userSessionPars, request, response, userSession, context); if (res.isError()) { return res; } // extract components only (leaf nodes)... components = getComponents( (DefaultMutableTreeNode) ((TreeModel) ((VOResponse) res).getVo()).getRoot()); for (int j = 0; j < components.size(); j++) { compVO = (MaterialVO) components.get(j); componentVO = (ProdOrderComponentVO) comps.get(compVO.getItemCodeItm01ITM03()); if (componentVO == null) { componentVO = new ProdOrderComponentVO(); comps.put(compVO.getItemCodeItm01ITM03(), componentVO); componentVO.setAvailableQty(new BigDecimal(0)); componentVO.setCompanyCodeSys01DOC24(compVO.getCompanyCodeSys01ITM03()); componentVO.setDescriptionSYS10(compVO.getDescriptionSYS10()); componentVO.setDocNumberDOC24(prodVO.getDocNumberDOC23()); componentVO.setDocYearDOC24(prodVO.getDocYearDOC23()); componentVO.setItemCodeItm01DOC24(compVO.getItemCodeItm01ITM03()); componentVO.setMinSellingQtyUmCodeReg02ITM01(compVO.getMinSellingQtyUmCodeReg02ITM01()); componentVO.setQtyDOC24(new BigDecimal(0)); } componentVO.setQtyDOC24( componentVO.getQtyDOC24().add(compVO.getQtyITM03().multiply(prodVO.getQtyDOC23()))); } } // check components availability in the specified warehouse... Enumeration en = comps.keys(); GridParams gridParams = new GridParams(); gridParams .getOtherGridParams() .put(ApplicationConsts.COMPANY_CODE_SYS01, prodVO.getCompanyCodeSys01DOC23()); gridParams .getOtherGridParams() .put(ApplicationConsts.WAREHOUSE_CODE, prodVO.getWarehouseCodeWar01DOC22()); gridParams.getOtherGridParams().put(ApplicationConsts.LOAD_ALL, Boolean.TRUE); ItemAvailabilityVO availVO = null; BigDecimal availability, altAvailability, delta; String itemCode = null; ArrayList list, availList; AltComponentVO altVO = null; ArrayList alternativeComps = new ArrayList(); ArrayList compsToRemove = new ArrayList(); ProdOrderComponentVO altComponentVO = null; HashSet altCodes = null; // list of alternative component item codes... BigDecimal altQty = null; while (en.hasMoreElements()) { itemCode = en.nextElement().toString(); componentVO = (ProdOrderComponentVO) comps.get(itemCode); gridParams .getOtherGridParams() .put( ApplicationConsts.ITEM_PK, new ItemPK(prodVO.getCompanyCodeSys01DOC23(), itemCode)); res = avail.executeCommand( gridParams, userSessionPars, request, response, userSession, context); if (res.isError()) return res; availList = ((VOListResponse) res).getRows(); componentVO.setAvailabilities(availList); availability = new BigDecimal(0); for (int i = 0; i < availList.size(); i++) { availVO = (ItemAvailabilityVO) availList.get(i); availability = availability.add(availVO.getAvailableQtyWAR03()); } componentVO.setAvailableQty(availability); if (componentVO.getQtyDOC24().doubleValue() > componentVO.getAvailableQty().doubleValue()) { // check if there exist some alternative component... res = altComps.executeCommand( gridParams, userSessionPars, request, response, userSession, context); if (res.isError()) return res; list = ((VOListResponse) res).getRows(); for (int i = 0; i < list.size(); i++) { altVO = (AltComponentVO) list.get(i); gridParams .getOtherGridParams() .put( ApplicationConsts.ITEM_PK, new ItemPK(prodVO.getCompanyCodeSys01DOC23(), altVO.getItemCodeItm01ITM04())); res = avail.executeCommand( gridParams, userSessionPars, request, response, userSession, context); if (res.isError()) return res; availList = ((VOListResponse) res).getRows(); altAvailability = new BigDecimal(0); for (int j = 0; j < availList.size(); j++) { availVO = (ItemAvailabilityVO) availList.get(j); altAvailability = altAvailability.add(availVO.getAvailableQtyWAR03()); } if (altAvailability.doubleValue() > 0) { altComponentVO = new ProdOrderComponentVO(); altComponentVO.setAvailabilities(availList); altComponentVO.setAvailableQty(altAvailability); altComponentVO.setCompanyCodeSys01DOC24(altVO.getCompanyCodeSys01ITM04()); altComponentVO.setDescriptionSYS10(altVO.getDescriptionSYS10()); altComponentVO.setDocNumberDOC24(prodVO.getDocNumberDOC23()); altComponentVO.setDocYearDOC24(prodVO.getDocYearDOC23()); altComponentVO.setItemCodeItm01DOC24(altVO.getItemCodeItm01ITM04()); altComponentVO.setMinSellingQtyUmCodeReg02ITM01( altVO.getMinSellingQtyUmCodeReg02ITM01()); altQty = conv.convertQty( altVO.getMinSellingQtyUmCodeReg02ITM01(), componentVO.getMinSellingQtyUmCodeReg02ITM01(), altAvailability, userSessionPars, request, response, userSession, context); if (componentVO.getQtyDOC24().subtract(availability).doubleValue() > altQty.doubleValue()) { delta = altQty; altComponentVO.setQtyDOC24(altAvailability); } else { delta = componentVO.getQtyDOC24(); altComponentVO.setQtyDOC24( conv.convertQty( componentVO.getMinSellingQtyUmCodeReg02ITM01(), altVO.getMinSellingQtyUmCodeReg02ITM01(), delta, userSessionPars, request, response, userSession, context)); } componentVO.setQtyDOC24(componentVO.getQtyDOC24().subtract(delta)); alternativeComps.add(altComponentVO); altCodes = (HashSet) compAltComps.get(itemCode); if (altCodes == null) { altCodes = new HashSet(); compAltComps.put(itemCode, altCodes); } altCodes.add(altVO.getItemCodeItm01ITM04()); if (componentVO.getQtyDOC24().doubleValue() == 0) { compsToRemove.add(componentVO); break; } if (componentVO.getQtyDOC24().subtract(availability).doubleValue() == 0) break; } } } } list = new ArrayList(comps.values()); list.addAll(alternativeComps); list.removeAll(compsToRemove); return new VOListResponse(list, false, list.size()); } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "checkComponentsAvailability", "Error while retrieving components availability for the specified production order", ex); return new ErrorResponse(ex.getMessage()); } }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); PreparedStatement pstmt = null; Connection conn = null; try { conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); GridParams pars = (GridParams) inputPar; BigDecimal rootProgressiveHIE01 = (BigDecimal) pars.getOtherGridParams().get(ApplicationConsts.ROOT_PROGRESSIVE_HIE01); BigDecimal progressiveHIE01 = (BigDecimal) pars.getOtherGridParams().get(ApplicationConsts.PROGRESSIVE_HIE01); BigDecimal progressiveHIE02 = (BigDecimal) pars.getOtherGridParams().get(ApplicationConsts.PROGRESSIVE_HIE02); Boolean productsOnly = (Boolean) pars.getOtherGridParams().get(ApplicationConsts.PRODUCTS_ONLY); Boolean compsOnly = (Boolean) pars.getOtherGridParams().get(ApplicationConsts.COMPONENTS_ONLY); HierarchyLevelVO vo = (HierarchyLevelVO) pars.getOtherGridParams().get(ApplicationConsts.TREE_FILTER); if (vo != null) { progressiveHIE01 = vo.getProgressiveHIE01(); progressiveHIE02 = vo.getProgressiveHie02HIE01(); } // retrieve companies list... ArrayList companiesList = ((JAIOUserSessionParameters) userSessionPars).getCompanyBa().getCompaniesList("ITM01"); String companies = ""; for (int i = 0; i < companiesList.size(); i++) companies += "'" + companiesList.get(i).toString() + "',"; companies = companies.substring(0, companies.length() - 1); String sql = "select ITM01_ITEMS.COMPANY_CODE_SYS01,ITM01_ITEMS.ITEM_CODE,SYS10_TRANSLATIONS.DESCRIPTION,ITM01_ITEMS.PROGRESSIVE_HIE02,ITM01_ITEMS.MIN_SELLING_QTY_UM_CODE_REG02," + "ITM01_ITEMS.PROGRESSIVE_HIE01,ITM01_ITEMS.SERIAL_NUMBER_REQUIRED,REG02_MEASURE_UNITS.DECIMALS " + " from ITM01_ITEMS,SYS10_TRANSLATIONS,REG02_MEASURE_UNITS where " + "ITM01_ITEMS.PROGRESSIVE_HIE02=? and " + "ITM01_ITEMS.PROGRESSIVE_SYS10=SYS10_TRANSLATIONS.PROGRESSIVE and " + "SYS10_TRANSLATIONS.LANGUAGE_CODE=? and " + "ITM01_ITEMS.COMPANY_CODE_SYS01 in (" + companies + ") and " + "ITM01_ITEMS.ENABLED='Y' and " + "ITM01_ITEMS.MIN_SELLING_QTY_UM_CODE_REG02=REG02_MEASURE_UNITS.UM_CODE "; if (productsOnly != null && productsOnly.booleanValue()) sql += " and ITM01_ITEMS.MANUFACTURE_CODE_PRO01 is not null "; if (compsOnly != null && compsOnly.booleanValue()) sql += " and ITM01_ITEMS.MANUFACTURE_CODE_PRO01 is null "; if (rootProgressiveHIE01 == null || !rootProgressiveHIE01.equals(progressiveHIE01)) { // retrieve all subnodes of the specified node... pstmt = conn.prepareStatement( "select HIE01_LEVELS.PROGRESSIVE,HIE01_LEVELS.PROGRESSIVE_HIE01,HIE01_LEVELS.LEV from HIE01_LEVELS " + "where ENABLED='Y' and PROGRESSIVE_HIE02=? and PROGRESSIVE>=? " + "order by LEV,PROGRESSIVE_HIE01,PROGRESSIVE"); pstmt.setBigDecimal(1, progressiveHIE02); pstmt.setBigDecimal(2, progressiveHIE01); ResultSet rset = pstmt.executeQuery(); HashSet currentLevelNodes = new HashSet(); HashSet newLevelNodes = new HashSet(); String nodes = ""; int currentLevel = -1; while (rset.next()) { if (currentLevel != rset.getInt(3)) { // next level... currentLevel = rset.getInt(3); currentLevelNodes = newLevelNodes; newLevelNodes = new HashSet(); } if (rset.getBigDecimal(1).equals(progressiveHIE01)) { newLevelNodes.add(rset.getBigDecimal(1)); nodes += rset.getBigDecimal(1) + ","; } else if (currentLevelNodes.contains(rset.getBigDecimal(2))) { newLevelNodes.add(rset.getBigDecimal(1)); nodes += rset.getBigDecimal(1) + ","; } } rset.close(); pstmt.close(); if (nodes.length() > 0) nodes = nodes.substring(0, nodes.length() - 1); sql += " and PROGRESSIVE_HIE01 in (" + nodes + ")"; } Map attribute2dbField = new HashMap(); attribute2dbField.put("companyCodeSys01ITM01", "ITM01_ITEMS.COMPANY_CODE_SYS01"); attribute2dbField.put("itemCodeITM01", "ITM01_ITEMS.ITEM_CODE"); attribute2dbField.put("descriptionSYS10", "SYS10_TRANSLATIONS.DESCRIPTION"); attribute2dbField.put("progressiveHie02ITM01", "ITM01_ITEMS.PROGRESSIVE_HIE02"); attribute2dbField.put( "minSellingQtyUmCodeReg02ITM01", "ITM01_ITEMS.MIN_SELLING_QTY_UM_CODE_REG02"); attribute2dbField.put("progressiveHie01ITM01", "ITM01_ITEMS.PROGRESSIVE_HIE01"); attribute2dbField.put("serialNumberRequiredITM01", "ITM01_ITEMS.SERIAL_NUMBER_REQUIRED"); attribute2dbField.put("decimalsREG02", "REG02_MEASURE_UNITS.DECIMALS"); ArrayList values = new ArrayList(); values.add(progressiveHIE02); values.add(serverLanguageId); // read from ITM01 table... Response answer = QueryUtil.getQuery( conn, userSessionPars, sql, values, attribute2dbField, GridItemVO.class, "Y", "N", context, pars, 50, true); // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while fetching items list", ex); return new ErrorResponse(ex.getMessage()); } finally { try { pstmt.close(); } catch (Exception ex2) { } try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }
// ---------------------------------------------------------------------------- public void add(Branch NewBr) { ListRows.add(NewBr); }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); Connection conn = null; PreparedStatement pstmt = null; try { conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); // retrieve companies list... GridParams gridParams = (GridParams) inputPar; String companies = (String) gridParams .getOtherGridParams() .get(ApplicationConsts.COMPANY_CODE_SYS01); // used in lookup grid... if (companies == null) { ArrayList companiesList = ((JAIOUserSessionParameters) userSessionPars).getCompanyBa().getCompaniesList("SAL06"); companies = ""; for (int i = 0; i < companiesList.size(); i++) companies += "'" + companiesList.get(i).toString() + "',"; companies = companies.substring(0, companies.length() - 1); } else companies = "'" + companies + "'"; String sql = "select SAL06_CHARGES.COMPANY_CODE_SYS01,SAL06_CHARGES.CHARGE_CODE,SAL06_CHARGES.PROGRESSIVE_SYS10," + "SYS10_TRANSLATIONS.DESCRIPTION,SAL06_CHARGES.VALUE,SAL06_CHARGES.PERC,SAL06_CHARGES.VAT_CODE_REG01," + "SAL06_CHARGES.CURRENCY_CODE_REG03,SAL06_CHARGES.ENABLED" + " from SAL06_CHARGES,SYS10_TRANSLATIONS where " + "SAL06_CHARGES.PROGRESSIVE_SYS10=SYS10_TRANSLATIONS.PROGRESSIVE and " + "SYS10_TRANSLATIONS.LANGUAGE_CODE=? and " + "SAL06_CHARGES.ENABLED='Y' and " + "SAL06_CHARGES.COMPANY_CODE_SYS01 in (" + companies + ")"; Map attribute2dbField = new HashMap(); attribute2dbField.put("companyCodeSys01SAL06", "SAL06_CHARGES.COMPANY_CODE_SYS01"); attribute2dbField.put("chargeCodeSAL06", "SAL06_CHARGES.CHARGE_CODE"); attribute2dbField.put("descriptionSYS10", "SYS10_TRANSLATIONS.DESCRIPTION"); attribute2dbField.put("progressiveSys10SAL06", "SAL06_CHARGES.PROGRESSIVE_SYS10"); attribute2dbField.put("valueSAL06", "SAL06_CHARGES.VALUE"); attribute2dbField.put("percSAL06", "SAL06_CHARGES.PERC"); attribute2dbField.put("vatCodeReg01SAL06", "SAL06_CHARGES.VAT_CODE_REG01"); attribute2dbField.put("currencyCodeReg03SAL06", "SAL06_CHARGES.CURRENCY_CODE_REG03"); attribute2dbField.put("enabledSAL06", "SAL06_CHARGES.ENABLED"); ArrayList values = new ArrayList(); values.add(serverLanguageId); // read from SAL06 table... Response res = CustomizeQueryUtil.getQuery( conn, userSessionPars, sql, values, attribute2dbField, ChargeVO.class, "Y", "N", context, gridParams, 50, true, new BigDecimal(292) // window identifier... ); if (res.isError()) return res; ArrayList list = ((VOListResponse) res).getRows(); ChargeVO vo = null; sql = "select SYS10_TRANSLATIONS.DESCRIPTION,REG01_VATS.VALUE,REG01_VATS.DEDUCTIBLE " + "from SYS10_TRANSLATIONS,REG01_VATS where " + "REG01_VATS.PROGRESSIVE_SYS10=SYS10_TRANSLATIONS.PROGRESSIVE and " + "SYS10_TRANSLATIONS.LANGUAGE_CODE=? and " + "REG01_VATS.VAT_CODE=?"; pstmt = conn.prepareStatement(sql); ResultSet rset = null; for (int i = 0; i < list.size(); i++) { vo = (ChargeVO) list.get(i); if (vo.getVatCodeReg01SAL06() != null) { // retrieve vat data from REG01... pstmt.setString(1, serverLanguageId); pstmt.setString(2, vo.getVatCodeReg01SAL06()); rset = pstmt.executeQuery(); if (rset.next()) { vo.setVatDescriptionSYS10(rset.getString(1)); vo.setVatValueREG01(rset.getBigDecimal(2)); vo.setVatDeductibleREG01(rset.getBigDecimal(3)); } rset.close(); } } Response answer = res; // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while fetching charges list", ex); return new ErrorResponse(ex.getMessage()); } finally { try { pstmt.close(); } catch (Exception ex2) { } try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); Connection conn = null; PreparedStatement pstmt = null; try { conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); ArrayList oldVOs = ((ArrayList[]) inputPar)[0]; ArrayList newVOs = ((ArrayList[]) inputPar)[1]; RoleFunctionCompanyVO oldVO = null; RoleFunctionCompanyVO newVO = null; Response res = null; for (int i = 0; i < oldVOs.size(); i++) { oldVO = (RoleFunctionCompanyVO) oldVOs.get(i); newVO = (RoleFunctionCompanyVO) newVOs.get(i); if (!oldVO.getCanView().booleanValue()) { // no record in SYS02 yet... if (newVO.getCanView().booleanValue()) { pstmt = conn.prepareStatement( "insert into SYS02_COMPANIES_ACCESS(PROGRESSIVE_SYS04,FUNCTION_CODE_SYS06,CAN_INS,CAN_UPD,CAN_DEL,COMPANY_CODE_SYS01) " + "values(?,?,?,?,?,?)"); pstmt.setBigDecimal(1, newVO.getProgressiveSys04SYS02()); pstmt.setString(2, newVO.getFunctionCodeSys06SYS02()); pstmt.setString(3, newVO.getCanInsSYS02().booleanValue() ? "Y" : "N"); pstmt.setString(4, newVO.getCanUpdSYS02().booleanValue() ? "Y" : "N"); pstmt.setString(5, newVO.getCanDelSYS02().booleanValue() ? "Y" : "N"); pstmt.setString(6, newVO.getCompanyCodeSys01SYS02()); pstmt.execute(); } } else { // record already exists in SYS02... if (newVO.getCanView().booleanValue()) { // record in SYS02 will be updated... pstmt = conn.prepareStatement( "update SYS02_COMPANIES_ACCESS set CAN_INS=?,CAN_UPD=?,CAN_DEL=? where " + "PROGRESSIVE_SYS04=? and FUNCTION_CODE_SYS06=? and COMPANY_CODE_SYS01=? "); pstmt.setString(1, newVO.getCanInsSYS02().booleanValue() ? "Y" : "N"); pstmt.setString(2, newVO.getCanUpdSYS02().booleanValue() ? "Y" : "N"); pstmt.setString(3, newVO.getCanDelSYS02().booleanValue() ? "Y" : "N"); pstmt.setBigDecimal(4, newVO.getProgressiveSys04SYS02()); pstmt.setString(5, newVO.getFunctionCodeSys06SYS02()); pstmt.setString(6, newVO.getCompanyCodeSys01SYS02()); pstmt.execute(); } else { // delete record from SYS02... pstmt = conn.prepareStatement( "delete from SYS02_COMPANIES_ACCESS where PROGRESSIVE_SYS04=? and FUNCTION_CODE_SYS06=? and COMPANY_CODE_SYS01=?"); pstmt.setBigDecimal(1, newVO.getProgressiveSys04SYS02()); pstmt.setString(2, newVO.getFunctionCodeSys06SYS02()); pstmt.setString(3, newVO.getCompanyCodeSys01SYS02()); pstmt.execute(); } } } Response answer = new VOListResponse(newVOs, false, newVOs.size()); // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); conn.commit(); // fires the GenericEvent.AFTER_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.AFTER_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while updating company-role-function settings", ex); try { pstmt.close(); } catch (Exception ex2) { } try { conn.rollback(); } catch (Exception ex3) { } return new ErrorResponse(ex.getMessage()); } finally { try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); String username = ((JAIOUserSessionParameters) userSessionPars).getUsername(); Connection conn = null; Statement stmt = null; try { conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery( "select SYS04_ROLES.PROGRESSIVE,SYS04_ROLES.PROGRESSIVE_SYS10,SYS10_TRANSLATIONS.DESCRIPTION from " + "SYS14_USER_ROLES,SYS04_ROLES,SYS10_TRANSLATIONS where " + "SYS14_USER_ROLES.PROGRESSIVE_SYS04=SYS04_ROLES.PROGRESSIVE and " + "SYS04_ROLES.PROGRESSIVE_SYS10=SYS10_TRANSLATIONS.PROGRESSIVE and " + "SYS10_TRANSLATIONS.LANGUAGE_CODE='" + serverLanguageId + "' and " + "SYS14_USER_ROLES.USERNAME_SYS03='" + username + "' and " + "SYS04_ROLES.ENABLED='Y'"); RoleVO vo = null; ArrayList list = new ArrayList(); while (rset.next()) { vo = new RoleVO(); vo.setDescriptionSYS10(rset.getString(3)); vo.setEnabledSYS04("Y"); vo.setProgressiveSYS04(rset.getBigDecimal(1)); vo.setProgressiveSys10SYS04(rset.getBigDecimal(2)); list.add(vo); } rset.close(); Response answer = new VOListResponse(list, false, list.size()); // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while fetching user roles list", ex); return new ErrorResponse(ex.getMessage()); } finally { try { stmt.close(); } catch (Exception ex2) { } try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }