List of usage examples for java.util List toString
public String toString()
From source file:com.shampan.model.UserModel.java
public List<JSONObject> getRecentUser() { int offset = 0; int limit = 10; MongoCollection<UserDAO> mongoCollection = DBConnection.getInstance().getConnection() .getCollection(Collections.USERS.toString(), UserDAO.class); Document projectionDocument = new Document(); projectionDocument.put("firstName", "$all"); projectionDocument.put("lastName", "$all"); projectionDocument.put("userId", "$all"); projectionDocument.put("gender", "$all"); projectionDocument.put("country", "$all"); List<JSONObject> requestList = new ArrayList<JSONObject>(); List<UserDAO> userInfoList = new ArrayList<>(); MongoCursor<UserDAO> userList = mongoCollection.find().sort(new Document("modifiedOn", -1)).skip(offset) .limit(limit).projection(projectionDocument).iterator(); List<String> userIds = new ArrayList<>(); while (userList.hasNext()) { UserDAO user = userList.next();/* w w w . j a va2 s. c o m*/ userIds.add(user.getUserId()); userInfoList.add(user); } List<BasicProfileDAO> userBasicInfoList = basicProfileModel.getRecentUserInfo(userIds.toString()); if (userBasicInfoList != null) { int userSize = userBasicInfoList.size(); int userListSize = userInfoList.size(); for (int j = 0; j < userSize; j++) { for (int i = 0; i < userListSize; i++) { if (userInfoList.get(i).getUserId().equals(userBasicInfoList.get(j).getUserId())) { // BirthDate birthDay = userBasicInfoList.get(j).getBasicInfo().getBirthDate(); JSONObject userJson = new JSONObject(); // int age = getAge(birthDay); // userJson.put("age", age); userJson.put("userId", userInfoList.get(i).getUserId()); userJson.put("firstName", userInfoList.get(i).getFirstName()); userJson.put("lastName", userInfoList.get(i).getLastName()); userJson.put("gender", userInfoList.get(i).getGender()); userJson.put("country", userInfoList.get(i).getCountry()); if (userBasicInfoList.get(j).getBasicInfo().getCity() != null) { userJson.put("city", userBasicInfoList.get(j).getBasicInfo().getCity().getCityName()); } if (userBasicInfoList.get(j).getpSkills() != null) { int pSkillSize = userBasicInfoList.get(j).getpSkills().size(); userJson.put("pSkill", userBasicInfoList.get(j).getpSkills().get(pSkillSize - 1).getpSkill()); } requestList.add(userJson); } } } } return requestList; }
From source file:fragment.web.AbstractConnectorControllerTest.java
@Test public void testShowCloudServicesAsRoot() throws Exception { try {//from ww w. ja v a 2 s. co m map = new ModelMap(); Tenant tenant = tenantDAO.find(2L); asRoot(); setValidServiceAndServiceInstance(); request.setAttribute("isSurrogatedTenant", true); String viewService = controller.showCloudServices(tenant.getUuid(), null, null, map, request); Map<String, Boolean> provisioningmap = ((Map<String, Boolean>) map .get("serviceInstanceProvisioningMap")); Assert.assertEquals(1, provisioningmap.size()); String uuid = (String) provisioningmap.keySet().toArray()[0]; Assert.assertEquals(true, (boolean) provisioningmap.get(uuid)); Assert.assertEquals(tenant, map.get("tenant")); List<Service> services = connectorConfigurationManager.getAllServicesByType(CssdkConstants.CLOUD); Assert.assertEquals(tenant.getOwner(), map.get("effectiveUser")); Assert.assertEquals("company_setup.connector_cs_admin", viewService); Assert.assertEquals(services.toString(), map.get("services").toString()); } catch (Exception e) { e.printStackTrace(); Assert.fail(); } }
From source file:gtu._work.ui.RegexCatchReplacer_Ebao.java
private void initGUI() { try {/*from w ww. ja v a2 s .c o m*/ { } BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("source", null, jPanel1, null); { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); { replaceArea = new JTextArea(); jScrollPane1.setViewportView(replaceArea); replaceArea.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { JPopupMenuUtil.newInstance(replaceArea).applyEvent(evt) .addJMenuItem("load from file", true, new ActionListener() { Thread newThread; public void actionPerformed(ActionEvent arg0) { if (newThread != null && newThread.getState() != Thread.State.TERMINATED) { JCommonUtil._jOptionPane_showMessageDialog_error( "file is loading!"); return; } final File file = JCommonUtil._jFileChooser_selectFileOnly(); if (file == null) { JCommonUtil._jOptionPane_showMessageDialog_error( "file is not correct!"); return; } String defaultCharset = Charset.defaultCharset().displayName(); String chst = (String) JCommonUtil._jOptionPane_showInputDialog( "input your charset!", defaultCharset); final Charset charset2 = Charset.forName( StringUtils.defaultIfEmpty(chst, defaultCharset)); newThread = new Thread(Thread.currentThread().getThreadGroup(), new Runnable() { public void run() { try { loadFromFileSb = new StringBuilder(); BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream(file), charset2)); for (String line = null; (line = reader .readLine()) != null;) { loadFromFileSb.append(line + "\n"); } reader.close(); replaceArea .setText(loadFromFileSb.toString()); JCommonUtil ._jOptionPane_showMessageDialog_info( "load completed!"); } catch (Exception e) { JCommonUtil.handleException(e); } } }, "" + System.currentTimeMillis()); newThread.setDaemon(true); newThread.start(); } }).show(); } }); } } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("param", null, jPanel2, null); { exeucte = new JButton(); jPanel2.add(exeucte, BorderLayout.SOUTH); exeucte.setText("exeucte"); exeucte.setPreferredSize(new java.awt.Dimension(491, 125)); exeucte.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { exeucteActionPerformed(evt); } }); } { jPanel3 = new JPanel(); GroupLayout jPanel3Layout = new GroupLayout((JComponent) jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel2.add(jPanel3, BorderLayout.CENTER); { repFromText = new JTextField(); } { repToText = new JTextField(); } jPanel3Layout.setHorizontalGroup(jPanel3Layout.createSequentialGroup() .addContainerGap(25, 25) .addGroup(jPanel3Layout.createParallelGroup() .addGroup(jPanel3Layout.createSequentialGroup().addComponent(repFromText, GroupLayout.PREFERRED_SIZE, 446, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup().addComponent(repToText, GroupLayout.PREFERRED_SIZE, 446, GroupLayout.PREFERRED_SIZE))) .addContainerGap(20, Short.MAX_VALUE)); jPanel3Layout.setVerticalGroup(jPanel3Layout.createSequentialGroup().addContainerGap() .addComponent(repFromText, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(repToText, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); } { addToTemplate = new JButton(); jPanel2.add(addToTemplate, BorderLayout.NORTH); addToTemplate.setText("add to template"); addToTemplate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { prop.put(repFromText.getText(), repToText.getText()); reloadTemplateList(); } }); } } { jPanel4 = new JPanel(); BorderLayout jPanel4Layout = new BorderLayout(); jPanel4.setLayout(jPanel4Layout); jTabbedPane1.addTab("result", null, jPanel4, null); { jScrollPane2 = new JScrollPane(); jPanel4.add(jScrollPane2, BorderLayout.CENTER); jScrollPane2.setPreferredSize(new java.awt.Dimension(491, 283)); { DefaultTableModel resultAreaModel = JTableUtil.createModel(true, "match", "count"); resultArea = new JTable(); jScrollPane2.setViewportView(resultArea); JTableUtil.defaultSetting(resultArea); resultArea.setModel(resultAreaModel); } } } { jPanel5 = new JPanel(); BorderLayout jPanel5Layout = new BorderLayout(); jPanel5.setLayout(jPanel5Layout); jTabbedPane1.addTab("template", null, jPanel5, null); { jScrollPane3 = new JScrollPane(); jPanel5.add(jScrollPane3, BorderLayout.CENTER); { templateList = new JList(); jScrollPane3.setViewportView(templateList); reloadTemplateList(); } templateList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { if (templateList.getLeadSelectionIndex() == -1) { return; } Entry<Object, Object> entry = (Entry<Object, Object>) JListUtil .getLeadSelectionObject(templateList); repFromText.setText((String) entry.getKey()); repToText.setText((String) entry.getValue()); } }); templateList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { JListUtil.newInstance(templateList).defaultJListKeyPressed(evt); } }); } } { jPanel6 = new JPanel(); FlowLayout jPanel6Layout = new FlowLayout(); jPanel6.setLayout(jPanel6Layout); jTabbedPane1.addTab("result1", null, jPanel6, null); { resultBtn1 = new JButton(); jPanel6.add(resultBtn1); resultBtn1.setText("to String[]"); resultBtn1.setPreferredSize(new java.awt.Dimension(105, 32)); resultBtn1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { JTableUtil tableUtil = JTableUtil.newInstance(resultArea); int[] rowPoss = tableUtil.getSelectedRows(); DefaultTableModel model = tableUtil.getModel(); List<Object> valueList = new ArrayList<Object>(); for (int ii = 0; ii < rowPoss.length; ii++) { valueList.add(model.getValueAt(rowPoss[ii], 0)); } String reult = valueList.toString().replaceAll("[\\s]", "") .replaceAll("[\\,]", "\",\"").replaceAll("[\\[\\]]", "\""); ClipboardUtil.getInstance().setContents(reult); } }); } { resultBtn2 = new JButton(); jPanel6.add(resultBtn2); resultBtn2.setText("TODO"); resultBtn2.setPreferredSize(new java.awt.Dimension(105, 32)); resultBtn2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { System.out.println("resultBtn1.actionPerformed, event=" + evt); // TODO add your code for // resultBtn1.actionPerformed JCommonUtil._jOptionPane_showMessageDialog_info("TODO"); } }); } } } this.setSize(512, 350); JCommonUtil.setFont(repToText, repFromText, replaceArea, templateList); { panel = new JPanel(); jTabbedPane1.addTab("eBao", null, panel, null); panel.setLayout(new BorderLayout(0, 0)); { scrollPane = new JScrollPane(); panel.add(scrollPane, BorderLayout.CENTER); { ebaoTable = new JTable(); scrollPane.setViewportView(ebaoTable); // TODO DefaultTableModel ebaoModel = JTableUtil.createModel(true, "match", "label"); JTableUtil.defaultSetting(ebaoTable); ebaoTable.setModel(ebaoModel); } } { exactEbaoSearchChk = new JCheckBox(""); panel.add(exactEbaoSearchChk, BorderLayout.NORTH); } } JCommonUtil.frameCloseDo(this, new WindowAdapter() { public void windowClosing(WindowEvent paramWindowEvent) { if (StringUtils.isNotBlank(repFromText.getText())) { prop.put(repFromText.getText(), repToText.getText()); } try { prop.store(new FileOutputStream(propFile), "regexText"); } catch (Exception e) { JCommonUtil.handleException("properties store error!", e); } setVisible(false); dispose(); } }); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.jvoid.customers.customer.service.CustomerMasterService.java
public CustomerMaster getCustomerByEmail(String email) { CustomerMaster customerMaster = new CustomerMaster(); Customer customer = this.customerService.getCustomerByEmailId(email); int customerId = customer.getId(); if (null != customer) { customerMaster.setId(customerId); List<CustomerEntityValues> customerEntityValuesList = this.customerEntityValuesService .getCustomerEntityValuesByCustomerId(customer.getId()); for (CustomerEntityValues customerEntityValues : customerEntityValuesList) { System.out.println("CustEntityValues:" + customerEntityValuesList.toString()); switch (customerEntityValues.getAttributeId()) { case 19: customerMaster.setCustomerGroup(customer.getCustomerGroupId()); break; case 20: customerMaster.setPrefix(customerEntityValues.getValue()); break; case 21: customerMaster.setFirstName(customerEntityValues.getValue()); break; case 22: customerMaster.setMiddleName(customerEntityValues.getValue()); break; case 23: customerMaster.setLastName(customerEntityValues.getValue()); break; case 24: customerMaster.setEmail(customerEntityValues.getValue()); break; case 25: customerMaster.setDateOfBirth(customerEntityValues.getValue()); break; case 26: customerMaster.setTaxNumber(customerEntityValues.getValue()); break; case 27: customerMaster.setGender(customerEntityValues.getValue()); break; case 28: customerMaster.setPassword(customerEntityValues.getValue()); break; case 29: customerMaster.setCompany(customerEntityValues.getValue()); break; case 30: customerMaster.setStreetAddress1(customerEntityValues.getValue()); break; case 31: customerMaster.setStreetAddress2(customerEntityValues.getValue()); break; case 32: customerMaster.setStreetAddress3(customerEntityValues.getValue()); break; case 33: customerMaster.setCity(customerEntityValues.getValue()); break; case 34: customerMaster.setCountry(customerEntityValues.getValue()); break; case 35: customerMaster.setState(customerEntityValues.getValue()); break; case 36: customerMaster.setPostalCode(customerEntityValues.getValue()); break; case 37: customerMaster.setPhone(customerEntityValues.getValue()); break; case 38: customerMaster.setFax(customerEntityValues.getValue()); break; default: break; }/*from w w w . j a va2s . co m*/ } } return customerMaster; }
From source file:com.gst.infrastructure.dataqueries.service.EntityDatatableChecksWritePlatformServiceImpl.java
@Override public void runTheCheckForProduct(final Long entityId, final String entityName, final Long statusCode, String foreignKeyColumn, long productId) { List<EntityDatatableChecks> tableRequiredBeforAction = entityDatatableChecksRepository .findByEntityStatusAndProduct(entityName, statusCode, productId); if (tableRequiredBeforAction == null || tableRequiredBeforAction.size() < 1) { tableRequiredBeforAction = entityDatatableChecksRepository.findByEntityStatusAndNoProduct(entityName, statusCode);//from ww w .j a v a 2 s . c om } if (tableRequiredBeforAction != null) { List<String> reqDatatables = new ArrayList<>(); for (EntityDatatableChecks t : tableRequiredBeforAction) { final String datatableName = t.getDatatableName(); final Long countEntries = readWriteNonCoreDataService.countDatatableEntries(datatableName, entityId, foreignKeyColumn); logger.info("The are " + countEntries + " entries in the table " + datatableName); if (countEntries.intValue() == 0) { reqDatatables.add(datatableName); } } if (reqDatatables.size() > 0) { throw new DatatableEntryRequiredException(reqDatatables.toString()); } } }
From source file:org.jboss.pnc.environment.docker.DockerEnvironmentDriver.java
/** * Prepares configuration of environment variables * for creating Docker container/*from ww w.ja va2s . co m*/ * * @param dependencyUrl AProx dependencyUrl * @param deployUrl AProx deployUrl * @param proxyServer Proxy server IP address or DNS resolvable name * @param proxyPort number of proxy server port where is it listening * @param proxyUsername the getBuildRepositoryId for tracking * @param nonProxyHosts the list of '|' delimited addresses/names ('*' wildcards allowed) which should NOT be proxied * @return Environment variables configuration */ private List<String> prepareEnvVariables(String dependencyUrl, String deployUrl, String proxyServer, String proxyPort, String proxyUsername, String nonProxyHosts) { String proxyActive = "false"; if ((proxyServer != null && proxyPort != null) && (!proxyServer.isEmpty() && !proxyPort.isEmpty())) { proxyActive = "true"; } List<String> envVariables = new ArrayList<>(); envVariables.add("firewallAllowedDestinations=" + containerFirewallAllowedDestinations); envVariables.add("AProxDependencyUrl=" + dependencyUrl); envVariables.add("AProxDeployUrl=" + deployUrl); envVariables.add("isHttpActive=" + proxyActive); envVariables.add("proxyServer=" + proxyServer); envVariables.add("proxyPort=" + proxyPort); envVariables.add("proxyUsername=" + proxyUsername); envVariables.add("nonProxyHosts=" + nonProxyHosts); if (logger.isDebugEnabled()) { logger.debug("Setting environment variables for docker container " + envVariables.toString()); } return envVariables; }
From source file:com.hortonworks.streamline.streams.security.service.SecurityCatalogResource.java
@GET @Path("/roles") @Timed// w w w .j a v a2s .c o m public Response listRoles(@Context UriInfo uriInfo, @Context SecurityContext securityContext) throws Exception { if (!SecurityUtil.hasRole(authorizer, securityContext, ROLE_SECURITY_ADMIN)) { LOG.debug("Allowing logged-in user '{}'", SecurityUtil.getUserName(securityContext.getUserPrincipal().getName())); } Collection<Role> roles; MultivaluedMap<String, String> params = uriInfo.getQueryParameters(); List<QueryParam> queryParams = WSUtils.buildQueryParameters(params); if (params == null || params.isEmpty()) { roles = catalogService.listRoles(); } else { roles = catalogService.listRoles(queryParams); } if (roles != null) { return WSUtils.respondEntities(roles, OK); } throw EntityNotFoundException.byFilter(queryParams.toString()); }
From source file:com.hortonworks.streamline.streams.security.service.SecurityCatalogResource.java
@GET @Path("/users") @Timed/* ww w. j a v a 2 s. c om*/ public Response listUsers(@Context UriInfo uriInfo, @Context SecurityContext securityContext) throws Exception { if (!SecurityUtil.hasRole(authorizer, securityContext, ROLE_SECURITY_ADMIN)) { LOG.debug("Allowing logged-in user '{}'", SecurityUtil.getUserName(securityContext.getUserPrincipal().getName())); } Collection<User> users; MultivaluedMap<String, String> params = uriInfo.getQueryParameters(); List<QueryParam> queryParams = WSUtils.buildQueryParameters(params); if (params == null || params.isEmpty()) { users = catalogService.listUsers(); } else { users = catalogService.listUsers(queryParams); } if (users != null) { return WSUtils.respondEntities(users, OK); } throw EntityNotFoundException.byFilter(queryParams.toString()); }
From source file:com.gst.infrastructure.dataqueries.service.EntityDatatableChecksWritePlatformServiceImpl.java
@Override public void runTheCheck(final Long entityId, final String entityName, final Long statusCode, String foreignKeyColumn) { final List<EntityDatatableChecks> tableRequiredBeforeClientActivation = entityDatatableChecksRepository .findByEntityAndStatus(entityName, statusCode); if (tableRequiredBeforeClientActivation != null) { List<String> reqDatatables = new ArrayList<>(); for (EntityDatatableChecks t : tableRequiredBeforeClientActivation) { final String datatableName = t.getDatatableName(); final Long countEntries = readWriteNonCoreDataService.countDatatableEntries(datatableName, entityId, foreignKeyColumn);/*from w ww . j ava2 s . c o m*/ logger.info("The are " + countEntries + " entries in the table " + datatableName); if (countEntries.intValue() == 0) { reqDatatables.add(datatableName); } } if (reqDatatables.size() > 0) { throw new DatatableEntryRequiredException(reqDatatables.toString()); } } }