List of usage examples for java.util LinkedList size
int size
To view the source code for java.util LinkedList size.
Click Source Link
From source file:controllers.SnLocationsController.java
public static void discoverFsqLocations(String lat, String lng) { String appid = params._contains(PARAM_APPID) ? params.get(PARAM_APPID) : ""; String limit = params._contains(PARAM_LIMIT) ? params.get(PARAM_LIMIT) : ""; limit = verifyRecordLimit(limit);/*from w ww .jav a2 s.c om*/ String radius = params._contains(PARAM_RADIUS) ? params.get(PARAM_RADIUS) : ""; radius = verifyRadius(radius); String herenow = params._contains(PARAM_HERENOW) ? params.get(PARAM_HERENOW) : "true";// by default : true String query = params._contains(PARAM_QUERY) ? params.get(PARAM_QUERY) : ""; Logger.info("PARAMS -> appid:%s ; lat,lng:%s,%s ; radius:%s ; limit:%s ; herenow:%s ; query:%s", appid, lat, lng, radius, limit, herenow, query); ResponseModel responseModel = new ResponseModel(); ResponseMeta responseMeta = new ResponseMeta(); LinkedList<Object> dataList = new LinkedList<Object>(); HashMap params = new HashMap(); String cacheKey = CACHE_KEYPREFIX_NEARBY + "geo:" + lat + "," + lng; if (!StringUtils.isEmpty(limit)) cacheKey += "|" + limit; if (!StringUtils.isEmpty(query)) cacheKey += "|" + query; try { //dataList = (LinkedList<Object>) Cache.get(cacheKey); dataList = Cache.get(cacheKey, LinkedList.class); if (dataList == null) { dataList = new LinkedList<Object>(); params.clear(); if (!StringUtils.isEmpty(lat) && !StringUtils.isEmpty(lng)) params.put("ll", lat + "," + lng); if (!StringUtils.isEmpty(limit)) params.put(PARAM_LIMIT, limit); if (!StringUtils.isEmpty(radius)) params.put(PARAM_RADIUS, radius); /*params.put(PARAM_RADIUS, !StringUtils.isEmpty(radius)? radius :Play.configuration.getProperty("fsqdiscovery.discovery.API_LOCO_SEARCHDISTANCE") );*/ if (!StringUtils.isEmpty(query)) params.put(PARAM_QUERY, query); FoursquareDiscoverPoiJob mFoursquarePoiJob = new FoursquareDiscoverPoiJob(); mFoursquarePoiJob.setReqParams(params); dataList.addAll((LinkedList<Object>) mFoursquarePoiJob.doJobWithResult()); if (dataList.size() > 0) { Logger.info("adding to cache!!! %s", dataList.size()); Cache.set(cacheKey, dataList, CACHE_TTL_NEARBY); } else { Logger.info("NO NEED to cache, dataList.size(): 0"); response.status = Http.StatusCode.OK; responseMeta.code = response.status; responseModel.meta = responseMeta; responseModel.data = dataList; renderJSON(LocoUtils.getGson().toJson(responseModel)); } } else { Logger.info("Found in CACHE!!! %s", dataList.size()); } if ("true".equalsIgnoreCase(herenow)) { // HereNow part params.clear(); FoursquareDiscoverHereNowJob mFoursquareDiscoverHereNowJob = new FoursquareDiscoverHereNowJob(); mFoursquareDiscoverHereNowJob.setReqParams(params); mFoursquareDiscoverHereNowJob.setPoiList(dataList); dataList = new LinkedList<Object>();//dataList.clear(); dataList.addAll((LinkedList<Object>) mFoursquareDiscoverHereNowJob.doJobWithResult()); // remove items which doesn't have any hereNow in it!!! try { PoiModelFoursquare fsqPoi = null; LinkedList<Object> dataListFiltered = new LinkedList<Object>(); for (Object obj : dataList) { fsqPoi = (PoiModelFoursquare) obj; //if (fsqPoi.herenow==null || fsqPoi.herenow.size()==0) dataList.remove(obj); if (fsqPoi.herenow != null && fsqPoi.herenow.size() > 0) dataListFiltered.add(obj); } Logger.info("dataList.size(): %s | dataListFiltered.size(): %s", dataList.size(), dataListFiltered.size()); dataList = new LinkedList<Object>();//dataList.clear(); dataList.addAll(dataListFiltered); } catch (Exception ex) { Logger.warn("exception while filtering out hereNow : %s", ex.toString()); } } else { Logger.info("herenow param is NOT set true, skip loading hereNow!!! herenow: %s", herenow); } response.status = Http.StatusCode.OK; responseMeta.code = response.status; responseModel.meta = responseMeta; responseModel.data = dataList; renderJSON(LocoUtils.getGson().toJson(responseModel)); } catch (Exception ex) { responseMeta.code = Http.StatusCode.INTERNAL_ERROR; gotError(responseMeta, ex); //renderJSON(responseModel); } }
From source file:net.semanticmetadata.lire.solr.FastLireRequestHandler.java
/** * Actual search implementation based on (i) hash based retrieval and (ii) feature based re-ranking. * * @param rsp//from w w w . j ava 2 s.c o m * @param searcher * @param hashFieldName the hash field name * @param maximumHits * @param terms * @param queryFeature * @throws java.io.IOException * @throws IllegalAccessException * @throws InstantiationException */ private void doSearch(SolrQueryRequest req, SolrQueryResponse rsp, SolrIndexSearcher searcher, String hashFieldName, int maximumHits, List<Term> terms, Query query, LireFeature queryFeature) throws IOException, IllegalAccessException, InstantiationException { // temp feature instance LireFeature tmpFeature = queryFeature.getClass().newInstance(); // Taking the time of search for statistical purposes. time = System.currentTimeMillis(); Filter filter = null; // if the request contains a filter: if (req.getParams().get("fq") != null) { // only filters with [<field>:<value> ]+ are supported StringTokenizer st = new StringTokenizer(req.getParams().get("fq"), " "); LinkedList<Term> filterTerms = new LinkedList<Term>(); while (st.hasMoreElements()) { String[] tmpToken = st.nextToken().split(":"); if (tmpToken.length > 1) { filterTerms.add(new Term(tmpToken[0], tmpToken[1])); } } if (filterTerms.size() > 0) filter = new TermsFilter(filterTerms); } TopDocs docs; // with query only. if (filter == null) { docs = searcher.search(query, numberOfCandidateResults); } else { docs = searcher.search(query, filter, numberOfCandidateResults); } // TopDocs docs = searcher.search(query, new TermsFilter(terms), numberOfCandidateResults); // with TermsFilter and boosting by simple query // TopDocs docs = searcher.search(new ConstantScoreQuery(new TermsFilter(terms)), numberOfCandidateResults); // just with TermsFilter time = System.currentTimeMillis() - time; rsp.add("RawDocsCount", docs.scoreDocs.length + ""); rsp.add("RawDocsSearchTime", time + ""); // re-rank time = System.currentTimeMillis(); TreeSet<SimpleResult> resultScoreDocs = new TreeSet<SimpleResult>(); float maxDistance = -1f; float tmpScore; String featureFieldName = FeatureRegistry.getFeatureFieldName(hashFieldName); // iterating and re-ranking the documents. BinaryDocValues binaryValues = MultiDocValues.getBinaryValues(searcher.getIndexReader(), featureFieldName); // *** # BytesRef bytesRef = new BytesRef(); for (int i = 0; i < docs.scoreDocs.length; i++) { // using DocValues to retrieve the field values ... binaryValues.get(docs.scoreDocs[i].doc, bytesRef); tmpFeature.setByteArrayRepresentation(bytesRef.bytes, bytesRef.offset, bytesRef.length); // Getting the document from the index. // This is the slow step based on the field compression of stored fields. // tmpFeature.setByteArrayRepresentation(d.getBinaryValue(name).bytes, d.getBinaryValue(name).offset, d.getBinaryValue(name).length); tmpScore = queryFeature.getDistance(tmpFeature); if (resultScoreDocs.size() < maximumHits) { // todo: There's potential here for a memory saver, think of a clever data structure that can do the trick without creating a new SimpleResult for each result. resultScoreDocs.add( new SimpleResult(tmpScore, searcher.doc(docs.scoreDocs[i].doc), docs.scoreDocs[i].doc)); maxDistance = resultScoreDocs.last().getDistance(); } else if (tmpScore < maxDistance) { // if it is nearer to the sample than at least one of the current set: // remove the last one ... resultScoreDocs.remove(resultScoreDocs.last()); // add the new one ... resultScoreDocs.add( new SimpleResult(tmpScore, searcher.doc(docs.scoreDocs[i].doc), docs.scoreDocs[i].doc)); // and set our new distance border ... maxDistance = resultScoreDocs.last().getDistance(); } } // System.out.println("** Creating response."); time = System.currentTimeMillis() - time; rsp.add("ReRankSearchTime", time + ""); LinkedList list = new LinkedList(); for (Iterator<SimpleResult> it = resultScoreDocs.iterator(); it.hasNext();) { SimpleResult result = it.next(); HashMap m = new HashMap(2); m.put("d", result.getDistance()); // add fields as requested: if (req.getParams().get("fl") == null) { m.put("id", result.getDocument().get("id")); if (result.getDocument().get("title") != null) m.put("title", result.getDocument().get("title")); } else { String fieldsRequested = req.getParams().get("fl"); if (fieldsRequested.contains("score")) { m.put("score", result.getDistance()); } if (fieldsRequested.contains("*")) { // all fields for (IndexableField field : result.getDocument().getFields()) { String tmpField = field.name(); if (result.getDocument().getFields(tmpField).length > 1) { m.put(result.getDocument().getFields(tmpField)[0].name(), result.getDocument().getValues(tmpField)); } else if (result.getDocument().getFields(tmpField).length > 0) { m.put(result.getDocument().getFields(tmpField)[0].name(), result.getDocument().getFields(tmpField)[0].stringValue()); } } } else { StringTokenizer st; if (fieldsRequested.contains(",")) st = new StringTokenizer(fieldsRequested, ","); else st = new StringTokenizer(fieldsRequested, " "); while (st.hasMoreElements()) { String tmpField = st.nextToken(); if (result.getDocument().getFields(tmpField).length > 1) { m.put(result.getDocument().getFields(tmpField)[0].name(), result.getDocument().getValues(tmpField)); } else if (result.getDocument().getFields(tmpField).length > 0) { m.put(result.getDocument().getFields(tmpField)[0].name(), result.getDocument().getFields(tmpField)[0].stringValue()); } } } } // m.put(field, result.getDocument().get(field)); // m.put(field.replace("_ha", "_hi"), result.getDocument().getBinaryValue(field)); list.add(m); } rsp.add("docs", list); // rsp.add("Test-name", "Test-val"); }
From source file:comingle.dragracing.TrackActivity.java
public void renderTrack(LinkedList<Integer> locs) { //decide phone_order for rendering tracks for (int x = 0; x < locs.size(); x++) { if (locs.get(x) == this.getLocation()) { if (x > 0) { initTrack(locs.size() - 1, 1); }/*from www . ja v a 2 s . co m*/ if (x < locs.size() - 1) { initTrack(locs.size() - 1, 0); break; } } } initMarkers(locs); }
From source file:com.ibm.bi.dml.runtime.controlprogram.parfor.opt.PerfTestTool.java
/** * /*w w w. j a v a 2s .c o m*/ * @param dname * @param IDMapping * @throws IOException */ private static void readRegressionModels(String dname, HashMap<Integer, Long> IDMapping) throws IOException { for (Entry<Integer, Long> e : IDMapping.entrySet()) { int count = e.getKey(); long ID = e.getValue(); int instID = IDHandler.extractIntIDFromLong(ID, 1); int tDefID = IDHandler.extractIntIDFromLong(ID, 2); //read file and parse LinkedList<Double> params = new LinkedList<Double>(); CSVReader reader1 = new CSVReader(new FileReader(dname + count + "_out.csv"), ','); String[] nextline = null; while ((nextline = reader1.readNext()) != null) { params.add(Double.parseDouble(nextline[0])); } reader1.close(); double[] dparams = new double[params.size()]; int i = 0; for (Double d : params) { dparams[i] = d; i++; } //create new cost function boolean multidim = _regTestDef.get(tDefID).getInternalVariables().length > 1; CostFunction cf = new CostFunction(dparams, multidim); //append to profile if (!_profile.containsKey(instID)) _profile.put(instID, new HashMap<Integer, CostFunction>()); _profile.get(instID).put(tDefID, cf); } }
From source file:com.epam.reportportal.apache.http.conn.ssl.AbstractVerifier.java
public static String[] getCNs(final X509Certificate cert) { final LinkedList<String> cnList = new LinkedList<String>(); /*/*ww w .j av a2 s . com*/ Sebastian Hauer's original StrictSSLProtocolSocketFactory used getName() and had the following comment: Parses a X.500 distinguished name for the value of the "Common Name" field. This is done a bit sloppy right now and should probably be done a bit more according to <code>RFC 2253</code>. I've noticed that toString() seems to do a better job than getName() on these X500Principal objects, so I'm hoping that addresses Sebastian's concern. For example, getName() gives me this: 1.2.840.113549.1.9.1=#16166a756c6975736461766965734063756362632e636f6d whereas toString() gives me this: EMAILADDRESS=juliusdavies@cucbc.com Looks like toString() even works with non-ascii domain names! I tested it with "花子.co.jp" and it worked fine. */ final String subjectPrincipal = cert.getSubjectX500Principal().toString(); final StringTokenizer st = new StringTokenizer(subjectPrincipal, ",+"); while (st.hasMoreTokens()) { final String tok = st.nextToken().trim(); if (tok.length() > 3) { if (tok.substring(0, 3).equalsIgnoreCase("CN=")) { cnList.add(tok.substring(3)); } } } if (!cnList.isEmpty()) { final String[] cns = new String[cnList.size()]; cnList.toArray(cns); return cns; } else { return null; } }
From source file:com.agimatec.validation.jsr303.ConstraintDefaults.java
private Map<String, Class[]> loadDefaultConstraints(String resource) { Properties constraintProperties = new Properties(); final ClassLoader classloader = getClassLoader(); InputStream stream = classloader.getResourceAsStream(resource); if (stream != null) { try {//w w w . java 2 s .c om constraintProperties.load(stream); } catch (IOException e) { log.error("cannot load " + resource, e); } } else { log.warn("cannot find " + resource); } Map<String, Class[]> loadedConstraints = new HashMap(); for (Map.Entry entry : constraintProperties.entrySet()) { StringTokenizer tokens = new StringTokenizer((String) entry.getValue(), ", "); LinkedList classes = new LinkedList(); while (tokens.hasMoreTokens()) { final String eachClassName = tokens.nextToken(); Class constraintValidatorClass = SecureActions.run(new PrivilegedAction<Class>() { public Class run() { try { return Class.forName(eachClassName, true, classloader); } catch (ClassNotFoundException e) { log.error("Cannot find class " + eachClassName, e); return null; } } }); if (constraintValidatorClass != null) classes.add(constraintValidatorClass); } loadedConstraints.put((String) entry.getKey(), (Class[]) classes.toArray(new Class[classes.size()])); } return loadedConstraints; }
From source file:de.rub.syssec.saaf.Headless.java
/** * Gather APKs for option-case fileList. * You can configure a optional fileList_prefix in saaf.conf. * * @param fileList ASCI-file with multiple paths to APK-files * @return LinkedList of APK-Files *//* w w w. j a va 2 s . c o m*/ private static LinkedList<File> gatherApksFromFileList(File fileList) { LinkedList<File> apks = new LinkedList<File>(); String pathFileListPrefix = CONFIG.getConfigValue(ConfigKeys.FILE_LIST_PREFIX); if (pathFileListPrefix == null) { LOGGER.warn("No 'prefix' directory configured for fileList! If" + "you want to use it, add 'path_fileList_prefix' to" + "saaf.conf."); pathFileListPrefix = ""; } BufferedReader in = null; try { in = new BufferedReader(new FileReader(fileList)); String line = null; while ((line = in.readLine()) != null) { /** * HACK: Every File produced by Microsoft SQL ... Studio, * starts with the non printable Bytes EF BB BF. This is * only a BugFix to destroy these bytes. * * FIXME: Is this sequence on EACH line or only at the first? */ byte[] a = new byte[] { (byte) 0xEF, (byte) 0xBB, (byte) 0xBF }; line = line.replaceAll(new String(a), ""); File pathFileList = new File(pathFileListPrefix + File.separator + line.replace("\\\\", "").replace("\\", File.separator)); if (!pathFileList.isFile() || !pathFileList.canRead()) { LOGGER.error("Skipping non valid file: " + pathFileListPrefix); } else { apks.add(pathFileList); } } } catch (IOException e) { e.printStackTrace(); } finally { if (in != null) { try { in.close(); } catch (Exception ignored) { } } } LOGGER.info("Read " + apks.size() + " files from FileList " + fileList); return apks; }
From source file:edu.umd.cs.guitar.ripper.Ripper.java
/** * Rip a component/* www. j a va 2 s . c om*/ * * As of now this method does not propagate exceptions. * It needs to be modified to progate exceptions. All callers * need to be modified to handle exceptions. * * <p> * * @param component * @return */ public ComponentType ripComponent(GComponent component, GWindow window) { GUITARLog.log.info(""); GUITARLog.log.info("----------------------------------"); GUITARLog.log.info("Ripping component: "); GUITARLog.log.info("Signature: "); printComponentInfo(component, window); // 1. Rip special/customized components for (GComponentFilter cm : lComponentFilter) { if (cm.isProcess(component, window)) { GUITARLog.log.info("Filter " + cm.getClass().getSimpleName() + " is applied"); return cm.ripComponent(component, window); } } // 2. Rip regular components ComponentType retComp = null; try { retComp = component.extractProperties(); ComponentTypeWrapper compA = new ComponentTypeWrapper(retComp); if (useImage) { String sUUID = null; try { sUUID = captureImage(component); } catch (AWTException e) { // Ignore AWTException. sUUID is null. } catch (IOException e) { throw e; } if (sUUID != null) { compA.addProperty(GUITARConstants.UUID_TAG_NAME, sUUID); } } GUIType guiType = null; if (window != null) { guiType = window.extractGUIProperties(); } retComp = compA.getDComponentType(); // 2.1 Try to perform action on the component // to reveal more windows/components // clear window opened cache before performing actions monitor.resetWindowCache(); if (monitor.isExpandable(component, window)) { monitor.expandGUI(component); } else { GUITARLog.log.info("Component is Unexpandable"); } // Trigger terminal widget LinkedList<GWindow> lClosedWindows = monitor.getClosedWindowCache(); String sTitle = window.getTitle(); if (lClosedWindows.size() > 0) { GUITARLog.log.debug("!!!!! Window closed"); for (GWindow closedWin : lClosedWindows) { String sClosedWinTitle = closedWin.getTitle(); // Only consider widget closing the current window if (sTitle.equals(sClosedWinTitle)) { GUITARLog.log.debug("\t" + sClosedWinTitle); List<FullComponentType> lCloseComp = lCloseWindowComp.getFullComponent(); FullComponentType cCloseComp = factory.createFullComponentType(); cCloseComp.setWindow(closedWin.extractWindow().getWindow()); cCloseComp.setComponent(retComp); lCloseComp.add(cCloseComp); lCloseWindowComp.setFullComponent(lCloseComp); } // if } // for } // if if (monitor.isNewWindowOpened()) { List<FullComponentType> lOpenComp = lOpenWindowComps.getFullComponent(); FullComponentType cOpenComp = factory.createFullComponentType(); cOpenComp.setWindow(window.extractWindow().getWindow()); cOpenComp.setComponent(retComp); lOpenComp.add(cOpenComp); lOpenWindowComps.setFullComponent(lOpenComp); LinkedList<GWindow> lNewWindows = monitor.getOpenedWindowCache(); monitor.resetWindowCache(); GUITARLog.log.info(lNewWindows.size() + " new window(s) opened!!!"); for (GWindow newWins : lNewWindows) { GUITARLog.log.info("*\t Title:*" + newWins.getTitle() + "*"); } // Process the opened windows in a FIFO order while (!lNewWindows.isEmpty()) { GWindow gNewWin = lNewWindows.getLast(); lNewWindows.removeLast(); GComponent gWinComp = gNewWin.getContainer(); if (gWinComp != null) { // Add invokelist property for the component String sWindowTitle = gNewWin.getTitle(); compA = new ComponentTypeWrapper(retComp); compA.addValueByName(GUITARConstants.INVOKELIST_TAG_NAME, sWindowTitle); GUITARLog.log.debug(sWindowTitle + " recorded"); retComp = compA.getDComponentType(); // Check ignore window if (!monitor.isIgnoredWindow(gNewWin)) { if (!monitor.isRippedWindow(gNewWin)) { gNewWin.setRoot(false); monitor.addRippedList(gNewWin); GUIType dWindow = ripWindow(gNewWin); if (dWindow != null) dGUIStructure.getGUI().add(dWindow); } else { GUITARLog.log.info("Window is ripped!!!"); } } else { GUITARLog.log.info("Window is ignored!!!"); } } monitor.closeWindow(gNewWin); } } // TODO: check if the component is still available after ripping // its child window List<GComponent> gChildrenList = component.getChildren(); int nChildren = gChildrenList.size(); int i = 0; // Debug String lChildren = "["; for (int j = 0; j < nChildren; j++) { lChildren += gChildrenList.get(j).getTitle() + " - " + gChildrenList.get(j).getClassVal() + "; "; } lChildren += "]"; GUITARLog.log.debug("*" + component.getTitle() + "* in window *" + window.getTitle() + "* has " + nChildren + " children: " + lChildren); // End debug while (i < nChildren) { GComponent gChild = gChildrenList.get(i++); ComponentType guiChild = ripComponent(gChild, window); if (guiChild != null) { ((ContainerType) retComp).getContents().getWidgetOrContainer().add(guiChild); } if (nChildren < gChildrenList.size()) { nChildren = gChildrenList.size(); } } } catch (Exception e) { if (e.getClass().getName().contains("StaleElementReferenceException")) { /** * This can happen when performing an action causes a page * navigation in the current window, for example, when * submitting a form. */ GUITARLog.log.warn("Element went away: " + e.getMessage()); } else { // TODO: Must throw exception GUITARLog.log.error("ripComponent exception", e); } /** * We'll return the component we calculated anyway so it * gets added to the GUI map. I'm not entirely sure this * is the right thing to do, but it gets us further anyway. */ return retComp; } return retComp; }
From source file:gov.nih.nci.ncicb.cadsr.ocbrowser.struts.actions.ObjectClassRelationshipAction.java
/** * * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. * * @return//w w w. ja v a2 s .c om * * @throws IOException * @throws ServletException */ public ActionForward navigateOCR(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { DynaActionForm dynaForm = (DynaActionForm) form; String obcIdSeq = (String) dynaForm.get(OC_IDSEQ); String ocrIndex = (String) dynaForm.get(OCR_INDEX); String direction = (String) dynaForm.get(OCR_DIRECTION); Integer crumbsIndex = (Integer) dynaForm.get(OCR_BR_CRUMBS_INDEX); if (log.isDebugEnabled()) { log.info("ocr for With object class " + obcIdSeq); log.info("ocr index " + ocrIndex); log.info("direction " + direction); } try { //Get ocr navigation crumbs LinkedList crumbs = (LinkedList) getSessionObject(request, OCR_NAVIGATION_BEAN); if (crumbs == null) { crumbs = new LinkedList(); setSessionObject(request, OCR_NAVIGATION_BEAN, crumbs, true); } if (crumbs.isEmpty()) { OCRNavigationBean bean = new OCRNavigationBean(); ObjectClass currObjectClass = (ObjectClass) getSessionObject(request, OBJECT_CLASS); bean.setObjectClass(currObjectClass); crumbs.add(bean); } else { //Set the OCR_NAVIGATION_BEAN to current navigation path int currSize = crumbs.size(); int currIndex = crumbsIndex.intValue(); boolean nodesRemoved = false; for (int i = currIndex; i < currSize - 1; ++i) { crumbs.removeLast(); nodesRemoved = true; } if (nodesRemoved) { OCRNavigationBean newLastNavBean = (OCRNavigationBean) crumbs.getLast(); newLastNavBean.setOcr(null); newLastNavBean.setShowDirection(false); } } OCRNavigationBean lastNavBean = (OCRNavigationBean) crumbs.getLast(); //Make sure same object is not navigated // need review if (lastNavBean.getObjectClass().getId() != obcIdSeq) { //get the list of ocrs depending on the direction clicked List oldList = (List) getSessionObject(request, direction); ObjectClassRelationship navigatedOCR = (ObjectClassRelationship) oldList .get(Integer.parseInt(ocrIndex)); OCBrowserService service = this.getApplicationServiceLocator().findOCBrowserService(); ObjectClass objClass = service.getObjectClass(obcIdSeq); List ocrs = service.getAssociationsForOC(obcIdSeq); //Set the current OCRID dynaForm.set(CURR_OCR_IDSEQ, navigatedOCR.getId()); Map ocrMap = OCUtils.sortByOCRTypes(ocrs, obcIdSeq); setSessionObject(request, OBJECT_CLASS, objClass, true); setSessionObject(request, OUT_GOING_OCRS, ocrMap.get(OUT_GOING_OCRS), true); setSessionObject(request, IN_COMMING_OCRS, ocrMap.get(IN_COMMING_OCRS), true); setSessionObject(request, BIDIRECTIONAL_OCRS, ocrMap.get(BIDIRECTIONAL_OCRS), true); //Update old bean lastNavBean.setOcr(navigatedOCR); lastNavBean.setDirection(direction); lastNavBean.setShowDirection(true); //Add new link OCRNavigationBean bean = new OCRNavigationBean(); bean.setObjectClass(objClass); crumbs.add(bean); //set the crumbs index dynaForm.set(OCR_BR_CRUMBS_INDEX, new Integer(crumbs.size() - 1)); } } catch (ServiceLocatorException exp) { if (log.isErrorEnabled()) { log.error("Exception on getObjectClassRelationships obid= " + obcIdSeq); } return mapping.findForward(FAILURE); } return mapping.findForward(SUCCESS); }
From source file:vn.chodientu.component.imboclient.ImboClient.java
/** * Parse server host URLs and prepare them for usage * * @param hosts URLs for the Imbo server * @return Array of URLs// w w w . j av a2s. c om */ private String[] parseUrls(String[] hosts) { LinkedList<String> urls = new LinkedList<String>(); for (String host : hosts) { host = normalizeUrl(host); if (host != null && !urls.contains(host)) { urls.add(host); } } return urls.toArray(new String[urls.size()]); }