List of usage examples for java.lang String compareToIgnoreCase
public int compareToIgnoreCase(String str)
From source file:otmobile.FirstScreen.java
public void onTakePictureClick(View view) { //First check the Camera permissions if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) { //Permission is OK // Use a separate HashMap to hold non-TakePicture parameter values from preferences. HashMap<String, Object> appParams = new HashMap<>(); // Obtain our picture parameters from the preferences. Only supported SDK keys should go into parameters. HashMap<String, Object> parameters = CoreHelper.getTakePictureParametersFromPrefs(this, appParams); // Get the preference for CaptureWindow SharedPreferences gprefs = PreferenceManager.getDefaultSharedPreferences(this); String capWndNone = CoreHelper.getStringResource(this, R.string.GPREF_CAPTURE_CUSTOM_OPTIONS_NONE); String capWndPref = gprefs.getString( CoreHelper.getStringResource(this, R.string.GPREF_CAPTURE_CUSTOM_OPTIONS), capWndNone); if (capWndPref.compareToIgnoreCase(capWndNone) != 0) { // Assign a custom CaptureWindow if specified by the prefs. CaptureWindow wnd = new CustomWindow(this, capWndPref, appParams); parameters.put(CaptureImage.PICTURE_CAPTUREWINDOW, wnd); } else if ((boolean) appParams.get(USE_QUADVIEW)) { CaptureWindow wnd = new CustomWindow(this, capWndPref, appParams); parameters.put(CaptureImage.PICTURE_CAPTUREWINDOW, wnd); }//from w w w .ja v a 2 s. co m // Launch the camera to take a picture. CaptureImage.takePicture(this, parameters); } else { //Request Permission requestCameraPermission(); } }
From source file:com.limewoodmedia.nsdroid.services.UpdateService.java
@Override protected void onHandleIntent(Intent intent) { // Check//from ww w . ja v a2 s .co m Log.d(TAG, "Checking for update for: " + intent.getStringExtra("update")); // Check for Internet connection final ConnectivityManager conMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo activeNetwork = conMgr.getActiveNetworkInfo(); if (activeNetwork == null || !activeNetwork.isConnected()) { Log.d(TAG, "No network connection"); return; } boolean showNotification = false; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); // Check a shard for updates if (intent.getStringExtra("API").equalsIgnoreCase("region")) { // Check region shards RegionData rData; if (intent.getStringExtra("region").equalsIgnoreCase("-1")) { if (intent.getStringExtra("shard").equalsIgnoreCase("messages")) { // Check for new messages try { rData = API.getInstance(this).getRegionInfo(NationInfo.getInstance(this).getRegionId(), RegionData.Shards.MESSAGES); } catch (RateLimitReachedException e) { e.printStackTrace(); return; } catch (UnknownRegionException e) { e.printStackTrace(); return; } catch (XmlPullParserException e) { e.printStackTrace(); return; } catch (IOException e) { e.printStackTrace(); return; } if (rData.messages != null && rData.messages.size() > 0) { RMBMessage msg = rData.messages.get(rData.messages.size() - 1); long lastTS = prefs.getLong("update_region_messages_timestamp", -1); String lastNation = prefs.getString("update_region_messages_nation", ""); if (lastTS != msg.timestamp && lastNation.compareToIgnoreCase(msg.message) != 0) { // There are new messages Log.d(TAG, "New messages!"); if (Region.shouldUpdate || NSDroid.shouldUpdate) { // Send broadcast to update RMB directly Intent i = new Intent(NotificationsHelper.RMB_UPDATE_ACTION); RMBMessageParcelable[] parcel = new RMBMessageParcelable[rData.messages.size()]; int t = 0; for (RMBMessage m : rData.messages) { parcel[t] = new RMBMessageParcelable(m); t++; } i.putExtra("com.limewoodMedia.nsdroid.holders.RMBMessageParcelable", parcel); sendBroadcast(i); if (NSDroid.shouldUpdate) { showNotification = true; } } else { // Not currently showing showNotification = true; } } else { // No new messages - set new alarm NotificationsHelper.setAlarmForRMB(this, Integer.parseInt(prefs.getString("rmb_update_interval", "-1"))); } } } } } else if (intent.getStringExtra("API").equalsIgnoreCase("issues")) { // Issues IssuesInfo issues = API.getInstance(this).getIssues(); Log.d(TAG, "Issues: " + issues); if (issues != null) { if (issues.issues != null && issues.issues.size() > 0) { Log.d(TAG, "Issues: " + issues.issues.size()); intent.putExtra("notification_number", issues.issues.size()); showNotification = true; } if (issues.nextIssue != null) { Log.d(TAG, "Issues: " + issues.nextIssue); NotificationsHelper.setIssuesTimer(this, issues.nextIssue); } } } if (showNotification) { // Show notification icon Intent i; try { // Start activity with class name i = new Intent(this, Class.forName(intent.getStringExtra("class"))); if (intent.hasExtra("page")) { i.putExtra("page", intent.getIntExtra("page", 0)); } Log.d(TAG, "Build notification to update " + intent.getStringExtra("class")); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent pi = PendingIntent.getActivity(this, intent.getIntExtra("notification_id", NOTIFICATION_ID), i, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder notifyBuilder = new NotificationCompat.Builder(this) .setContentTitle(getResources() .getString(intent.getIntExtra("notification_title", R.string.notification_title))) .setContentText(getResources() .getString(intent.getIntExtra("notification_text", R.string.notification_text))) .setSmallIcon(R.drawable.app_icon).setAutoCancel(true).setContentIntent(pi) .setOnlyAlertOnce(false).setWhen(System.currentTimeMillis()); if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("notify_sound", true) && intent.hasExtra("notification_sound")) { notifyBuilder.setSound(Uri.parse("android.resource://" + getPackageName() + "/" + intent.getIntExtra("notification_sound", -1))); } if (intent.hasExtra("notification_number")) { notifyBuilder.setNumber(intent.getIntExtra("notification_number", 0)).setShowWhen(false); } Log.d(TAG, "Show notification"); notificationManager.notify(intent.getIntExtra("notification_id", NOTIFICATION_ID), notifyBuilder.getNotification()); } catch (ClassNotFoundException e) { e.printStackTrace(); } } }
From source file:org.gbif.portal.webservices.actions.NetworkAction.java
/** * Gets a Resource network according to the parameters given * //w ww . j av a 2 s.c om * @param params * @return The Resource and the count (1) * @throws GbifWebServiceException */ @SuppressWarnings("unchecked") public Map<String, Object> getNetworkRecord(NetworkParameters params) throws GbifWebServiceException { Map<String, Object> results = new HashMap<String, Object>(); Map<String, String> headerMap; Map<String, String> parameterMap; Map<String, String> summaryMap = null; headerMap = returnHeader(params, true); parameterMap = returnParameters(params.getParameterMap(null)); Map<ResourceNetworkDTO, Map<String, String>> resourceNetworks = new HashMap<ResourceNetworkDTO, Map<String, String>>(); try { ResourceNetworkDTO dto = dataResourceManager.getResourceNetworkFor(params.getKey()); List<ResourceNetworkDTO> set = new ArrayList<ResourceNetworkDTO>(); set.add(dto); summaryMap = returnSummary(params, set, true); List<DataResourceDTO> resources = dataResourceManager.getDataResourcesForResourceNetwork(dto.getKey()); Map<String, String> drMap = new TreeMap<String, String>(new Comparator() { public int compare(Object a, Object b) { String dataResourceName1 = (String) a; String dataResourceName2 = (String) b; return dataResourceName1.compareToIgnoreCase(dataResourceName2); } }); //build a data resource map for each of the resource networks for (DataResourceDTO dr : resources) { drMap.put(dr.getName(), dr.getKey()); } resourceNetworks.put(dto, drMap); results.put("results", resourceNetworks); results.put("count", 1); results.put("headerMap", headerMap); results.put("parameterMap", parameterMap); results.put("summaryMap", summaryMap); return results; } catch (ServiceException se) { log.error("Data service error: " + se.getMessage(), se); throw new GbifWebServiceException("Data service problems - " + se.getMessage()); } catch (Exception se) { log.error("Data service error: " + se.getMessage(), se); throw new GbifWebServiceException("Data service problems - " + se.toString()); } }
From source file:org.apache.synapse.transport.passthru.ClientWorker.java
public ClientWorker(TargetConfiguration targetConfiguration, MessageContext outMsgCtx, TargetResponse response) {/*from www . j a v a 2s . c o m*/ this.targetConfiguration = targetConfiguration; this.response = response; this.expectEntityBody = response.isExpectResponseBody(); Map<String, String> headers = response.getHeaders(); Map excessHeaders = response.getExcessHeaders(); String oriURL = headers.get(PassThroughConstants.LOCATION); if (outMsgCtx.getProperty(PassThroughConstants.PASS_THROUGH_SOURCE_CONNECTION) != null) { ((NHttpServerConnection) outMsgCtx.getProperty(PassThroughConstants.PASS_THROUGH_SOURCE_CONNECTION)) .getContext() .setAttribute(PassThroughConstants.CLIENT_WORKER_INIT_TIME, System.currentTimeMillis()); } // Special casing 301, 302, 303 and 307 scenario in following section. Not sure whether it's the correct fix, // but this fix makes it possible to do http --> https redirection. if (oriURL != null && ((response.getStatus() != HttpStatus.SC_MOVED_TEMPORARILY) && (response.getStatus() != HttpStatus.SC_MOVED_PERMANENTLY) && (response.getStatus() != HttpStatus.SC_CREATED) && (response.getStatus() != HttpStatus.SC_SEE_OTHER) && (response.getStatus() != HttpStatus.SC_TEMPORARY_REDIRECT) && !targetConfiguration.isPreserveHttpHeader(PassThroughConstants.LOCATION))) { URL url; String urlContext = null; try { url = new URL(oriURL); urlContext = url.getFile(); } catch (MalformedURLException e) { //Fix ESBJAVA-3461 - In the case when relative path is sent should be handled if (log.isDebugEnabled()) { log.debug("Relative URL received for Location : " + oriURL, e); } urlContext = oriURL; } headers.remove(PassThroughConstants.LOCATION); String prfix = (String) outMsgCtx.getProperty(PassThroughConstants.SERVICE_PREFIX); if (prfix != null) { if (urlContext != null && urlContext.startsWith("/")) { //Remove the preceding '/' character urlContext = urlContext.substring(1); } headers.put(PassThroughConstants.LOCATION, prfix + urlContext); } } try { responseMsgCtx = outMsgCtx.getOperationContext().getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN); // fix for RM to work because of a soapAction and wsaAction conflict if (responseMsgCtx != null) { responseMsgCtx.setSoapAction(""); } } catch (AxisFault af) { log.error("Error getting IN message context from the operation context", af); return; } if (responseMsgCtx == null) { if (outMsgCtx.getOperationContext().isComplete()) { if (log.isDebugEnabled()) { log.debug("Error getting IN message context from the operation context. " + "Possibly an RM terminate sequence message"); } return; } responseMsgCtx = new MessageContext(); responseMsgCtx.setOperationContext(outMsgCtx.getOperationContext()); } responseMsgCtx.setProperty("PRE_LOCATION_HEADER", oriURL); // copy the important properties from the original message context responseMsgCtx.setProperty(PassThroughConstants.PASS_THROUGH_SOURCE_CONNECTION, outMsgCtx.getProperty(PassThroughConstants.PASS_THROUGH_SOURCE_CONNECTION)); responseMsgCtx.setProperty(PassThroughConstants.PASS_THROUGH_SOURCE_CONFIGURATION, outMsgCtx.getProperty(PassThroughConstants.PASS_THROUGH_SOURCE_CONFIGURATION)); responseMsgCtx.setServerSide(true); responseMsgCtx.setDoingREST(outMsgCtx.isDoingREST()); responseMsgCtx.setProperty(MessageContext.TRANSPORT_IN, outMsgCtx.getProperty(MessageContext.TRANSPORT_IN)); responseMsgCtx.setTransportIn(outMsgCtx.getTransportIn()); responseMsgCtx.setTransportOut(outMsgCtx.getTransportOut()); //setting the responseMsgCtx PassThroughConstants.INVOKED_REST property to the one set inside PassThroughTransportUtils responseMsgCtx.setProperty(PassThroughConstants.INVOKED_REST, outMsgCtx.isDoingREST()); // set any transport headers received Set<Map.Entry<String, String>> headerEntries = response.getHeaders().entrySet(); Map<String, String> headerMap = new TreeMap<String, String>(new Comparator<String>() { public int compare(String o1, String o2) { return o1.compareToIgnoreCase(o2); } }); for (Map.Entry<String, String> headerEntry : headerEntries) { headerMap.put(headerEntry.getKey(), headerEntry.getValue()); } responseMsgCtx.setProperty(MessageContext.TRANSPORT_HEADERS, headerMap); responseMsgCtx.setProperty(NhttpConstants.EXCESS_TRANSPORT_HEADERS, excessHeaders); if (response.getStatus() == 202) { responseMsgCtx.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE); responseMsgCtx.setProperty(PassThroughConstants.MESSAGE_BUILDER_INVOKED, Boolean.FALSE); responseMsgCtx.setProperty(NhttpConstants.SC_ACCEPTED, Boolean.TRUE); } responseMsgCtx.setAxisMessage(outMsgCtx.getOperationContext().getAxisOperation() .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE)); responseMsgCtx.setOperationContext(outMsgCtx.getOperationContext()); responseMsgCtx.setConfigurationContext(outMsgCtx.getConfigurationContext()); responseMsgCtx.setTo(null); responseMsgCtx.setProperty(PassThroughConstants.PASS_THROUGH_PIPE, response.getPipe()); responseMsgCtx.setProperty(PassThroughConstants.PASS_THROUGH_TARGET_RESPONSE, response); responseMsgCtx.setProperty(PassThroughConstants.PASS_THROUGH_TARGET_CONNECTION, response.getConnection()); }
From source file:at.gv.egovernment.moa.id.auth.servlet.VerifyCertificateServlet.java
/** * Gets the signer certificate from the InfoboxReadRequest and * responds with a new //from ww w. j av a 2 s . com * <code>CreateXMLSignatureRequest</code>. * <br> * Request parameters: * <ul> * <li>MOASessionID: ID of associated authentication session</li> * <li>XMLResponse: <code><InfoboxReadResponse></code></li> * </ul> * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest, HttpServletResponse) */ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Logger.debug("POST VerifyCertificateServlet"); Logger.warn(getClass().getName() + " is deprecated and should not be used any more."); resp.setHeader(MOAIDAuthConstants.HEADER_EXPIRES, MOAIDAuthConstants.HEADER_VALUE_EXPIRES); resp.setHeader(MOAIDAuthConstants.HEADER_PRAGMA, MOAIDAuthConstants.HEADER_VALUE_PRAGMA); resp.setHeader(MOAIDAuthConstants.HEADER_CACHE_CONTROL, MOAIDAuthConstants.HEADER_VALUE_CACHE_CONTROL); resp.addHeader(MOAIDAuthConstants.HEADER_CACHE_CONTROL, MOAIDAuthConstants.HEADER_VALUE_CACHE_CONTROL_IE); String pendingRequestID = null; Map<String, String> parameters; try { parameters = getParameters(req); } catch (FileUploadException e) { Logger.error("Parsing mulitpart/form-data request parameters failed: " + e.getMessage()); throw new IOException(e.getMessage()); } String sessionID = req.getParameter(PARAM_SESSIONID); // escape parameter strings sessionID = StringEscapeUtils.escapeHtml(sessionID); pendingRequestID = AuthenticationSessionStoreage.getPendingRequestID(sessionID); AuthenticationSession session = null; try { // check parameter if (!ParamValidatorUtils.isValidSessionID(sessionID)) throw new WrongParametersException("VerifyCertificate", PARAM_SESSIONID, "auth.12"); session = AuthenticationServer.getSession(sessionID); //change MOASessionID sessionID = AuthenticationSessionStoreage.changeSessionID(session); X509Certificate cert = AuthenticationServer.getInstance().getCertificate(sessionID, parameters); if (cert == null) { Logger.error("Certificate could not be read."); throw new AuthenticationException("auth.14", null); } boolean useMandate = session.getUseMandate(); if (useMandate) { // verify certificate for OrganWalter String createXMLSignatureRequestOrRedirect = AuthenticationServer.getInstance() .verifyCertificate(session, cert); try { AuthenticationSessionStoreage.storeSession(session); } catch (MOADatabaseException e) { throw new MOAIDException("session store error", null); } ServletUtils.writeCreateXMLSignatureRequestOrRedirect(resp, session, createXMLSignatureRequestOrRedirect, AuthenticationServer.REQ_PROCESS_VALIDATOR_INPUT, "VerifyCertificate"); } else { String countrycode = CertificateUtils.getIssuerCountry(cert); if (countrycode != null) { if (countrycode.compareToIgnoreCase("AT") == 0) { Logger.error( "Certificate issuer country code is \"AT\". Login not support in foreign identities mode."); throw new AuthenticationException("auth.22", null); } } // Foreign Identities Modus String createXMLSignatureRequest = AuthenticationServer.getInstance() .createXMLSignatureRequestForeignID(session, cert); // build dataurl (to the GetForeignIDSerlvet) String dataurl = new DataURLBuilder().buildDataURL(session.getAuthURL(), REQ_GET_FOREIGN_ID, session.getSessionID()); try { AuthenticationSessionStoreage.storeSession(session); } catch (MOADatabaseException e) { throw new MOAIDException("session store error", null); } ServletUtils.writeCreateXMLSignatureRequest(resp, createXMLSignatureRequest, AuthenticationServer.REQ_PROCESS_VALIDATOR_INPUT, "GetForeignID", dataurl); Logger.debug("Send CreateXMLSignatureRequest to BKU"); } } catch (MOAIDException ex) { handleError(null, ex, req, resp, pendingRequestID); } catch (Exception e) { Logger.error("CertificateValidation has an interal Error.", e); } finally { ConfigurationDBUtils.closeSession(); } }
From source file:com.cubusmail.server.mail.util.MessageComparator.java
public int compare(Message msg1, Message msg2) { int result = 0; if (msg1.isExpunged() || msg2.isExpunged()) { return result; }/*from w w w. j av a2 s . c om*/ try { if (MessageListFields.SUBJECT == this.field) { if (msg1.getSubject() != null && msg2.getSubject() != null) { result = msg1.getSubject().compareToIgnoreCase(msg2.getSubject()); } else { result = -1; } } else if (MessageListFields.FROM == this.field) { String fromString1 = MessageUtils.getMailAdressString(msg1.getFrom(), AddressStringType.PERSONAL); String fromString2 = MessageUtils.getMailAdressString(msg2.getFrom(), AddressStringType.PERSONAL); if (fromString1 != null && fromString2 != null) { result = fromString1.compareToIgnoreCase(fromString2); } else { result = -1; } } else if (MessageListFields.SEND_DATE == this.field) { Date date1 = msg1.getSentDate(); Date date2 = msg2.getSentDate(); if (date1 != null && date2 != null) { result = date1.compareTo(date2); } else { result = -1; } } else if (MessageListFields.SIZE == this.field) { int size1 = msg1.getSize(); int size2 = msg2.getSize(); result = Integer.valueOf(size1).compareTo(Integer.valueOf(size2)); } } catch (MessagingException e) { log.warn(e.getMessage(), e); } if (!this.ascending) { result = result * (-1); } return result; }
From source file:com.swordlord.gozer.databinding.DataBindingMember.java
private String resolveTableName(LinkedList<DataBindingElement> elements, String strTableName) { // if there are no elements or only one, then this element must be the table name if ((elements == null) || (elements.size() <= 1)) { return strTableName; }/* w w w . jav a 2s .c o m*/ // otherwise walk the references to find the table ObjEntity parentTable = DBConnection.instance().getObjectContext().getEntityResolver() .getObjEntity(strTableName); for (DataBindingElement element : elements) { if (!element.isField()) { String strPathElement = element.getPathElement(); LOG.debug("TableName/PatheElement=" + strTableName + "/" + strPathElement); // ignore the same level if (strPathElement.compareToIgnoreCase(strTableName) != 0) { ObjRelationship rel = (ObjRelationship) parentTable.getRelationship(strPathElement); parentTable = (ObjEntity) rel.getTargetEntity(); } } } return parentTable.getName(); }
From source file:at.gv.egovernment.moa.id.auth.servlet.GetMISSessionIDServlet.java
/** * Gets the signer certificate from the InfoboxReadRequest and responds with * a new <code>CreateXMLSignatureRequest</code>. <br> * Request parameters:/*ww w .ja v a 2 s. c o m*/ * <ul> * <li>MOASessionID: ID of associated authentication session</li> * <li>XMLResponse: <code><InfoboxReadResponse></code></li> * </ul> * * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest, * HttpServletResponse) */ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Logger.debug("POST GetMISSessionIDServlet"); Logger.warn(getClass().getName() + " is deprecated and should not be used any more."); resp.setHeader(MOAIDAuthConstants.HEADER_EXPIRES, MOAIDAuthConstants.HEADER_VALUE_EXPIRES); resp.setHeader(MOAIDAuthConstants.HEADER_PRAGMA, MOAIDAuthConstants.HEADER_VALUE_PRAGMA); resp.setHeader(MOAIDAuthConstants.HEADER_CACHE_CONTROL, MOAIDAuthConstants.HEADER_VALUE_CACHE_CONTROL); resp.addHeader(MOAIDAuthConstants.HEADER_CACHE_CONTROL, MOAIDAuthConstants.HEADER_VALUE_CACHE_CONTROL_IE); // Map parameters; // try // { // parameters = getParameters(req); // } catch (FileUploadException e) // { // Logger.error("Parsing mulitpart/form-data request parameters failed: " // + e.getMessage()); // throw new IOException(e.getMessage()); // } String sessionID = req.getParameter(PARAM_SESSIONID); // escape parameter strings sessionID = StringEscapeUtils.escapeHtml(sessionID); AuthenticationSession session = null; String pendingRequestID = null; try { // check parameter if (!ParamValidatorUtils.isValidSessionID(sessionID)) throw new WrongParametersException("VerifyCertificate", PARAM_SESSIONID, "auth.12"); pendingRequestID = AuthenticationSessionStoreage.getPendingRequestID(sessionID); session = AuthenticationServer.getSession(sessionID); //change MOASessionID sessionID = AuthenticationSessionStoreage.changeSessionID(session); String misSessionID = session.getMISSessionID(); AuthConfigurationProvider authConf = AuthConfigurationProvider.getInstance(); ConnectionParameter connectionParameters = authConf.getOnlineMandatesConnectionParameter(); SSLSocketFactory sslFactory = SSLUtils.getSSLSocketFactory(AuthConfigurationProvider.getInstance(), connectionParameters); List<MISMandate> list = MISSimpleClient.sendGetMandatesRequest(connectionParameters.getUrl(), misSessionID, sslFactory); if (list == null || list.size() == 0) { Logger.error("Keine Vollmacht gefunden."); throw new AuthenticationException("auth.15", null); } // for now: list contains only one element MISMandate mandate = (MISMandate) list.get(0); // TODO[tlenz]: UTF-8 ? String sMandate = new String(mandate.getMandate()); if (sMandate == null || sMandate.compareToIgnoreCase("") == 0) { Logger.error("Mandate is empty."); throw new AuthenticationException("auth.15", new Object[] { GET_MIS_SESSIONID }); } //check if it is a parsable XML byte[] byteMandate = mandate.getMandate(); // TODO[tlenz]: UTF-8 ? String stringMandate = new String(byteMandate); DOMUtils.parseDocument(stringMandate, false, null, null).getDocumentElement(); // extract RepresentationType AuthenticationServer.getInstance().verifyMandate(session, mandate); session.setMISMandate(mandate); session.setAuthenticatedUsed(false); session.setAuthenticated(true); //set QAA Level four in case of card authentifcation session.setQAALevel(PVPConstants.STORK_QAA_1_4); String oldsessionID = session.getSessionID(); //Session is implicite stored in changeSessionID!!! String newMOASessionID = AuthenticationSessionStoreage.changeSessionID(session); Logger.info("Changed MOASession " + oldsessionID + " to Session " + newMOASessionID); Logger.info("Daten angelegt zu MOASession " + newMOASessionID); String redirectURL = new DataURLBuilder().buildDataURL(session.getAuthURL(), ModulUtils.buildAuthURL(session.getModul(), session.getAction(), pendingRequestID), newMOASessionID); redirectURL = resp.encodeRedirectURL(redirectURL); resp.setContentType("text/html"); resp.setStatus(302); resp.addHeader("Location", redirectURL); Logger.debug("REDIRECT TO: " + redirectURL); } catch (MOAIDException ex) { handleError(null, ex, req, resp, pendingRequestID); } catch (GeneralSecurityException ex) { handleError(null, ex, req, resp, pendingRequestID); } catch (PKIException e) { handleError(null, e, req, resp, pendingRequestID); } catch (SAXException e) { handleError(null, e, req, resp, pendingRequestID); } catch (ParserConfigurationException e) { handleError(null, e, req, resp, pendingRequestID); } catch (Exception e) { Logger.error("MISMandateValidation has an interal Error.", e); } finally { ConfigurationDBUtils.closeSession(); } }
From source file:gov.nih.nci.evs.browser.utils.SimpleSearchUtils.java
public ResolvedConceptReferencesIteratorWrapper search(Vector<String> schemes, Vector<String> versions, String matchText, String algorithm, String target) throws LBException { if (algorithm == null || target == null) return null; if (algorithm.compareToIgnoreCase(EXACT_MATCH) == 0 && target.compareToIgnoreCase(CODES) == 0) { return search(schemes, versions, matchText, BY_CODE, "exactMatch"); } else if (algorithm.compareToIgnoreCase(LUCENE) == 0 && target.compareToIgnoreCase(CODES) == 0) { return search(schemes, versions, matchText, BY_CODE, "exactMatch"); } else if (algorithm.compareToIgnoreCase(LUCENE) == 0 && target.compareToIgnoreCase(NAMES) == 0) { return search(schemes, versions, matchText, BY_NAME, "lucene"); } else if (algorithm.compareToIgnoreCase(CONTAINS) == 0 && target.compareToIgnoreCase(NAMES) == 0) { return search(schemes, versions, matchText, BY_NAME, "contains"); }//from w ww . ja v a 2 s.c o m return null; }
From source file:org.gbif.portal.webservices.actions.NetworkAction.java
/** * Finds Resource networks for the given parameters * //from w w w.j av a 2s . co m * @param params * @return A map with the list of the resource networks and the count of them * @throws GbifWebServiceException */ @SuppressWarnings("unchecked") public Map<String, Object> findNetworkRecords(NetworkParameters params) throws GbifWebServiceException { Map<String, Object> results = new HashMap<String, Object>(); SearchResultsDTO searchResultsDTO = null; Map<ResourceNetworkDTO, Map<String, String>> resourceNetworks = new TreeMap<ResourceNetworkDTO, Map<String, String>>( new Comparator() { public int compare(Object a, Object b) { ResourceNetworkDTO resourceNetwork1 = (ResourceNetworkDTO) a; ResourceNetworkDTO resourceNetwork2 = (ResourceNetworkDTO) b; return resourceNetwork1.getName().compareToIgnoreCase(resourceNetwork2.getName()); } }); Map<String, String> headerMap; Map<String, String> parameterMap; Map<String, String> summaryMap; headerMap = returnHeader(params, true); parameterMap = returnParameters(params.getParameterMap(null)); List<ResourceNetworkDTO> list = null; try { searchResultsDTO = dataResourceManager.findResourceNetworks(params.getName(), true, params.getCode(), params.getModifiedSince(), params.getSearchConstraints()); list = (List<ResourceNetworkDTO>) searchResultsDTO.getResults(); summaryMap = returnSummary(params, list, true); //iterate over all the data resources for this resource network, add each data resource map to the resource network map for (ResourceNetworkDTO rn : list) { List<DataResourceDTO> resources = dataResourceManager .getDataResourcesForResourceNetwork(rn.getKey()); Map<String, String> drMap = new TreeMap<String, String>(new Comparator() { public int compare(Object a, Object b) { String dataResourceName1 = (String) a; String dataResourceName2 = (String) b; return dataResourceName1.compareToIgnoreCase(dataResourceName2); } }); //build a data resource map for each of the resource networks for (DataResourceDTO dr : resources) { if (dr != null) drMap.put(dr.getName(), dr.getKey()); } resourceNetworks.put(rn, drMap); } results.put("results", resourceNetworks); results.put("count", resourceNetworks.size()); results.put("headerMap", headerMap); results.put("parameterMap", parameterMap); results.put("summaryMap", summaryMap); return results; } catch (ServiceException se) { log.error("Unregistered data service error: " + se.getMessage(), se); throw new GbifWebServiceException("Data service problems - " + se.getMessage()); } catch (Exception se) { log.error("Data service error: " + se.getMessage(), se); throw new GbifWebServiceException("Data service problems - " + se.toString()); } }