Java Code Examples for java.util.List
The following examples show how to use
java.util.List. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: DETA_BackEnd Source File: LoginDAOImpl.java License: Apache License 2.0 | 9 votes |
@SuppressWarnings("unchecked") public static Usr selectUsrByUEmail(String uEmail) throws IOException { String json = DetaDBUtil.DBRequest("/selectRowsByAttribute?baseName=" + "backend" + "&tableName=" + "usr" + "&culumnName=" + URLEncoder.encode("u_email") + "&value=" + URLEncoder.encode(uEmail) + "&email=" + URLEncoder.encode("[email protected]") + "&password=" + URLEncoder.encode("Fengyue1985!") + "&auth=" + "0"); Map<String, Object> map = (Map<String, Object>) new VtoV().JsonObjectToMap(new JSONObject(json)); List<Map<String, Object>> list = (List<Map<String, Object>>) map.get("obj"); Usr usr = new Usr(); if(list.size() > 0) { usr.setuAddress(list.get(0).get("u_address")!=null?list.get(0).get("u_address").toString():""); usr.setuAge(Integer.valueOf(list.get(0).get("u_age")!=null?list.get(0).get("u_age").toString():"0")); usr.setuClass(list.get(0).get("u_class")!=null?list.get(0).get("u_class").toString():""); usr.setuEmail(list.get(0).get("u_email").toString()); usr.setuId(Integer.valueOf(list.get(0).get("u_id").toString())); usr.setuName(list.get(0).get("u_name").toString()); usr.setuPhone(list.get(0).get("u_phone")!=null?list.get(0).get("u_phone").toString():""); usr.setuQq(list.get(0).get("u_qq")!=null?list.get(0).get("u_qq").toString():""); usr.setuSex(list.get(0).get("u_sex")!=null?list.get(0).get("u_sex").toString():""); usr.setuWeChat(list.get(0).get("u_weChat")!=null?list.get(0).get("u_weChat").toString():""); } return usr; }
Example 2
Source Project: o2oa Source File: StatisticUnitForDayFactory.java License: GNU Affero General Public License v3.0 | 7 votes |
public List<String> listByUnitDayDate(String name, String date) throws Exception { if (name == null || name.isEmpty()) { logger.error(new UnitNamesEmptyException()); return null; } EntityManager em = this.entityManagerContainer().get(StatisticUnitForDay.class); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<String> cq = cb.createQuery(String.class); Root<StatisticUnitForDay> root = cq.from(StatisticUnitForDay.class); Predicate p = cb.equal(root.get(StatisticUnitForDay_.unitName), name); if (date == null || date.isEmpty()) { logger.error(new StatisticDateEmptyException()); } else { p = cb.and(p, cb.equal(root.get(StatisticUnitForDay_.statisticDate), date)); } cq.select(root.get(StatisticUnitForDay_.id)); return em.createQuery(cq.where(p)).setMaxResults(62).getResultList(); }
Example 3
Source Project: PdfBox-Android Source File: LineTo.java License: Apache License 2.0 | 6 votes |
@Override public void process(Operator operator, List<COSBase> operands) throws IOException { // append straight line segment from the current point to the point COSNumber x = (COSNumber) operands.get(0); COSNumber y = (COSNumber) operands.get(1); PointF pos = context.transformedPoint(x.floatValue(), y.floatValue()); if (context.getCurrentPoint() == null) { Log.w("PdfBox-Android", "LineTo (" + pos.x + "," + pos.y + ") without initial MoveTo"); context.moveTo(pos.x, pos.y); } else { context.lineTo(pos.x, pos.y); } }
Example 4
Source Project: AppAuth-Android Source File: RegistrationRequest.java License: Apache License 2.0 | 6 votes |
private RegistrationRequest( @NonNull AuthorizationServiceConfiguration configuration, @NonNull List<Uri> redirectUris, @Nullable List<String> responseTypes, @Nullable List<String> grantTypes, @Nullable String subjectType, @Nullable String tokenEndpointAuthenticationMethod, @NonNull Map<String, String> additionalParameters) { this.configuration = configuration; this.redirectUris = redirectUris; this.responseTypes = responseTypes; this.grantTypes = grantTypes; this.subjectType = subjectType; this.tokenEndpointAuthenticationMethod = tokenEndpointAuthenticationMethod; this.additionalParameters = additionalParameters; this.applicationType = APPLICATION_TYPE_NATIVE; }
Example 5
Source Project: s3ninja Source File: APILog.java License: MIT License | 6 votes |
/** * Returns a sublist of the stored entries, starting at <tt>start</tt> returning at most <tt>count</tt> items. * * @param start index of the item where to start * @param count max number of items returned * @return a non null list of log entries */ public List<Entry> getEntries(int start, int count) { List<Entry> result = Lists.newArrayList(); int index = start; int itemsToReturn = count; synchronized (entries) { Iterator<Entry> iter = entries.iterator(); while (iter.hasNext() && index > 0) { iter.next(); index--; } while (iter.hasNext() && itemsToReturn > 0) { result.add(iter.next()); itemsToReturn--; } } return result; }
Example 6
Source Project: java-microservices-examples Source File: CustomAuditEventRepositoryIT.java License: Apache License 2.0 | 6 votes |
@Test public void addAuditEvent() { Map<String, Object> data = new HashMap<>(); data.put("test-key", "test-value"); AuditEvent event = new AuditEvent("test-user", "test-type", data); customAuditEventRepository.add(event); List<PersistentAuditEvent> persistentAuditEvents = persistenceAuditEventRepository.findAll(); assertThat(persistentAuditEvents).hasSize(1); PersistentAuditEvent persistentAuditEvent = persistentAuditEvents.get(0); assertThat(persistentAuditEvent.getPrincipal()).isEqualTo(event.getPrincipal()); assertThat(persistentAuditEvent.getAuditEventType()).isEqualTo(event.getType()); assertThat(persistentAuditEvent.getData()).containsKey("test-key"); assertThat(persistentAuditEvent.getData().get("test-key")).isEqualTo("test-value"); assertThat(persistentAuditEvent.getAuditEventDate().truncatedTo(ChronoUnit.MILLIS)) .isEqualTo(event.getTimestamp().truncatedTo(ChronoUnit.MILLIS)); }
Example 7
Source Project: openjdk-jdk8u Source File: TestG1.java License: GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { WhiteBox.setWriteAllObjectSamples(true); try (Recording r = new Recording()) { r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity"); r.start(); allocateFindMe(); System.gc(); r.stop(); List<RecordedEvent> events = Events.fromRecording(r); System.out.println(events); if (OldObjects.countMatchingEvents(events, FindMe[].class, null, null, -1, "allocateFindMe") == 0) { throw new Exception("Could not find leak with " + FindMe[].class); } } }
Example 8
Source Project: olingo-odata2 Source File: RestUtilTest.java License: Apache License 2.0 | 6 votes |
@Test public void testExtractAcceptHeaders() throws Exception { // NuGet 4.0 client under .NET List<String> result = RestUtil.extractAcceptHeaders("application/atom+xml, application/xml"); Assert.assertEquals(2, result.size()); Assert.assertEquals("application/atom+xml", result.get(0)); Assert.assertEquals("application/xml", result.get(1)); // NuGet 4.0 client under Mono result = RestUtil.extractAcceptHeaders("application/atom+xml, application/xml"); Assert.assertEquals(2, result.size()); Assert.assertEquals("application/atom+xml", result.get(0)); Assert.assertEquals("application/xml", result.get(1)); // Chrome 56 result = RestUtil.extractAcceptHeaders( "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"); Assert.assertEquals(5, result.size()); Assert.assertEquals("text/html", result.get(0)); Assert.assertEquals("application/xhtml+xml", result.get(1)); Assert.assertEquals("application/xml", result.get(2)); Assert.assertEquals("image/webp", result.get(3)); Assert.assertEquals("*/*", result.get(4)); }
Example 9
Source Project: redesocial Source File: TiposAtividadesControle.java License: MIT License | 5 votes |
private void listar(HttpServletRequest request, HttpServletResponse response) throws Exception { try { TiposAtividadesBO bo = new TiposAtividadesBO(); List tiposAtividades = bo.listar(); request.setAttribute("lista", tiposAtividades); } catch (Exception ex){ request.setAttribute("erro", ex.getMessage()); } RequestDispatcher rd = request.getRequestDispatcher("paginas/listagemTA.jsp"); rd.forward(request, response); }
Example 10
Source Project: consulo Source File: DesktopAsyncDataContext.java License: Apache License 2.0 | 5 votes |
DesktopAsyncDataContext(DesktopDataManagerImpl dataManager, DataContext syncContext) { super(dataManager, syncContext.getData(PlatformDataKeys.CONTEXT_COMPONENT)); ApplicationManager.getApplication().assertIsDispatchThread(); Component component = getData(PlatformDataKeys.CONTEXT_COMPONENT); List<Component> hierarchy = JBIterable.generate(component, Component::getParent).toList(); for (Component each : hierarchy) { myProviders.get(each); } myHierarchy = ContainerUtil.map(hierarchy, WeakReference::new); }
Example 11
Source Project: skywalking Source File: InterceptorTest.java License: Apache License 2.0 | 5 votes |
@Test public void assertProxyRootInvoke() { proxyRootInvokeInterceptor.beforeMethod(null, null, null, null, null); proxyRootInvokeInterceptor.afterMethod(null, null, null, null, null); assertThat(segmentStorage.getTraceSegments().size(), is(1)); TraceSegment segment = segmentStorage.getTraceSegments().get(0); List<AbstractTracingSpan> spans = SegmentHelper.getSpans(segment); assertNotNull(spans); assertThat(spans.size(), is(1)); assertThat(spans.get(0).getOperationName(), is("/ShardingSphere/ProxyRootInvoke/")); }
Example 12
Source Project: sakai Source File: ChatManagerImpl.java License: Educational Community License v2.0 | 5 votes |
/********************************************************************************************************************************************************************************************************************************************************** * getSummary implementation *********************************************************************************************************************************************************************************************************************************************************/ public Map<String,String> getSummary(String channel, int items, int days) throws IdUsedException, IdInvalidException, PermissionException { long startTime = System.currentTimeMillis() - (days * 24l * 60l * 60l * 1000l); List<ChatMessage> messages = getChannelMessages(getChatChannel(channel), new Date(startTime), 0, items, true); Iterator<ChatMessage> iMsg = messages.iterator(); ZonedDateTime pubDate = null; String summaryText = null; Map<String,String> m = new HashMap<String,String>(); Locale locale = rl.getLocale(); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss Z").withLocale(locale); while (iMsg.hasNext()) { ChatMessage item = iMsg.next(); //MessageHeader header = item.getHeader(); ZonedDateTime newTime = ZonedDateTime.ofInstant(item.getMessageDate().toInstant(), ZoneId.of(getUserTimeZone())); if ( pubDate == null || newTime.isBefore(pubDate) ) pubDate = newTime; try { String newText = getSummaryFromHeader(item); if ( summaryText == null ) { summaryText = newText; } else { summaryText = summaryText + "<br>\r\n" + newText; } } catch (UserNotDefinedException e) { log.warn("Skipping the chat message for user: " + item.getOwner() + " since they cannot be found"); } } if ( pubDate != null ) { m.put(Summary.PROP_PUBDATE, pubDate.format(dtf)); } if ( summaryText != null ) { m.put(Summary.PROP_DESCRIPTION, summaryText); return m; } return null; }
Example 13
Source Project: lams Source File: FilterHelper.java License: GNU General Public License v2.0 | 5 votes |
/** * The map of defined filters. This is expected to be in format * where the filter names are the map keys, and the defined * conditions are the values. * * @param filters The map of defined filters. * @param factory The session factory */ public FilterHelper(List<FilterConfiguration> filters, SessionFactoryImplementor factory) { int filterCount = filters.size(); filterNames = new String[filterCount]; filterConditions = new String[filterCount]; filterAutoAliasFlags = new boolean[filterCount]; filterAliasTableMaps = new Map[filterCount]; filterCount = 0; for ( final FilterConfiguration filter : filters ) { filterAutoAliasFlags[filterCount] = false; filterNames[filterCount] = filter.getName(); filterConditions[filterCount] = filter.getCondition(); filterAliasTableMaps[filterCount] = filter.getAliasTableMap( factory ); if ( ( filterAliasTableMaps[filterCount].isEmpty() || isTableFromPersistentClass( filterAliasTableMaps[filterCount] ) ) && filter .useAutoAliasInjection() ) { filterConditions[filterCount] = Template.renderWhereStringTemplate( filter.getCondition(), FilterImpl.MARKER, factory.getDialect(), factory.getSqlFunctionRegistry() ); filterAutoAliasFlags[filterCount] = true; } filterConditions[filterCount] = StringHelper.replace( filterConditions[filterCount], ":", ":" + filterNames[filterCount] + "." ); filterCount++; } }
Example 14
Source Project: swblocks-decisiontree Source File: Input.java License: Apache License 2.0 | 5 votes |
private Input(final String ruleSetName, final List<WeightedDriver> drivers, final List<String> searchValues, final Map<String, String> evaluations, final Instant evaluationDate) { this.ruleSetName = ruleSetName; this.evaluationDate = evaluationDate; this.driverList = drivers; this.driverMap = new TreeMap<>(); this.evaluationMap = evaluations; int counter = 0; for (final WeightedDriver weightedDriver : drivers) { driverMap.put(weightedDriver, searchValues.get(counter)); ++counter; } }
Example 15
Source Project: morphia Source File: UnsetCodec.java License: Apache License 2.0 | 5 votes |
@Override protected void encodeStage(final BsonWriter writer, final Unset value, final EncoderContext encoderContext) { List<Expression> fields = value.getFields(); if (fields.size() == 1) { fields.get(0).encode(getMapper(), writer, encoderContext); } else if(fields.size()> 1) { Codec codec = getCodecRegistry().get(fields.getClass()); encoderContext.encodeWithChildContext(codec, writer, fields); } }
Example 16
Source Project: zstack Source File: VipTestValidator.java License: Apache License 2.0 | 5 votes |
public static void validateWithoutCheckOwnerEthernetMac(List<VipTO> actual, VipInventory expected) { for (VipTO to : actual) { if (compareWithoutCheckOwnerEthernetMac(to, expected)) { return; } } StringBuilder sb = new StringBuilder(); sb.append("\n========================== Can't find VIP ====================="); sb.append(String.format("\nexpected: \n%s", JSONObjectUtil.toJsonString(expected))); sb.append(String.format("\nactual: \n%s", JSONObjectUtil.toJsonString(actual))); sb.append("\n==============================================================="); logger.warn(sb.toString()); Assert.fail(); }
Example 17
Source Project: jpx Source File: GPX.java License: Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private static GPX toGPXv10(final Object[] v) { return new GPX( (Version)v[0], (String)v[1], Metadata.of( (String)v[2], (String)v[3], Person.of( (String)v[4], v[5] != null ? Email.of((String)v[5]) : null, v[6] != null ? Link.of((String)v[6], (String)v[7], null) : null ), null, null, (ZonedDateTime)v[8], (String)v[9], (Bounds)v[10] ), (List<WayPoint>)v[11], (List<Route>)v[12], (List<Track>)v[13], XML.extensions((Document)v[14]) ); }
Example 18
Source Project: carbon-commons Source File: InMemorySubscriptionStorage.java License: Apache License 2.0 | 5 votes |
public List<Subscription> getMatchingSubscriptions(String topicName) { topicName = getTopicName(topicName); List<Subscription> subscriptions = new ArrayList(); List<String> matchingTopicNames = getTopicMatchingNames(topicName); for (String matchingTopicName : matchingTopicNames){ if (this.topicSubscriptionMap.get(matchingTopicName) != null){ subscriptions.addAll(this.topicSubscriptionMap.get(matchingTopicName).values()); } } return subscriptions; }
Example 19
Source Project: xtext-core Source File: ParserTest.java License: Eclipse Public License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Test public void testParseWithVectorAndComment() throws Exception { String model = "a.b.c.d # (1/*comment*/2);"; EObject parsedModel = getModel(model); assertNotNull(parsedModel); EObject firstModel = ((List<EObject>) parsedModel.eGet(modelFeature)).get(0); assertTrue(firstModel.eIsSet(vectorFeature)); String vector = (String) firstModel.eGet(vectorFeature); assertNotNull(vector); assertEquals("(1 2)", vector); }
Example 20
Source Project: org.hl7.fhir.core Source File: JavaResourceGenerator.java License: Apache License 2.0 | 5 votes |
private boolean hasString(List<ElementDefinition> list) { for (ElementDefinition e : list) { if (isDefinedInThisClass(e)) { if (Utilities.existsInList(e.typeSummary(), "string", "id", "code", "uri", "oid", "uuid", "url", "canonical")) return true; } } return false; }
Example 21
Source Project: botsing Source File: BotsingMojo.java License: Apache License 2.0 | 5 votes |
private void addChildDependencies(DependencyNode node, List<Artifact> list) { List<DependencyNode> children = node.getChildren(); if (children != null) { for (DependencyNode child : children) { list.add(child.getArtifact()); addChildDependencies(child, list); } } }
Example 22
Source Project: flowable-engine Source File: RepetitionRuleTest.java License: Apache License 2.0 | 5 votes |
@Test @CmmnDeployment public void testRepeatingStage() { CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder().caseDefinitionKey("testRepeatingStage").start(); List<Task> tasks = cmmnTaskService.createTaskQuery().caseInstanceId(caseInstance.getId()).orderByTaskName().asc().list(); assertThat(tasks) .extracting(Task::getName) .containsExactly("A", "Task outside stage"); // Stage is repeated 3 times for (int i = 0; i < 3; i++) { cmmnTaskService.complete(tasks.get(0).getId()); // Completing A will make B and C active tasks = cmmnTaskService.createTaskQuery().caseInstanceId(caseInstance.getId()).orderByTaskName().asc().list(); assertThat(tasks) .extracting(Task::getName) .containsExactly("B", "C", "Task outside stage"); // Completing B and C should lead to a repetition of the stage cmmnTaskService.complete(tasks.get(0).getId()); // B cmmnTaskService.complete(tasks.get(1).getId()); // C tasks = cmmnTaskService.createTaskQuery().caseInstanceId(caseInstance.getId()).orderByTaskName().asc().list(); } Task task = cmmnTaskService.createTaskQuery().caseInstanceId(caseInstance.getId()).singleResult(); assertThat(task.getName()).isEqualTo("Task outside stage"); cmmnTaskService.complete(task.getId()); assertCaseInstanceEnded(caseInstance); }
Example 23
Source Project: freehealth-connector Source File: ProfessionV3.java License: GNU Affero General Public License v3.0 | 5 votes |
public List<Speciality> getSpecialities() { if (this.specialities == null) { this.specialities = new ArrayList(); } return this.specialities; }
Example 24
Source Project: tickmate Source File: DataSource.java License: GNU General Public License v3.0 | 5 votes |
public boolean removeLastTickOfDay(Track track, Calendar date) { open(); List<Tick> ticks = getTicksForDay(track, date); if (ticks.size() == 0) return false; Tick tick = ticks.get(ticks.size()-1); String[] args = { Integer.toString(track.getId()), Integer.toString(tick.tick_id) }; int affectedRows = database.delete(DatabaseOpenHelper.TABLE_TICKS, DatabaseOpenHelper.COLUMN_TRACK_ID +"=? AND " + DatabaseOpenHelper.COLUMN_ID +"=?", args); Log.d("Tickmate", "delete " + affectedRows + "rows at " + tick.date.get(Calendar.YEAR) + " " + tick.date.get(Calendar.MONTH) + " " + tick.date.get(Calendar.DAY_OF_MONTH) + " - " + tick.date.get(Calendar.HOUR_OF_DAY) + ":" + tick.date.get(Calendar.MINUTE) + ":" + tick.date.get(Calendar.SECOND)); close(); if (affectedRows > 0) return true; return false; }
Example 25
Source Project: swaggy-jenkins Source File: RemoteAccessApiTest.java License: MIT License | 5 votes |
@Before public void setup() { JacksonJsonProvider provider = new JacksonJsonProvider(); List providers = new ArrayList(); providers.add(provider); api = JAXRSClientFactory.create("http://localhost", RemoteAccessApi.class, providers); org.apache.cxf.jaxrs.client.Client client = WebClient.client(api); ClientConfiguration config = WebClient.getConfig(client); }
Example 26
Source Project: pandora Source File: SPFragment.java License: Apache License 2.0 | 5 votes |
private void loadData() { Map<String, String> contents = Pandora.get().getSharedPref().getSharedPrefContent(descriptor); if (contents != null && !contents.isEmpty()) { List<BaseItem> data = new ArrayList<>(); data.add(new TitleItem(String.format(Locale.getDefault(), "%d ITEMS", contents.size()))); data.add(new KeyValueItem(new String[]{"KEY", "VALUE"}, true)); for (Map.Entry<String, String> entry : contents.entrySet()) { data.add(new KeyValueItem(new String[]{entry.getKey(), entry.getValue()}, false, true)); } getAdapter().setItems(data); } else { showError(null); } }
Example 27
Source Project: birt Source File: DEUtil.java License: Eclipse Public License 1.0 | 5 votes |
public static Object getInputFirstElement( Object input ) { if ( input instanceof GroupElementHandle ) { return ( (GroupElementHandle) input ).getElements( ).get( 0 ); } else if ( input instanceof List ) { return ( (List) input ).get( 0 ); } else return input; }
Example 28
Source Project: kfs Source File: TemProfileFromKimLookupableHelperServiceImpl.java License: GNU Affero General Public License v3.0 | 5 votes |
/** * @see org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl#getSearchResults(java.util.Map) */ @Override public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues) { List<TemProfileFromKimPerson> searchResults = new ArrayList<TemProfileFromKimPerson>(); //final Map<String, String> kimFieldsForLookup = fieldValues; final Map<String, String> kimFieldsForLookup = getPersonFieldValues(fieldValues); LOG.debug("Looking up people with criteria " + kimFieldsForLookup); final List<? extends Person> persons = personService.findPeople(kimFieldsForLookup); for (Person personDetail : persons) { if (!StringUtils.isBlank(personDetail.getPrincipalId())) { searchResults.add(travelerService.convertToTemProfileFromKim(personDetail)); } } CollectionIncomplete results = new CollectionIncomplete(searchResults, Long.valueOf(searchResults.size())); // sort list if default sort column given List<String> defaultSortColumns = getDefaultSortColumns(); if (defaultSortColumns.size() > 0) { Collections.sort(results, new BeanPropertyComparator(defaultSortColumns, true)); } return results; }
Example 29
Source Project: pentaho-kettle Source File: JobEntryDeleteFile.java License: Apache License 2.0 | 5 votes |
public List<ResourceReference> getResourceDependencies( JobMeta jobMeta ) { List<ResourceReference> references = super.getResourceDependencies( jobMeta ); if ( !Utils.isEmpty( filename ) ) { String realFileName = jobMeta.environmentSubstitute( filename ); ResourceReference reference = new ResourceReference( this ); reference.getEntries().add( new ResourceEntry( realFileName, ResourceType.FILE ) ); references.add( reference ); } return references; }
Example 30
Source Project: YTS Source File: MoviesAdapter.java License: MIT License | 5 votes |
public void updateData(List<BaseMovie.Movie> movieList, boolean newList) { if (newList) { DiffUtil.DiffResult result = DiffUtil.calculateDiff( new MoviesDiffCallback(this.movieList, movieList) ); this.movieList.clear(); result.dispatchUpdatesTo(this); } this.movieList.addAll(movieList); if (!newList) notifyItemRangeInserted(getItemCount(), this.movieList.size() - 1); }