List of usage examples for java.util StringTokenizer nextElement
public Object nextElement()
From source file:org.joget.apps.app.controller.ConsoleWebController.java
@RequestMapping(value = "/console/directory/grade/(*:id)/user/unassign", method = RequestMethod.POST) public String consoleGradeUserUnassign(@RequestParam(value = "id") String id, @RequestParam(value = "ids") String ids) { StringTokenizer strToken = new StringTokenizer(ids, ","); while (strToken.hasMoreTokens()) { String userId = (String) strToken.nextElement(); employmentDao.unassignUserFromGrade(userId, id); }//w ww. j a v a2s . c om return "console/directory/gradeView"; }
From source file:org.joget.apps.app.controller.ConsoleWebController.java
@RequestMapping(value = "/console/directory/group/(*:id)/user/assign/submit", method = RequestMethod.POST) public String consoleGroupUserAssignSubmit(ModelMap model, @RequestParam(value = "id") String id, @RequestParam(value = "ids") String ids) { StringTokenizer strToken = new StringTokenizer(ids, ","); while (strToken.hasMoreTokens()) { String userId = (String) strToken.nextElement(); userDao.assignUserToGroup(userId, id); }//from w w w . j a v a2 s. co m return "console/directory/groupUserAssign"; }
From source file:org.joget.apps.app.controller.ConsoleWebController.java
@RequestMapping(value = "/console/directory/group/(*:id)/user/unassign", method = RequestMethod.POST) public String consoleGroupUserUnassign(@RequestParam(value = "id") String id, @RequestParam(value = "ids") String ids) { StringTokenizer strToken = new StringTokenizer(ids, ","); while (strToken.hasMoreTokens()) { String userId = (String) strToken.nextElement(); userDao.unassignUserFromGroup(userId, id); }//from ww w. j a v a 2s . c om return "console/directory/groupList"; }
From source file:org.joget.apps.app.controller.ConsoleWebController.java
@RequestMapping(value = "/console/directory/user/(*:id)/group/assign/submit", method = RequestMethod.POST) public String consoleUserGroupAssignSubmit(ModelMap model, @RequestParam(value = "id") String id, @RequestParam(value = "ids") String ids) { StringTokenizer strToken = new StringTokenizer(ids, ","); while (strToken.hasMoreTokens()) { String groupId = (String) strToken.nextElement(); userDao.assignUserToGroup(id, groupId); }/*from w ww . j av a2 s . c o m*/ return "console/directory/userGroupAssign"; }
From source file:org.joget.apps.app.controller.ConsoleWebController.java
@RequestMapping(value = "/console/directory/user/(*:id)/group/unassign", method = RequestMethod.POST) public String consoleUserGroupUnassign(@RequestParam(value = "id") String id, @RequestParam(value = "ids") String ids) { StringTokenizer strToken = new StringTokenizer(ids, ","); while (strToken.hasMoreTokens()) { String groupId = (String) strToken.nextElement(); userDao.unassignUserFromGroup(id, groupId); }//from w ww. j a v a 2s . co m return "console/directory/userList"; }
From source file:org.joget.apps.app.controller.ConsoleWebController.java
@RequestMapping(value = "/console/setting/scheduler/firenow", method = RequestMethod.POST) public String consoleSettingSchedulerFireNow(@RequestParam(value = "ids") String ids) { StringTokenizer strToken = new StringTokenizer(ids, ","); while (strToken.hasMoreTokens()) { String id = (String) strToken.nextElement(); SchedulerDetails details = schedulerDetailsDao.getSchedulerDetailsById(id); try {/* w w w .jav a 2 s . c o m*/ schedulerManager.fireNow(details); } catch (SchedulerException e) { LOGGER.error("Unable to fire " + "[" + details.getJobName() + "] " + e.getMessage()); continue; } } return "console/dialogClose"; }
From source file:org.joget.apps.app.controller.ConsoleWebController.java
@RequestMapping(value = "/console/directory/org/delete", method = RequestMethod.POST) public String consoleOrgDelete(@RequestParam(value = "ids") String ids) { StringTokenizer strToken = new StringTokenizer(ids, ","); while (strToken.hasMoreTokens()) { String organizationId = (String) strToken.nextElement(); organizationDao.deleteOrganization(organizationId); }//from w w w. ja v a 2s.co m return "console/directory/orgList"; }
From source file:org.joget.apps.app.controller.ConsoleWebController.java
@RequestMapping(value = "/console/directory/user/delete", method = RequestMethod.POST) public String consoleUserDelete(@RequestParam(value = "ids") String ids) { String currentUsername = workflowUserManager.getCurrentUsername(); StringTokenizer strToken = new StringTokenizer(ids, ","); while (strToken.hasMoreTokens()) { String id = (String) strToken.nextElement(); if (id != null && !id.equals(currentUsername)) { userDao.deleteUser(id);//from w ww . ja v a 2 s. c o m UserSalt userSalt = userSaltDao.getUserSaltByUserId(id); if (userSalt != null) { userSaltDao.deleteUserSalt(userSalt.getId()); } UserSecurity us = DirectoryUtil.getUserSecurity(); if (us != null) { us.deleteUserPostProcessing(id); } } } return "console/directory/userList"; }
From source file:org.joget.apps.app.controller.ConsoleWebController.java
@RequestMapping(value = "/console/setting/plugin/uninstall", method = RequestMethod.POST) public String consoleSettingPluginUninstall(ModelMap map, @RequestParam("selectedPlugins") String selectedPlugins) { StringTokenizer strToken = new StringTokenizer(selectedPlugins, ","); while (strToken.hasMoreTokens()) { String pluginClassName = (String) strToken.nextElement(); pluginManager.uninstall(pluginClassName); }/*w ww. ja v a 2 s .c om*/ return "redirect:/web/console/setting/plugin"; }
From source file:org.joget.apps.app.controller.ConsoleWebController.java
@SuppressWarnings("unchecked") @RequestMapping(value = "/console/app/(*:param_appId)/(~:param_version)/processes/(*:param_processDefId)/participant/(*:param_participantId)/submit/(*:param_type)", method = RequestMethod.POST) public String consoleParticipantSubmit(ModelMap map, HttpServletRequest request, @RequestParam("param_appId") String appId, @RequestParam(value = "param_version", required = false) String version, @RequestParam("param_processDefId") String processDefId, @RequestParam("param_participantId") String participantId, @RequestParam("param_type") String type, @RequestParam(value = "param_value", required = false) String value, @RequestParam(value = "pluginProperties", required = false) String pluginProperties) throws UnsupportedEncodingException { PackageParticipant participant = new PackageParticipant(); participant.setProcessDefId(processDefId); participant.setParticipantId(participantId); AppDefinition appDef = appService.getAppDefinition(appId, version); PackageDefinition packageDef = appDef.getPackageDefinition(); if (PackageParticipant.TYPE_PLUGIN.equals(type)) { if (pluginProperties == null) { //request params @SuppressWarnings({ "rawtypes" }) Map<String, String> propertyMap = new HashMap(); Enumeration<String> e = request.getParameterNames(); while (e.hasMoreElements()) { String paramName = e.nextElement(); if (!paramName.startsWith("param_")) { String[] paramValue = (String[]) request.getParameterValues(paramName); propertyMap.put(paramName, CsvUtil.getDeliminatedString(paramValue)); }/*from w w w . j a v a 2s . c o m*/ } // form csv properties StringWriter sw = new StringWriter(); try { CSVWriter writer = new CSVWriter(sw); @SuppressWarnings("rawtypes") Iterator it = propertyMap.entrySet().iterator(); while (it.hasNext()) { @SuppressWarnings({ "rawtypes" }) Map.Entry<String, String> pairs = (Map.Entry) it.next(); writer.writeNext(new String[] { pairs.getKey(), pairs.getValue() }); } writer.close(); } catch (Exception ex) { LogUtil.error(getClass().getName(), ex, ""); } String pluginProps = sw.toString(); participant.setPluginProperties(pluginProps); } else { PackageParticipant participantExisting = packageDef.getPackageParticipant(processDefId, participantId); String oldJson = ""; if (participantExisting != null && PackageParticipant.TYPE_PLUGIN.equals(participantExisting.getType())) { oldJson = participantExisting.getPluginProperties(); } participant .setPluginProperties(PropertyUtil.propertiesJsonStoreProcessing(oldJson, pluginProperties)); } } else if ((PackageParticipant.TYPE_GROUP.equals(type) || PackageParticipant.TYPE_USER.equals(type)) && packageDef != null) { //Using Set to prevent duplicate value @SuppressWarnings("rawtypes") Set values = new HashSet(); StringTokenizer valueToken = new StringTokenizer(value, ","); while (valueToken.hasMoreTokens()) { values.add((String) valueToken.nextElement()); } PackageParticipant participantExisting = packageDef.getPackageParticipant(processDefId, participantId); if (participantExisting != null && participantExisting.getValue() != null) { StringTokenizer existingValueToken = (type.equals(participantExisting.getType())) ? new StringTokenizer(participantExisting.getValue().replaceAll(";", ","), ",") : null; while (existingValueToken != null && existingValueToken.hasMoreTokens()) { values.add((String) existingValueToken.nextElement()); } } //Convert Set to String value = ""; @SuppressWarnings("rawtypes") Iterator i = values.iterator(); while (i.hasNext()) { value += i.next().toString() + ','; } if (value.length() > 0) { value = value.substring(0, value.length() - 1); } } participant.setType(type); participant.setValue(value); packageDefinitionDao.addAppParticipant(appId, appDef.getVersion(), participant); map.addAttribute("appId", appId); map.addAttribute("appVersion", appDef.getVersion()); map.addAttribute("appDefinition", appDef); map.addAttribute("participantId", participantId); map.addAttribute("processDefId", URLEncoder.encode(processDefId, "UTF-8")); if (PackageParticipant.TYPE_PLUGIN.equals(type)) { return "console/apps/participantPluginConfigSuccess"; } else { return "console/apps/participantAddSuccess"; } }