List of usage examples for java.util Enumeration toString
public String toString()
From source file:net.cit.tetrad.resource.MainResource.java
/** * ?? /* w w w. ja v a2s . c om*/ * @param dto * @return * @throws Exception */ @SuppressWarnings("rawtypes") @RequestMapping("/mainList.do") public void mainList(HttpServletRequest request, HttpServletResponse response, CommonDto dto) throws Exception { log.debug("start - mainList()"); //iDisplayStart iDisplayLength datatable? ?? int pageNumber = Integer.parseInt(Utility.isNullNumber(request.getParameter("iDisplayStart"))); int nPerPage = Integer.parseInt(Utility.isNullNumber(request.getParameter("iDisplayLength"))); log.debug("pageNumber=" + pageNumber + ", nPerPage=" + nPerPage); Enumeration parameter = request.getParameterNames(); log.debug(parameter.toString()); while (parameter.hasMoreElements()) { String pName = (String) parameter.nextElement(); String pValue = request.getParameter(pName); log.debug(pName + " = " + pValue); } try { int sEcho = Integer.parseInt(Utility.isNullNumber(request.getParameter(REQ_SECHO))); PersonJson result = setPersonJson(sEcho, dto, pageNumber, nPerPage); JSONObject jsonObject = JSONObject.fromObject(result); Writer writer = setResponse(response).getWriter(); writer.write(jsonObject.toString()); log.debug(jsonObject.toString()); writer.flush(); } catch (Exception e) { log.error(e, e); } log.debug("end - mainList()"); }
From source file:net.cit.tetrad.resource.SubResource.java
@RequestMapping("/subAlarmList.do") public void subAlarmList(HttpServletRequest request, HttpServletResponse response, CommonDto dto) throws Exception { log.debug("start - subAlarmList()"); //iDisplayStart iDisplayLength datatable? ?? int pageNumber = Integer.parseInt(Utility.isNullNumber(request.getParameter("iDisplayStart"))); int nPerPage = Integer.parseInt(Utility.isNullNumber(request.getParameter("iDisplayLength"))); int sEcho = Integer.parseInt(Utility.isNullNumber(request.getParameter(REQ_SECHO))); log.debug("pageNumber=" + pageNumber + ", nPerPage=" + nPerPage); Enumeration parameter = request.getParameterNames(); log.debug(parameter.toString()); while (parameter.hasMoreElements()) { String pName = (String) parameter.nextElement(); String pValue = request.getParameter(pName); log.debug(pName + " = " + pValue); }/*from ww w .j av a2 s . c o m*/ try { Class<?> classname = Alarm.class; Query query = new Query(); query = setAlarmSearch(dto);// ? ? + int cnt = (int) monadService.getCount(query, classname); List<Object> resultList = monadService.getList(query.skip(pageNumber).limit(nPerPage), classname); PersonJson result = setPersonJson(cnt, sEcho, pageNumber, nPerPage, resultList); JSONObject jsonObject = JSONObject.fromObject(result); Writer writer = setResponse(response).getWriter(); writer.write(jsonObject.toString()); log.debug(jsonObject.toString()); writer.flush(); } catch (Exception e) { log.error(e, e); } log.debug("end - subAlarmList()"); }
From source file:net.cit.tetrad.resource.SubResource.java
/** * ? ?? json /* w w w . j a v a 2s .c o m*/ * @param dto * @return * @throws Exception */ @SuppressWarnings({ "unchecked", "rawtypes" }) @RequestMapping("/subGraphList.do") public void subGraphList(HttpServletRequest request, HttpServletResponse response, CommonDto dto) throws Exception { log.debug("start - subGraphList()"); //iDisplayStart iDisplayLength datatable? ?? int pageNumber = Integer.parseInt(Utility.isNullNumber(request.getParameter("iDisplayStart"))); int nPerPage = Integer.parseInt(Utility.isNullNumber(request.getParameter("iDisplayLength"))); log.debug("pageNumber=" + pageNumber + ", nPerPage=" + nPerPage); Enumeration parameter = request.getParameterNames(); log.debug(parameter.toString()); while (parameter.hasMoreElements()) { String pName = (String) parameter.nextElement(); String pValue = request.getParameter(pName); log.debug(pName + " = " + pValue); } GraphDefInfo gdInfo = subDao.getGraphDefInfoForSubGraph(dto); GraphDto graphDto = getSubGraphList(gdInfo, dto); List<Object> statusList = (List<Object>) graphDto.getStatusListObj(); int cnt = statusList.size(); Class<?> classname; if (dto.getDsname().equals("db")) { classname = DbStatus.class; } else { classname = ServerStatus.class; } try { int sEcho = Integer.parseInt(Utility.isNullNumber(request.getParameter(REQ_SECHO))); PersonJson result = setPersonJson(cnt, sEcho, pageNumber, nPerPage, statusList); JSONObject jsonObject = JSONObject.fromObject(result); Writer writer = setResponse(response).getWriter(); writer.write(jsonObject.toString()); log.debug(jsonObject.toString()); writer.flush(); } catch (Exception e) { log.error(e, e); } log.debug("end - subGraphList()"); }
From source file:net.cit.tetrad.resource.SubResource.java
@SuppressWarnings("unchecked") @RequestMapping("/shardChunkLstCommand.do") public void shardChunkLstCommand(HttpServletRequest request, HttpServletResponse response) throws Exception { int deviceCode = Integer.parseInt(Utility.isNullNumber(request.getParameter("deviceCode"))); String dbNameParam = request.getParameter("dbNameParam"); int pageNumber = Integer.parseInt(Utility.isNullNumber(request.getParameter("iDisplayStart"))); int nPerPage = Integer.parseInt(Utility.isNullNumber(request.getParameter("iDisplayLength"))); log.debug("pageNumber=" + pageNumber + ", nPerPage=" + nPerPage); Enumeration parameter = request.getParameterNames(); log.debug(parameter.toString()); while (parameter.hasMoreElements()) { String pName = (String) parameter.nextElement(); String pValue = request.getParameter(pName); log.debug(pName + " = " + pValue); }/*from w w w. j a v a2s . c o m*/ int sEcho = Integer.parseInt(Utility.isNullNumber(request.getParameter(REQ_SECHO))); List<Object> resultLst = new ArrayList<Object>(); //?? pageNumber 0? chunkResultLst . if (pageNumber == 0) { List<Object> findMongoCollections = cllectionCommand(deviceCode, "collections"); JSONObject js = new JSONObject(); for (Object collObj : findMongoCollections) { String coll = (String) ((Map<String, Object>) collObj).get("_id"); String[] collSplit = coll.split("\\."); if (dbNameParam.equals(collSplit[0])) { List<Object> lst = comandService.chunksGrpCommand(deviceCode, coll, new ArrayList<Object>()); js = new JSONObject(); List<Object> chunkInfoGroup = new ArrayList<Object>(); double totalChunkCnt = 0; String collName = null; double nChuncks = 0; for (Object lstObj : lst) { DBObject dbo = (DBObject) lstObj; collName = (String) dbo.get("collName"); nChuncks = (Double) dbo.get("nChunks"); totalChunkCnt += nChuncks; chunkInfoGroup.add(dbo); } js.put("collName", collName); js.put("totalChunkCnt", totalChunkCnt); js.put("chunkInfoGroup", chunkInfoGroup); resultLst.add(js); } } chunkResultLst = resultLst; } int chunkResultLstSize = chunkResultLst.size(); //chunkResultLst? ? pageNumber nPerPage? ? ?? ? ? . int count = pageNumber + nPerPage; resultLst = new ArrayList<Object>(); for (int i = pageNumber; i < count; i++) { if (chunkResultLstSize <= i) break; resultLst.add(chunkResultLst.get(i)); } PersonJson result = new PersonJson(); result.setAaData(resultLst); result.setsEcho(sEcho); result.setiTotalRecords(chunkResultLstSize); result.setiTotalDisplayRecords(chunkResultLstSize); JSONObject jsonObject = JSONObject.fromObject(result); Writer writer = setResponse(response).getWriter(); writer.write(jsonObject.toString()); writer.flush(); log.debug("end - shardChunkLstCommand()"); }
From source file:net.cit.tetrad.resource.ManagementResource.java
/** * ?? // w w w. j av a 2 s. c o m * @param dto * @return * @throws Exception */ @SuppressWarnings("rawtypes") @RequestMapping("/list.do") public void list(HttpServletRequest request, HttpServletResponse response, CommonDto dto) throws Exception { log.debug("start - list()"); int dival = Integer.parseInt(request.getParameter(REQ_DIVAL)); dto.setDival(dival); String tablenm = TABLENAME[dival]; dto.setLoginUserCode(Integer.parseInt(Utility.isNullNumber(request.getParameter("loginUserCode")))); dto.setLoginAuth(Integer.parseInt(Utility.isNullNumber(request.getParameter("loginAuth")))); //iDisplayStart iDisplayLength datatable? ?? int pageNumber = Integer.parseInt(Utility.isNullNumber(request.getParameter("iDisplayStart"))); int nPerPage = Integer.parseInt(Utility.isNullNumber(request.getParameter("iDisplayLength"))); log.debug("pageNumber=" + pageNumber + ", nPerPage=" + nPerPage); Enumeration parameter = request.getParameterNames(); log.debug(parameter.toString()); while (parameter.hasMoreElements()) { String pName = (String) parameter.nextElement(); String pValue = request.getParameter(pName); log.debug(pName + " = " + pValue); } int sEcho = Integer.parseInt(Utility.isNullNumber(request.getParameter(REQ_SECHO))); PersonJson result = setPersonGroupJson(sEcho, dto, tablenm, pageNumber, nPerPage); JSONObject jsonObject = JSONObject.fromObject(result); Writer writer = setResponse(response).getWriter(); writer.write(jsonObject.toString()); log.debug(jsonObject.toString()); writer.flush(); log.debug("end - list()"); }
From source file:com.netscape.cmscore.usrgrp.UGSubsystem.java
/** * Searchs for identities that matches the filter. * retrieves uid only, for efficiency of user listing *//* ww w .j a v a2 s . co m*/ public Enumeration<IUser> listUsers(String filter) throws EUsrGrpException { if (filter == null) { return null; } LDAPConnection ldapconn = null; try { String attrs[] = new String[2]; attrs[0] = "uid"; attrs[1] = "cn"; ldapconn = getConn(); LDAPSearchConstraints cons = new LDAPSearchConstraints(); cons.setMaxResults(0); LDAPSearchResults res = ldapconn.search(getUserBaseDN(), LDAPv2.SCOPE_SUB, "(uid=" + filter + ")", attrs, false, cons); Enumeration<IUser> e = lbuildUsers(res); return e; } catch (LDAPException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_LIST_USERS", e.toString())); } catch (Exception e) { throw new EUsrGrpException(CMS.getUserMessage("CMS_INTERNAL_ERROR")); } finally { if (ldapconn != null) returnConn(ldapconn); } return null; }
From source file:com.netscape.cmscore.usrgrp.UGSubsystem.java
/** * Searchs for identities that matches the filter. *///from w w w. j a v a 2 s .c o m public Enumeration<IUser> findUsers(String filter) throws EUsrGrpException { String ldapFilter; if (StringUtils.isEmpty(filter)) { ldapFilter = "(uid=*)"; } else { filter = LDAPUtil.escapeFilter(filter); ldapFilter = "(|(uid=*" + filter + "*)(cn=*" + filter + "*)(mail=*" + filter + "*))"; } LDAPConnection ldapconn = null; try { ldapconn = getConn(); // use one-level search to search users in flat tree LDAPSearchResults res = ldapconn.search(getUserBaseDN(), LDAPv2.SCOPE_ONE, ldapFilter, null, false); // throw EUsrGrpException if result is empty Enumeration<IUser> e = buildUsers(res); return e; } catch (LDAPException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_FIND_USERS", e.toString())); } catch (ELdapException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_FIND_USERS", e.toString())); } finally { if (ldapconn != null) returnConn(ldapconn); } return null; }
From source file:com.netscape.cmscore.usrgrp.UGSubsystem.java
/** * Locates a user by certificate./*w ww . j av a 2s .c o m*/ */ public User findUser(X509Certificate cert) throws EUsrGrpException { if (cert == null) { return null; } LDAPConnection ldapconn = null; try { ldapconn = getConn(); String filter = LDAP_ATTR_USER_CERT_STRING + "=" + LDAPUtil.escapeFilter(getCertificateString(cert)); LDAPSearchResults res = ldapconn.search(getUserBaseDN(), LDAPConnection.SCOPE_SUB, filter, null, false); Enumeration<IUser> e = buildUsers(res); return (User) e.nextElement(); } catch (LDAPException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_FIND_USER", e.toString())); } catch (ELdapException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_INTERNAL_DB", e.toString())); } finally { if (ldapconn != null) returnConn(ldapconn); } return null; }
From source file:com.netscape.cmscore.usrgrp.UGSubsystem.java
/** * Searchs for identities that matches the certificate locater * generated filter./* w w w. jav a2s.co m*/ */ public IUser findUsersByCert(String filter) throws EUsrGrpException { if (filter == null) { return null; } // To handle \ in the issuer DN or subject DN // (see also RFC 2254, and bug #348303 int hasSlash = filter.indexOf('\\'); if (hasSlash != -1) { String up = filter; StringBuffer stripped = new StringBuffer(); hasSlash = up.indexOf('\\'); while (hasSlash != -1) { stripped.append(up.substring(0, hasSlash) + "\\5c"); up = up.substring(hasSlash + 1); hasSlash = up.indexOf('\\'); } filter = stripped.toString() + up; } LDAPConnection ldapconn = null; try { ldapconn = getConn(); LDAPSearchResults res = ldapconn.search(getUserBaseDN(), LDAPv2.SCOPE_SUB, "(" + filter + ")", null, false); Enumeration<IUser> e = buildUsers(res); return e.nextElement(); } catch (LDAPException e) { CMS.debug(e); log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_FIND_USER_BY_CERT", e.toString())); } catch (ELdapException e) { CMS.debug(e); log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_FIND_USER_BY_CERT", e.toString())); } finally { if (ldapconn != null) returnConn(ldapconn); } return null; }
From source file:com.netscape.cmscore.usrgrp.UGSubsystem.java
/** * Retrieves a group from LDAP/*from w ww .j a va2s . c o m*/ * NOTE - LH This takes a full LDAP DN. */ public IGroup getGroup(String groupDN) { if (groupDN == null) { return null; } LDAPConnection ldapconn = null; try { ldapconn = getConn(); // read the group object LDAPSearchResults res = ldapconn.search(groupDN, LDAPConnection.SCOPE_BASE, "(objectclass=*)", null, false); Enumeration<IGroup> e = buildGroups(res); if (e == null || e.hasMoreElements() == false) return null; return e.nextElement(); } catch (Exception e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_GET_GROUP", e.toString())); } finally { if (ldapconn != null) returnConn(ldapconn); } return null; }