List of usage examples for java.util GregorianCalendar setTime
public final void setTime(Date date)
Date
. From source file:com.doculibre.constellio.stats.StatsCompiler.java
public synchronized void saveStats(SimpleSearch simpleSearch, SolrServer indexJournal, SolrServer indexCompile, QueryResponse res) throws SolrServerException, IOException { String collectionName = simpleSearch.getCollectionName(); String luceneQuery = simpleSearch.getLuceneQuery(); GregorianCalendar calendar = new GregorianCalendar(); Date time = new Date(); calendar.setTime(time); String query = luceneQuery;/*from w w w.ja va 2 s . c o m*/ String escapedQuery = escape(query); long nbRes = res.getResults().getNumFound(); long qTime = res.getQTime(); String desplayDate = time.toString(); String searchDate = format(time); String queryWithParams = simpleSearch.toSimpleParams().toString(); SolrInputDocument doc = new SolrInputDocument(); doc.addField("id", desplayDate + query); doc.addField("query", query); doc.addField("queryWithParams", queryWithParams); doc.addField("nbres", "" + nbRes); doc.addField("qtime", "" + qTime); doc.addField("dateaffiche", desplayDate); doc.addField("date", searchDate); doc.addField("recherche", "recherche"); doc.addField("collection", collectionName); UpdateRequest up = new UpdateRequest(); up.setAction(ACTION.COMMIT, true, true); up.add(doc); up.process(indexJournal); String compileId = "collection_" + collectionName + " id_" + escapedQuery; SolrQuery solrQuery = new SolrQuery(); // Requte Lucene solrQuery.setQuery("id:\"" + compileId + "\""); // nb rsultats par page solrQuery.setRows(15); // page de dbut solrQuery.setStart(0); QueryResponse qr = indexCompile.query(solrQuery); if (qr.getResults().getNumFound() > 0) { SolrDocument sd = qr.getResults().get(0); long freq = (Long) sd.getFieldValue("freq"); long click = (Long) sd.getFieldValue("click"); // indexCompile.deleteById(query); SolrInputDocument docCompile = new SolrInputDocument(); docCompile.addField("id", compileId); docCompile.addField("query", query); if (!((String) sd.getFieldValue("nbres")).equals("0")) { ConstellioSpringUtils.getAutocompleteServices().onQueryAdd(docCompile, query); } docCompile.addField("freq", freq + 1); docCompile.addField("nbres", "" + nbRes); docCompile.addField("recherche", "recherche"); docCompile.addField("collection", collectionName); if (nbRes == 0) { docCompile.addField("zero", "true"); } else { docCompile.addField("zero", "false"); } docCompile.addField("click", click); if (click == 0) { docCompile.addField("clickstr", "zero"); } else { docCompile.addField("clickstr", "notzero"); } up.clear(); up.setAction(ACTION.COMMIT, true, true); up.add(docCompile); up.process(indexCompile); } else { SolrInputDocument docCompile = new SolrInputDocument(); docCompile.addField("id", compileId); docCompile.addField("query", query); if (nbRes != 0) { ConstellioSpringUtils.getAutocompleteServices().onQueryAdd(docCompile, query); } docCompile.addField("freq", 1); docCompile.addField("recherche", "recherche"); docCompile.addField("collection", collectionName); docCompile.addField("nbres", "" + nbRes); if (nbRes == 0) { docCompile.addField("zero", "true"); } else { docCompile.addField("zero", "false"); } docCompile.addField("click", 0); docCompile.addField("clickstr", "zero"); up.clear(); up.setAction(ACTION.COMMIT, true, true); up.add(docCompile); up.process(indexCompile); } }
From source file:org.metawidget.swing.widgetprocessor.binding.beanutils.BeanUtilsBindingProcessorTest.java
public void testScalaBinding() throws Exception { // Model/*from ww w . ja v a2s .co m*/ Date dateFirst = new GregorianCalendar(1975, Calendar.APRIL, 9).getTime(); ScalaFoo scalaFoo = new ScalaFoo(); scalaFoo.bar_$eq(dateFirst); ScalaFoo scalaFoo2 = new ScalaFoo(); scalaFoo.nestedFoo = scalaFoo2; ScalaFoo scalaFoo3 = new ScalaFoo(); scalaFoo2.nestedFoo = scalaFoo3; scalaFoo3.bar_$eq(new GregorianCalendar(1976, Calendar.MAY, 16).getTime()); // BeanUtilsBinding ConvertUtils.register(new DateConverter(DATE_FORMAT), Date.class); // Inspect SwingMetawidget metawidget = new SwingMetawidget(); metawidget.addWidgetProcessor(new BeanUtilsBindingProcessor( new BeanUtilsBindingProcessorConfig().setPropertyStyle(new ScalaPropertyStyle()))); BaseObjectInspectorConfig config = new BaseObjectInspectorConfig() .setPropertyStyle(new ScalaPropertyStyle()); metawidget.setInspector(new PropertyTypeInspector(config)); metawidget.setToInspect(scalaFoo); // Loading JTextField textField = (JTextField) metawidget.getComponent(1); DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); assertEquals(dateFormat.format(dateFirst), textField.getText()); JLabel label = (JLabel) metawidget.getComponent(5); assertEquals("Not settable", label.getText()); JTextField nestedTextField = (JTextField) ((SwingMetawidget) metawidget.getComponent(3)).getComponent(1); assertEquals("", nestedTextField.getText()); JTextField nestedNestedTextField = (JTextField) ((SwingMetawidget) ((SwingMetawidget) metawidget .getComponent(3)).getComponent(3)).getComponent(1); assertEquals(dateFormat.format(scalaFoo3.bar()), nestedNestedTextField.getText()); // Saving Date dateSecond = new GregorianCalendar(1976, Calendar.MAY, 10).getTime(); textField.setText(dateFormat.format(dateSecond)); nestedNestedTextField.setText(dateFormat.format(new GregorianCalendar(1977, Calendar.JUNE, 17).getTime())); metawidget.getWidgetProcessor(BeanUtilsBindingProcessor.class).save(metawidget); GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(scalaFoo.bar()); assertEquals(1976, calendar.get(Calendar.YEAR)); assertEquals(null, scalaFoo2.bar()); calendar.setTime(scalaFoo3.bar()); assertEquals(1977, calendar.get(Calendar.YEAR)); // Rebinding textField = (JTextField) metawidget.getComponent(1); assertEquals(dateFormat.format(dateSecond), textField.getText()); scalaFoo.bar_$eq(dateFirst); metawidget.getWidgetProcessor(BeanUtilsBindingProcessor.class).rebind(scalaFoo, metawidget); textField = (JTextField) metawidget.getComponent(1); assertEquals(dateFormat.format(dateFirst), textField.getText()); }
From source file:edu.umm.radonc.ca_dash.controllers.HistogramController.java
public void onSelectTimePeriod() { GregorianCalendar gc = new GregorianCalendar(); gc.setTime(startDate); switch (interval) { case "1wk": gc.add(Calendar.DATE, 7); endDate = gc.getTime();/* w w w . j av a2 s . co m*/ break; case "1m": gc.add(Calendar.MONTH, 1); endDate = gc.getTime(); break; case "3m": gc.add(Calendar.MONTH, 3); endDate = gc.getTime(); break; case "6m": gc.add(Calendar.MONTH, 6); endDate = gc.getTime(); break; case "1y": gc.add(Calendar.YEAR, 1); endDate = gc.getTime(); break; case "2y": gc.add(Calendar.YEAR, 2); endDate = gc.getTime(); break; case "3y": gc.add(Calendar.YEAR, 3); endDate = gc.getTime(); break; case "Q1": gc.setTime(FiscalDate.getQuarter(1)); startDate = gc.getTime(); gc.add(Calendar.MONTH, 3); endDate = gc.getTime(); break; case "Q2": gc.setTime(FiscalDate.getQuarter(2)); startDate = gc.getTime(); gc.add(Calendar.MONTH, 3); endDate = gc.getTime(); break; case "Q3": gc.setTime(FiscalDate.getQuarter(3)); startDate = gc.getTime(); gc.add(Calendar.MONTH, 3); endDate = gc.getTime(); break; case "Q4": gc.setTime(FiscalDate.getQuarter(4)); startDate = gc.getTime(); gc.add(Calendar.MONTH, 3); endDate = gc.getTime(); break; } }
From source file:es.tid.fiware.rss.expenditureLimit.processing.test.ProcessingLimitServiceTest.java
/** * Update control dates/*from w ww . j a v a 2 s.c o m*/ * * @param controls */ private void updateDate(List<DbeExpendControl> controls) { GregorianCalendar cal = (GregorianCalendar) Calendar.getInstance(); cal.setTime(new Date()); cal.add(Calendar.DAY_OF_MONTH, 1); DefaultTransactionDefinition def = new DefaultTransactionDefinition(); def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); TransactionStatus status = transactionManager.getTransaction(def); for (DbeExpendControl control : controls) { control.setDtNextPeriodStart(cal.getTime()); controlService.createOrUpdate(control); } transactionManager.commit(status); }
From source file:org.apache.tuscany.sca.binding.rest.provider.RESTBindingInvoker.java
public Message invoke(Message msg) { Object entity = null;// ww w .j a v a 2s.c o m Object[] args = msg.getBody(); URI uri = URI.create(endpointReference.getDeployedURI()); UriBuilder uriBuilder = UriBuilder.fromUri(uri); Method method = ((JavaOperation) operation).getJavaMethod(); if (method.isAnnotationPresent(Path.class)) { // Only for resource method uriBuilder.path(method); } if (!JAXRSHelper.isResourceMethod(method)) { // This is RPC over GET uriBuilder.replaceQueryParam("method", method.getName()); } Map<String, Object> pathParams = new HashMap<String, Object>(); Map<String, Object> matrixParams = new HashMap<String, Object>(); Map<String, Object> queryParams = new HashMap<String, Object>(); Map<String, Object> headerParams = new HashMap<String, Object>(); Map<String, Object> formParams = new HashMap<String, Object>(); Map<String, Object> cookieParams = new HashMap<String, Object>(); for (int i = 0; i < method.getParameterTypes().length; i++) { boolean isEntity = true; Annotation[] annotations = method.getParameterAnnotations()[i]; PathParam pathParam = getAnnotation(annotations, PathParam.class); if (pathParam != null) { isEntity = false; pathParams.put(pathParam.value(), args[i]); } MatrixParam matrixParam = getAnnotation(annotations, MatrixParam.class); if (matrixParam != null) { isEntity = false; matrixParams.put(matrixParam.value(), args[i]); } QueryParam queryParam = getAnnotation(annotations, QueryParam.class); if (queryParam != null) { isEntity = false; queryParams.put(queryParam.value(), args[i]); } HeaderParam headerParam = getAnnotation(annotations, HeaderParam.class); if (headerParam != null) { isEntity = false; headerParams.put(headerParam.value(), args[i]); } FormParam formParam = getAnnotation(annotations, FormParam.class); if (formParam != null) { isEntity = false; formParams.put(formParam.value(), args[i]); } CookieParam cookieParam = getAnnotation(annotations, CookieParam.class); if (cookieParam != null) { isEntity = false; cookieParams.put(cookieParam.value(), args[i]); } isEntity = (getAnnotation(annotations, Context.class) == null); if (isEntity) { entity = args[i]; } } for (Map.Entry<String, Object> p : queryParams.entrySet()) { uriBuilder.replaceQueryParam(p.getKey(), p.getValue()); } for (Map.Entry<String, Object> p : matrixParams.entrySet()) { uriBuilder.replaceMatrixParam(p.getKey(), p.getValue()); } uri = uriBuilder.buildFromMap(pathParams); Resource resource = restClient.resource(uri); for (Map.Entry<String, Object> p : headerParams.entrySet()) { resource.header(p.getKey(), String.valueOf(p.getValue())); } for (Map.Entry<String, Object> p : cookieParams.entrySet()) { Cookie cookie = new Cookie(p.getKey(), String.valueOf(p.getValue())); resource.cookie(cookie); } resource.contentType(getContentType()); resource.accept(getAccepts()); //handles declarative headers configured on the composite for (HTTPHeader header : binding.getHttpHeaders()) { //treat special headers that need to be calculated if (header.getName().equalsIgnoreCase("Expires")) { GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(new Date()); calendar.add(Calendar.HOUR, Integer.parseInt(header.getValue())); resource.header("Expires", HTTPCacheContext.RFC822DateFormat.format(calendar.getTime())); } else { //default behaviour to pass the header value to HTTP response resource.header(header.getName(), header.getValue()); } } Object result = resource.invoke(httpMethod, responseType, entity); msg.setBody(result); return msg; }
From source file:com.jfootball.dao.hibernate.PlayerDaoImpl.java
public void endSeasonJob() { logger.info("Execute endSeason job"); Session session = hibernateTemplate.getSessionFactory().getCurrentSession(); SessionFactoryImpl sessionFactory = (SessionFactoryImpl) session.getSessionFactory(); try {/*from www . j a v a 2s . c o m*/ Connection conn = sessionFactory.getConnectionProvider().getConnection(); CallableStatement cstmt = conn.prepareCall("{ call endSeasonBatch(?) }"); GregorianCalendar gc = new GregorianCalendar(); gc.setTime(new Date(System.currentTimeMillis())); int year = gc.get(Calendar.YEAR); cstmt.setString("param_year", "30/06/" + year); // current year. cstmt.execute(); logger.info("EndSeason job executed"); } catch (SQLException e) { logger.error(e); } logger.info("EndSeason job finished"); }
From source file:in.gov.uidai.core.aua.client.KYCClient.java
public String kycTrans(Auth auth, String kua, boolean isRcReceived, String ksaLicense, Uses usesElement, String customXML) {//from w ww .j a v a 2 s . c o m setAsaLicenseKey(ksaLicense); String raType = ""; if (usesElement.getBt().contains("FIR") || usesElement.getBt().contains("FMR")) { raType += "F"; } if (usesElement.getBt().contains("IIR")) { raType += "I"; } if (usesElement.getOtp().toString().contains("Y")) { raType += "O"; } if (raType.isEmpty()) raType = "F"; String rcType = "N"; if (isRcReceived) { rcType = "Y"; } try { String signedXML = generateSignedAuthXML(auth); byte[] codedAuthXML = signedXML.getBytes(); Kyc kyc = new Kyc(); kyc.setRa(RaType.valueOf(raType)); kyc.setRc(YesNoType.valueOf(rcType)); kyc.setMec(YesNoType.valueOf(mecType)); kyc.setLr(YesNoType.valueOf(lrType)); kyc.setDe(YesNoType.valueOf(deType)); // kyc.setVer("1.0"); kyc.setVer(ver); if (ver.equals("2.0")) { kyc.setPfr(YesNoType.valueOf(pfr)); } XMLGregorianCalendar calendar = DatatypeFactory.newInstance() .newXMLGregorianCalendar((GregorianCalendar) GregorianCalendar.getInstance()); //kyc.setTs(PidCreator.pidTs.getTs()); //System.out.println("KYC"+PidCreator.pidTs.getTs()); //if(PidCreator.pidTs != null ){ if (PidCreator.threadLocalPidTs.get() != null) { //kyc.setTs(PidCreator.pidTs.getTs()); kyc.setTs(PidCreator.threadLocalPidTs.get().getTs()); } else { SimpleDateFormat dateFormat = new SimpleDateFormat(ISO_8601_DATE_FORMAT); //Date convertedDate = dateFormat.parse(PidCreator.pidBuilderTs.getTs()); Date convertedDate = dateFormat.parse(PidCreator.threadLocalPidBuilderTs.get().getTs()); //System.out.println("convertedDate.toString()== "+convertedDate.toString()); GregorianCalendar gc = (GregorianCalendar) GregorianCalendar.getInstance(); gc.setTime(convertedDate); kyc.setTs(DatatypeFactory.newInstance().newXMLGregorianCalendar(gc)); } kyc.setRad(codedAuthXML); String kycSignedXML; if (StringUtils.isBlank(System.getenv("USE_CUSTOM_KYC_XML"))) { kycSignedXML = generateSignedKycXML(kyc); System.out.println(kycSignedXML); } else { String customKYCXML = customXML; Document kycDOM = XMLUtilities.getDomObject(customKYCXML); XMLUtilities.addRarNode(kycDOM, codedAuthXML); String updatedCustomKYCXML = XMLUtilities.getString(kycDOM); System.out.println(updatedCustomKYCXML); kycSignedXML = generateSignedKycXML(updatedCustomKYCXML); } String uriString = kycServerURI.toString() + (kycServerURI.toString().endsWith("/") ? "" : "/") + kua + "/" + auth.getUid().charAt(0) + "/" + auth.getUid().charAt(1) + SLASH + ksaLicense; String responseXML = HttpClientHelper.postAndGetResponse(uriString, kycSignedXML); System.out.println("\nresp \n" + responseXML); Resp resp1 = (Resp) XMLUtilities.parseXML(Resp.class, responseXML); if (resp1.getStatus().equalsIgnoreCase("-1")) { if (resp1.getKycRes().length == 0) { throw new Exception("KYC response xml retured a status of -1, no content found."); } } byte[] kycRes = resp1.getKycRes(); String xml = ""; if (resp1.getStatus().equalsIgnoreCase("0")) { xml = new String(dataDecryptor.decrypt(kycRes)); // xml = new String(kycRes); // if private key not present } else { xml = new String(kycRes); } System.out.println(" \n xml \n " + xml); if (StringUtils.isBlank(System.getenv("SKIP_RESP_SIG_VERIFY"))) { if (dataDecryptor.verify(xml)) { return xml; } else { throw new Exception("KYC response xml signature verification failed."); } } else { return xml; } } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Exception during KYC transaction " + e.getMessage(), e); } }
From source file:ejava.projects.edmv.bl.DataGen.java
protected ResidenceType createXMLResidence(DMVResidence residence) { ResidenceType xmlResidence = new ResidenceType(); xmlResidence.setResidenceStartDate(new Date()); xmlResidence.setResidenceEndDate(new Date()); GregorianCalendar gDate = new GregorianCalendar(); XMLGregorianCalendar xDate = dtf.newXMLGregorianCalendar(); if (residence.getStartDate() != null) { gDate.setTime(residence.getStartDate()); xDate.setYear(gDate.get(GregorianCalendar.YEAR)); xDate.setMonth(gDate.get(GregorianCalendar.MONTH) + 1); xDate.setDay(gDate.get(GregorianCalendar.DAY_OF_MONTH)); xmlResidence.getResidenceStartDate().setValue(xDate); }/*from w ww . j a va 2s. c o m*/ if (residence.getEndDate() != null) { gDate.setTime(residence.getEndDate()); xDate.setYear(gDate.get(GregorianCalendar.YEAR)); xDate.setMonth(gDate.get(GregorianCalendar.MONTH) + 1); xDate.setDay(gDate.get(GregorianCalendar.DAY_OF_MONTH)); xmlResidence.getResidenceEndDate().setValue(xDate); } if (residence.getLocation() != null) { AddressType address = new AddressType(); address.setLocationStreet(new StreetType()); address.getLocationStreet().setStreetNumberText(new TextType()); address.getLocationStreet().setStreetName(new TextType()); address.setLocationCityName(new TextType()); address.setLocationStateCodeUSPostalService(new USStateCodeType()); address.setLocationPostalCodeID(new IDType()); address.getLocationPostalCodeID().setID(new TextType()); address.getLocationStreet().getStreetNumberText() .setValue(residence.getLocation().getStreetNumber().trim()); address.getLocationStreet().getStreetName().setValue(residence.getLocation().getStreetName().trim()); address.getLocationCityName().setValue(residence.getLocation().getCityName().trim()); address.getLocationStateCodeUSPostalService().setValue(residence.getLocation().getState().trim()); address.getLocationPostalCodeID().getID().setValue(residence.getLocation().getZip().trim()); xmlResidence.setLocationAddress(address); } return xmlResidence; }
From source file:net.kw.shrdlu.grtgtfs.Activities.RiderAlertsActivity.java
/** * Get the latest twitter info. Some of this copied from http://www.vogella.com/articles/AndroidJSON/article.html *///from ww w . j a v a2 s.co m ArrayList<String[]> readTwitterFeed() { final StringBuilder builder = new StringBuilder(); final HttpClient client = new DefaultHttpClient(); final HttpGet httpGet = new HttpGet(TwitterURL + TwitterQry); httpGet.setHeader("Authorization", "Bearer " + AccessToken); try { final HttpResponse response = client.execute(httpGet); final StatusLine statusLine = response.getStatusLine(); final int statusCode = statusLine.getStatusCode(); if (statusCode == 200) { final HttpEntity entity = response.getEntity(); final InputStream content = entity.getContent(); final BufferedReader reader = new BufferedReader(new InputStreamReader(content)); String line; while ((line = reader.readLine()) != null) { builder.append(line); } reader.close(); content.close(); // Result is an array of tweets final JSONArray arr = (JSONArray) new JSONTokener(builder.toString()).nextValue(); final ArrayList<String[]> tweets = new ArrayList<>(); // Need to grok dates of form "created_at": "Thu, 15 Nov 2012 18:27:17 +0000" final SimpleDateFormat dateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss ZZZZZ yyyy"); dateFormat.setLenient(true); for (int i = 0; i < arr.length(); i++) { final String text = arr.getJSONObject(i).get("text").toString(); String tweettime = arr.getJSONObject(i).get("created_at").toString(); // Extract & reformat the date Date created; final GregorianCalendar cal = new GregorianCalendar(); try { created = dateFormat.parse(tweettime); cal.setTime(created); String day, mon; day = cal.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.getDefault()); mon = cal.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.getDefault()); tweettime = String.format("%s %02d:%02d - %s %d", day, cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), mon, cal.get(Calendar.DAY_OF_MONTH)); } catch (final Exception e) { Log.d(TAG, "Exception: " + e.getMessage() + ", parsing tweet date `" + tweettime + "'"); tweettime = "--:--"; } tweets.add(new String[] { tweettime, text }); } return tweets; } else { Log.d(TAG, "Failed to download twitter info"); } } catch (final ClientProtocolException e) { Log.d(TAG, "ClientProtocolException: " + e.getMessage() + ", Failed to download twitter info"); } catch (final IOException e) { Log.d(TAG, "IOException: " + e.getMessage() + ", Failed to download twitter info"); } catch (final Exception e) { Log.d(TAG, "Exception: " + e.getMessage() + ", Failed to download twitter info"); } return null; }
From source file:nl.minbzk.dwr.zoeken.enricher.uploader.SolrResultUploader.java
/** * Determine the database name, based on the composite key, or null if any of the composite key replacements could not be resolved. * * XXX: We only consider the replacement values from the first document given. * * @param name// ww w . jav a 2 s. co m * @param nameComposition * @param namePrerequisitesExpression * @param documents * @return String */ private String determineAlternateDatabaseName(final String name, final String nameComposition, final String namePrerequisitesExpression, final List<SolrInputDocument> documents) { GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(new Date()); String result; result = nameComposition.replace("{name}", name).trim(); result = result.replace("{year}", String.format("%04d", calendar.get(calendar.YEAR))); result = result.replace("{month}", String.format("%02d", calendar.get(calendar.MONTH))); if (documents.size() > 0) { final SolrInputDocument document = documents.get(0); while (result.contains("{") && result.indexOf("}") > result.indexOf("{")) { String fieldName = result.substring(result.indexOf("{") + 1, result.indexOf("}")); if (document.containsKey(fieldName)) result = result.replace("{" + fieldName + "}", document.getFieldValue(fieldName).toString()); else { if (logger.isDebugEnabled()) logger.debug(String.format( "Field '%s' was missing from document with ID '%s' - will revert back to default collection '%s'", fieldName, document.getFieldValue(REFERENCE_FIELD), name)); return null; } } // Also check the pre-requisite expression - only return a composite database name if it's met if (StringUtils.hasText(namePrerequisitesExpression)) { final ExpressionParser parser = new SpelExpressionParser(); final Map<String, Object> values = new HashMap<String, Object>(); for (Map.Entry<String, SolrInputField> entry : document.entrySet()) { // XXX: Always get just the first value /* if (entry.getValue().getValueCount() > 1) values.put(entry.getKey(), entry.getValue().getValues()); else */ values.put(entry.getKey(), entry.getValue().getFirstValue()); } StandardEvaluationContext context = new StandardEvaluationContext(new Object() { public Map<String, Object> getValues() { return values; } }); if (!parser.parseExpression(namePrerequisitesExpression).getValue(context, Boolean.class)) { if (logger.isDebugEnabled()) logger.debug(String.format( "Pre-requisite expression '%s' failed to match against document with ID '%s' - will revert back to default collection '%s'", namePrerequisitesExpression, document.get(REFERENCE_FIELD).toString(), name)); return null; } } } return result; }