List of usage examples for java.util Map clear
void clear();
From source file:com.esd.ps.ManagerController.java
/** * user list/*from w ww.j av a2 s . c o m*/ * * @param userNameCondition * @param userType * @param page * @param year * @param month * @param taskUpload * @return */ @RequestMapping(value = "/manager", method = RequestMethod.POST) @ResponseBody public Map<String, Object> managerPost(String userNameCondition, int userType, int page, String beginDate, String endDate, int taskUpload, int dateType) { logger.debug("userType:{},page:{},userNameCondition:{},year:{},month:{}", userType, page, userNameCondition, beginDate, endDate); Map<String, Object> map = new HashMap<String, Object>(); // SimpleDateFormat sdf = new // SimpleDateFormat(Constants.DATETIME_FORMAT); int totlePage = Constants.ZERO; List<Map<String, Object>> list = workerService.getLikeRealName(userNameCondition, page, Constants.ROW); map.clear(); int totle = workerService.getCountLikeRealname(userNameCondition); totlePage = (int) Math.ceil((double) totle / (double) Constants.ROW); map.put(Constants.LIST, list); map.put(Constants.TOTLE, totle); map.put(Constants.TOTLE_PAGE, totlePage); return map; }
From source file:com.espertech.esper.core.start.EPStatementStartMethodHelperSubselect.java
private static Pair<EventTableFactory, SubordTableLookupStrategyFactory> determineSubqueryIndexInternalFactory( ExprNode filterExpr, EventType viewableEventType, EventType[] outerEventTypes, StreamTypeService subselectTypeService, boolean fullTableScan, Set<String> optionalUniqueProps) throws ExprValidationException { // No filter expression means full table scan if ((filterExpr == null) || fullTableScan) { UnindexedEventTableFactory table = new UnindexedEventTableFactory(0); SubordFullTableScanLookupStrategyFactory strategy = new SubordFullTableScanLookupStrategyFactory(); return new Pair<EventTableFactory, SubordTableLookupStrategyFactory>(table, strategy); }// ww w . ja va 2 s .c om // Build a list of streams and indexes SubordPropPlan joinPropDesc = QueryPlanIndexBuilder.getJoinProps(filterExpr, outerEventTypes.length, subselectTypeService.getEventTypes()); Map<String, SubordPropHashKey> hashKeys = joinPropDesc.getHashProps(); Map<String, SubordPropRangeKey> rangeKeys = joinPropDesc.getRangeProps(); List<SubordPropHashKey> hashKeyList = new ArrayList<SubordPropHashKey>(hashKeys.values()); List<SubordPropRangeKey> rangeKeyList = new ArrayList<SubordPropRangeKey>(rangeKeys.values()); boolean unique = false; // If this is a unique-view and there are unique criteria, use these if (optionalUniqueProps != null && !optionalUniqueProps.isEmpty()) { boolean found = true; for (String uniqueProp : optionalUniqueProps) { if (!hashKeys.containsKey(uniqueProp)) { found = false; break; } } if (found) { String[] hashKeysArray = hashKeys.keySet().toArray(new String[hashKeys.keySet().size()]); for (String hashKey : hashKeysArray) { if (!optionalUniqueProps.contains(hashKey)) { hashKeys.remove(hashKey); } } hashKeyList = new ArrayList<SubordPropHashKey>(hashKeys.values()); unique = true; rangeKeyList.clear(); rangeKeys.clear(); } } // build table (local table) EventTableFactory eventTable; CoercionDesc hashCoercionDesc; CoercionDesc rangeCoercionDesc; if (hashKeys.size() != 0 && rangeKeys.isEmpty()) { String indexedProps[] = hashKeys.keySet().toArray(new String[hashKeys.keySet().size()]); hashCoercionDesc = CoercionUtil.getCoercionTypesHash(viewableEventType, indexedProps, hashKeyList); rangeCoercionDesc = new CoercionDesc(false, null); if (hashKeys.size() == 1) { if (!hashCoercionDesc.isCoerce()) { eventTable = new PropertyIndexedEventTableSingleFactory(0, viewableEventType, indexedProps[0], unique, null); } else { eventTable = new PropertyIndexedEventTableSingleCoerceAddFactory(0, viewableEventType, indexedProps[0], hashCoercionDesc.getCoercionTypes()[0]); } } else { if (!hashCoercionDesc.isCoerce()) { eventTable = new PropertyIndexedEventTableFactory(0, viewableEventType, indexedProps, unique, null); } else { eventTable = new PropertyIndexedEventTableCoerceAddFactory(0, viewableEventType, indexedProps, hashCoercionDesc.getCoercionTypes()); } } } else if (hashKeys.isEmpty() && rangeKeys.isEmpty()) { eventTable = new UnindexedEventTableFactory(0); hashCoercionDesc = new CoercionDesc(false, null); rangeCoercionDesc = new CoercionDesc(false, null); } else if (hashKeys.isEmpty() && rangeKeys.size() == 1) { String indexedProp = rangeKeys.keySet().iterator().next(); CoercionDesc coercionRangeTypes = CoercionUtil.getCoercionTypesRange(viewableEventType, rangeKeys, outerEventTypes); if (!coercionRangeTypes.isCoerce()) { eventTable = new PropertySortedEventTableFactory(0, viewableEventType, indexedProp); } else { eventTable = new PropertySortedEventTableCoercedFactory(0, viewableEventType, indexedProp, coercionRangeTypes.getCoercionTypes()[0]); } hashCoercionDesc = new CoercionDesc(false, null); rangeCoercionDesc = coercionRangeTypes; } else { String[] indexedKeyProps = hashKeys.keySet().toArray(new String[hashKeys.keySet().size()]); Class[] coercionKeyTypes = SubordPropUtil.getCoercionTypes(hashKeys.values()); String[] indexedRangeProps = rangeKeys.keySet().toArray(new String[rangeKeys.keySet().size()]); CoercionDesc coercionRangeTypes = CoercionUtil.getCoercionTypesRange(viewableEventType, rangeKeys, outerEventTypes); eventTable = new PropertyCompositeEventTableFactory(0, viewableEventType, indexedKeyProps, coercionKeyTypes, indexedRangeProps, coercionRangeTypes.getCoercionTypes()); hashCoercionDesc = CoercionUtil.getCoercionTypesHash(viewableEventType, indexedKeyProps, hashKeyList); rangeCoercionDesc = coercionRangeTypes; } SubordTableLookupStrategyFactory subqTableLookupStrategyFactory = SubordinateTableLookupStrategyUtil .getLookupStrategy(outerEventTypes, hashKeyList, hashCoercionDesc, rangeKeyList, rangeCoercionDesc, false); return new Pair<EventTableFactory, SubordTableLookupStrategyFactory>(eventTable, subqTableLookupStrategyFactory); }
From source file:org.dkpro.lab.engine.impl.MultiThreadBatchTaskEngine.java
@Override protected void executeConfiguration(BatchTask aConfiguration, TaskContext aContext, Map<String, Object> aConfig, Set<String> aExecutedSubtasks) throws ExecutionException, LifeCycleException { if (log.isTraceEnabled()) { // Show all subtasks executed so far for (String est : aExecutedSubtasks) { log.trace("-- Already executed: " + est); }/*from ww w. j av a 2s . co m*/ } // Set up initial scope used by sub-batch-tasks using the inherited scope. The scope is // extended as the subtasks of this batch are executed with the present configuration. // FIXME: That means that sub-batch-tasks in two different configurations cannot see // each other. Is that intended? Mind that the "executedSubtasks" set is intentionally // maintained *across* configurations, so maybe the scope should also be maintained // *across* configurations? - REC 2014-06-15 Set<String> scope = new HashSet<>(); if (aConfiguration.getScope() != null) { scope.addAll(aConfiguration.getScope()); } // Configure subtasks for (Task task : aConfiguration.getTasks()) { // Now the setup is complete aContext.getLifeCycleManager().configure(aContext, task, aConfig); } Queue<Task> queue = new LinkedList<>(aConfiguration.getTasks()); // keeps track of the execution threads; // TODO MW: do we really need this or can we work with the futures list only? Map<Task, ExecutionThread> threads = new HashMap<>(); // keeps track of submitted Futures and their associated tasks Map<Future<?>, Task> futures = new HashMap<Future<?>, Task>(); // will be instantiated with all exceptions from current loop ConcurrentMap<Task, Throwable> exceptionsFromLastLoop = null; ConcurrentMap<Task, Throwable> exceptionsFromCurrentLoop = new ConcurrentHashMap<>(); int outerLoopCounter = 0; // main loop do { outerLoopCounter++; threads.clear(); futures.clear(); ExecutorService executor = Executors.newFixedThreadPool(maxThreads); // set the exceptions from the last loop exceptionsFromLastLoop = new ConcurrentHashMap<>(exceptionsFromCurrentLoop); // Fix MW: Clear exceptionsFromCurrentLoop; otherwise the loop with run at most twice. exceptionsFromCurrentLoop.clear(); // process all tasks from the queue while (!queue.isEmpty()) { Task task = queue.poll(); TaskContextMetadata execution = getExistingExecution(aConfiguration, aContext, task, aConfig, aExecutedSubtasks); // Check if a subtask execution compatible with the present configuration has // does already exist ... if (execution == null) { // ... otherwise execute it with the present configuration log.info("Executing task [" + task.getType() + "]"); // set scope here so that the inherited scopes are considered if (task instanceof BatchTask) { ((BatchTask) task).setScope(scope); } ExecutionThread thread = new ExecutionThread(aContext, task, aConfig, aExecutedSubtasks); threads.put(task, thread); futures.put(executor.submit(thread), task); } else { log.debug("Using existing execution [" + execution.getId() + "]"); // Record new/existing execution aExecutedSubtasks.add(execution.getId()); scope.add(execution.getId()); } } // try and get results from all futures to check for failed executions for (Map.Entry<Future<?>, Task> entry : futures.entrySet()) { try { entry.getKey().get(); } catch (java.util.concurrent.ExecutionException ex) { Task task = entry.getValue(); // TODO MW: add a retry-counter here to prevent endless loops? log.info("Task exec failed for [" + task.getType() + "]"); // record the failed task, so that it can be re-added to the queue exceptionsFromCurrentLoop.put(task, ex); } catch (InterruptedException ex) { // thread interrupted, exit throw new RuntimeException(ex); } } log.debug("Calling shutdown"); executor.shutdown(); log.debug("All threads finished"); // collect the results for (Map.Entry<Task, ExecutionThread> entry : threads.entrySet()) { Task task = entry.getKey(); ExecutionThread thread = entry.getValue(); TaskContextMetadata execution = thread.getTaskContextMetadata(); // probably failed if (execution == null) { Throwable exception = exceptionsFromCurrentLoop.get(task); if (!(exception instanceof UnresolvedImportException) && !(exception instanceof java.util.concurrent.ExecutionException)) { throw new RuntimeException(exception); } exceptionsFromCurrentLoop.put(task, exception); // re-add to the queue queue.add(task); } else { // Record new/existing execution aExecutedSubtasks.add(execution.getId()); scope.add(execution.getId()); } } } // finish if the same tasks failed again while (!exceptionsFromCurrentLoop.keySet().equals(exceptionsFromLastLoop.keySet())); // END OF DO; finish if the same tasks failed again if (!exceptionsFromCurrentLoop.isEmpty()) { // collect all details StringBuilder details = new StringBuilder(); for (Throwable throwable : exceptionsFromCurrentLoop.values()) { details.append("\n -"); details.append(throwable.getMessage()); } // we re-throw the first exception Throwable next = exceptionsFromCurrentLoop.values().iterator().next(); if (next instanceof RuntimeException) { throw (RuntimeException) next; } // otherwise wrap it throw new RuntimeException(details.toString(), next); } log.info("MultiThreadBatchTask completed successfully. Total number of outer loop runs: " + outerLoopCounter); }
From source file:com.linuxbox.enkive.message.search.PermissionsEnforcingMessageSearchService.java
@Override public SearchQuery search(Map<String, String> fields) throws MessageSearchException { try {//from w w w . ja v a 2s . com if (permService.isAdmin()) { LOGGER.trace("message search performed by administrator"); } else { LOGGER.trace("message search performed by non-admininstrator"); Collection<String> addresses = permService.canReadAddresses(permService.getCurrentUsername()); if (addresses.isEmpty()) { // If there are no permissions to read any addresses, void // the query LOGGER.warn( "search performed by non-admin could not find any email addresses to limit search."); /* TODO: Is this correct behavior -- clearing search fields? */ fields.clear(); } else { StringBuilder addressesStringBuilder = new StringBuilder(); for (String address : addresses) { addressesStringBuilder.append(address); addressesStringBuilder.append("; "); } final String addressesString = addressesStringBuilder.toString(); LOGGER.trace("search performed by non-admin using email addresses to limit search: " + addressesString); fields.put(PERMISSIONS_SENDER_PARAMETER, addressesString); fields.put(PERMISSIONS_RECIPIENT_PARAMETER, addressesString); } } } catch (CannotGetPermissionsException e) { throw new MessageSearchException("Could not get permissions for current user", e); } return messageSearchService.search(fields); }
From source file:edu.cornell.med.icb.io.TestConditionsParser.java
public void testBeanWithCreation() throws IOException, ConditionsParsingException { final String input = "_CLASSNAME_=edu.cornell.med.icb.io.SampleBean," + "oneInt=123,twoDouble=456,threeString=def\t123\t5,6,7\n"; final Reader source = new StringReader(input); final ConditionsParser parser = new ConditionsParser(); parser.addField(new ConditionField(ConditionField.FieldType.MAP, "one")); parser.addField(new ConditionField(ConditionField.FieldType.VALUE, "two")); parser.addField(new ConditionField(ConditionField.FieldType.VALUE, "three").setList(true)); parser.beginParse(source);//from w w w. ja v a 2s. c o m final Map<String, String> expValues = new HashMap<String, String>(); final Map<String, String> foundValues = new HashMap<String, String>(); assertTrue(parser.hasNext()); expValues.clear(); expValues.put("oneInt", "123"); expValues.put("twoDouble", "456"); expValues.put("threeString", "def"); foundValues.clear(); final Object testBeanObj = parser.parseFieldBean("one", null, foundValues); assertTrue(testBeanObj instanceof SampleBean); final SampleBean testBean = (SampleBean) testBeanObj; checkMap(expValues, foundValues); assertEquals("123", parser.parseFieldValueString("two")); checkIntArray(new int[] { 5, 6, 7 }, parser.parseFieldValueIntArray("three")); assertEquals(123, testBean.getOneInt()); assertEquals(456.0d, testBean.getTwoDouble()); assertEquals("def", testBean.getThreeString()); assertEquals(1, parser.getLineNumber()); assertFalse(parser.hasNext()); }
From source file:co.cask.cdap.internal.app.services.http.handlers.PreferencesHttpHandlerTest.java
@Test public void testNamespace() throws Exception { Map<String, String> propMap = Maps.newHashMap(); Assert.assertEquals(propMap, getProperty(getURI(TEST_NAMESPACE1), false, 200)); Assert.assertEquals(propMap, getProperty(getURI(TEST_NAMESPACE2), false, 200)); Assert.assertEquals(propMap, getProperty(getURI(TEST_NAMESPACE1), true, 200)); Assert.assertEquals(propMap, getProperty(getURI(TEST_NAMESPACE2), true, 200)); propMap.put("k1", "3@#3"); propMap.put("@#$#ljfds", "231@#$"); setProperty(getURI(TEST_NAMESPACE1), propMap, 200); Assert.assertEquals(propMap, getProperty(getURI(TEST_NAMESPACE1), false, 200)); Assert.assertEquals(propMap, getProperty(getURI(TEST_NAMESPACE1), true, 200)); Map<String, String> instanceMap = Maps.newHashMap(); instanceMap.put("k1", "432432*#######"); setProperty(getURI(), instanceMap, 200); Assert.assertEquals(instanceMap, getProperty(getURI(), true, 200)); Assert.assertEquals(instanceMap, getProperty(getURI(TEST_NAMESPACE2), true, 200)); Assert.assertEquals(propMap, getProperty(getURI(TEST_NAMESPACE1), true, 200)); instanceMap.put("k2", "(93424"); setProperty(getURI(), instanceMap, 200); instanceMap.putAll(propMap);//from ww w .ja va 2s . co m Assert.assertEquals(instanceMap, getProperty(getURI(TEST_NAMESPACE1), true, 200)); deleteProperty(getURI(TEST_NAMESPACE1), 200); deleteProperty(getURI(TEST_NAMESPACE2), 200); instanceMap.clear(); instanceMap.put("*&$kjh", "*(&*1"); setProperty(getURI(), instanceMap, 200); Assert.assertEquals(instanceMap, getProperty(getURI(TEST_NAMESPACE2), true, 200)); Assert.assertEquals(instanceMap, getProperty(getURI(TEST_NAMESPACE1), true, 200)); instanceMap.clear(); Assert.assertEquals(instanceMap, getProperty(getURI(TEST_NAMESPACE2), false, 200)); Assert.assertEquals(instanceMap, getProperty(getURI(TEST_NAMESPACE1), false, 200)); deleteProperty(getURI(), 200); Assert.assertEquals(instanceMap, getProperty(getURI(TEST_NAMESPACE2), true, 200)); Assert.assertEquals(instanceMap, getProperty(getURI(TEST_NAMESPACE1), true, 200)); getProperty(getURI("invalidNamespace"), true, 404); }
From source file:com.ibm.jaggr.core.impl.modulebuilder.javascript.JavaScriptModuleBuilder.java
@Override public String layerBeginEndNotifier(EventType type, HttpServletRequest request, List<IModule> modules, Set<String> dependentFeatures) { String result = null;//from w w w .jav a 2s. c om if (type == EventType.BEGIN_LAYER) { // If we're doing require list expansion, then set the EXPANDED_DEPENDENCIES attribute // with the set of expanded dependencies for the layer. This will be used by the // build renderer to filter layer dependencies from the require list expansion. if (RequestUtil.isExplodeRequires(request)) { StringBuffer sb = new StringBuffer(); boolean isReqExpLogging = RequestUtil.isRequireExpLogging(request); IRequestedModuleNames requestedModuleNames = (IRequestedModuleNames) request .getAttribute(IHttpTransport.REQUESTEDMODULENAMES_REQATTRNAME); List<String> moduleIds = new ArrayList<String>(modules.size()); List<String> excludeIds = Collections.emptyList(); try { excludeIds = requestedModuleNames != null ? requestedModuleNames.getRequireExpansionExcludes() : Collections.<String>emptyList(); } catch (IOException ignore) { // Shouldn't happen since we pre-fetched the baseLayerDepIds in build(...), // but the language requires us to handle the exception. } for (IModule module : modules) { moduleIds.add(module.getModuleId()); } IAggregator aggr = (IAggregator) request.getAttribute(IAggregator.AGGREGATOR_REQATTRNAME); Features features = (Features) request.getAttribute(IHttpTransport.FEATUREMAP_REQATTRNAME); DependencyList excludeList = new DependencyList(DEPSOURCE_REQEXPEXCLUDES, excludeIds, aggr, features, true, // resolveAliases isReqExpLogging); DependencyList layerDepList = new DependencyList(DEPSOURCE_LAYER, moduleIds, aggr, features, false, // Don't resolve aliases for module ids requested by the loader isReqExpLogging); ModuleDeps excludeDeps = new ModuleDeps(); ModuleDeps layerDeps = new ModuleDeps(); try { excludeDeps.addAll(excludeList.getExplicitDeps()); excludeDeps.addAll(excludeList.getExpandedDeps()); layerDeps.addAll(layerDepList.getExplicitDeps()); layerDeps.addAll(layerDepList.getExpandedDeps()); dependentFeatures.addAll(excludeList.getDependentFeatures()); dependentFeatures.addAll(layerDepList.getDependentFeatures()); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } if (isReqExpLogging) { sb.append("console.log(\"%c" + Messages.JavaScriptModuleBuilder_4 //$NON-NLS-1$ + "\", \"color:blue;background-color:yellow\");"); //$NON-NLS-1$ sb.append("console.log(\"%c" + Messages.JavaScriptModuleBuilder_2 + "\", \"color:blue\");") //$NON-NLS-1$ //$NON-NLS-2$ .append("console.log(\"%c"); //$NON-NLS-1$ for (Map.Entry<String, String> entry : excludeDeps.getModuleIdsWithComments().entrySet()) { sb.append("\t" + entry.getKey() + " (" + entry.getValue() + ")\\r\\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } sb.append("\", \"font-size:x-small\");"); //$NON-NLS-1$ sb.append("console.log(\"%c" + Messages.JavaScriptModuleBuilder_3 + "\", \"color:blue\");") //$NON-NLS-1$ //$NON-NLS-2$ .append("console.log(\"%c"); //$NON-NLS-1$ for (Map.Entry<String, String> entry : layerDeps.getModuleIdsWithComments().entrySet()) { sb.append("\t" + entry.getKey() + " (" + entry.getValue() + ")\\r\\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } sb.append("\", \"font-size:x-small\");"); //$NON-NLS-1$ result = sb.toString(); } layerDeps.addAll(excludeDeps); // Now filter out any dependencies that aren't fully resolved (i.e. those that // depend on any undefined features) because those aren't included in the layer. ModuleDeps resolvedDeps = new ModuleDeps(); layerDeps.simplify((Map<?, ?>) request.getAttribute(JavaScriptModuleBuilder.FORMULA_CACHE_REQATTR)); for (Map.Entry<String, ModuleDepInfo> entry : layerDeps.resolveWith(Features.emptyFeatures) .entrySet()) { if (entry.getValue().containsTerm(BooleanTerm.TRUE)) { resolvedDeps.add(entry.getKey(), entry.getValue()); } } // Save the resolved layer dependencies in the request. request.setAttribute(EXPANDED_DEPENDENCIES, resolvedDeps); result = sb.toString(); } } else if (type == EventType.BEGIN_AMD) { if (RequestUtil.isExplodeRequires(request)) { // Emit module id encoding code result = moduleNameIdEncodingBeginLayer(request, modules); } request.setAttribute(FORMULA_CACHE_REQATTR, new ConcurrentHashMap<Object, Object>()); } else if (type == EventType.END_LAYER) { if (RequestUtil.isExplodeRequires(request)) { // Emit module id encoding code result = moduleNameIdEncodingEndLayer(request, modules); } Map<?, ?> formulaCache = (Map<?, ?>) request.getAttribute(FORMULA_CACHE_REQATTR); if (formulaCache != null) { formulaCache.clear(); } } return result; }
From source file:com.wabacus.system.WabacusResponse.java
private String[] getDisplayInputboxOnloadMethod() { if (this.mDisplayInputboxsOnload == null || this.mDisplayInputboxsOnload.size() == 0) return null; Map<String, DisplayInputboxBean> mTmp1 = new HashMap<String, DisplayInputboxBean>(); mTmp1.putAll(this.mDisplayInputboxsOnload); Map<String, DisplayInputboxBean> mNonDisplayedInputBox = new HashMap<String, DisplayInputboxBean>(); DisplayInputboxBean dibTmp;/*from ww w. j ava 2 s . com*/ StringBuilder bufTmp = new StringBuilder(); while (mTmp1.size() > 0) { mNonDisplayedInputBox.clear(); mNonDisplayedInputBox.putAll(mTmp1); for (Entry<String, DisplayInputboxBean> entryTmp : mTmp1.entrySet()) { dibTmp = entryTmp.getValue(); if (isDisplayedAllParentInputbox(mNonDisplayedInputBox, dibTmp.getLstParentInputboxId())) { bufTmp.append(dibTmp.getInputBoxIdsAsString()); mNonDisplayedInputBox.remove(entryTmp.getKey()); } } if (mNonDisplayedInputBox.size() == mTmp1.size() && mNonDisplayedInputBox.size() > 0) { throw new WabacusRuntimeException("?"); } mTmp1.clear(); mTmp1.putAll(mNonDisplayedInputBox); } if (bufTmp.length() == 0) return null; return new String[] { "showComboxAddOptionsOnload", "{ids:'" + bufTmp.toString() + "'}" }; }
From source file:com.esd.ps.ManagerController.java
/** * ,?,?//from w w w. j a v a 2 s . com * * @param downCount * @param downMaxCount * @param fileSize * @return */ @RequestMapping(value = "/updateCount", method = RequestMethod.POST) @ResponseBody public Map<String, Object> updateCountPost(int downCount, int downMaxCount, int fileSize) { Map<String, Object> map = new HashMap<String, Object>(); manager manager = new manager(); manager.setManagerId(1); manager.setDownCount(downCount); manager.setDownMaxCount(downMaxCount); manager.setFileSize(fileSize); int m = managerService.updateByPrimaryKeySelective(manager); map.clear(); if (m == 1) { map.put(Constants.REPLAY, 1); map.put(Constants.MESSAGE, MSG_UPDATE_SUCCESS); } else { map.put(Constants.REPLAY, 0); map.put(Constants.MESSAGE, MSG_UPDATE_ERROR); } return map; }
From source file:com.esd.ps.ManagerController.java
/** * /*from w w w. j av a2 s. co m*/ * * @param userNameCondition * @param page * @param userLvl * @return */ @RequestMapping(value = "/workerLvl", method = RequestMethod.POST) @ResponseBody public Map<String, Object> workerLvlPost(String userNameCondition, int page, int userLvl) { Map<String, Object> map = new HashMap<String, Object>(); int totlePage = Constants.ZERO; List<Map<String, Object>> list = workerService.getWorkerLvl(userNameCondition, userLvl, page, Constants.ROW); if (list == null) { map.put(Constants.LIST, ""); return map; } map.clear(); int totle = workerService.getWorkerLvlCount(userNameCondition, userLvl); totlePage = (int) Math.ceil((double) totle / (double) Constants.ROW); map.put(Constants.LIST, list); map.put(Constants.TOTLE, totle); map.put(Constants.TOTLE_PAGE, totlePage); return map; }