java.util.List Java Examples
The following examples show how to use
java.util.List.
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 File: LoginDAOImpl.java From DETA_BackEnd with 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 File: StatisticUnitForDayFactory.java From o2oa with 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 File: APILog.java From s3ninja with MIT License | 7 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 #4
Source File: LineTo.java From PdfBox-Android with Apache License 2.0 | 7 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 #5
Source File: RestUtilTest.java From olingo-odata2 with 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 #6
Source File: TestG1.java From openjdk-jdk8u with 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 #7
Source File: CustomAuditEventRepositoryIT.java From java-microservices-examples with 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 #8
Source File: RegistrationRequest.java From AppAuth-Android with 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 #9
Source File: ParserTest.java From xtext-core with 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 #10
Source File: BuildVisitor.java From Arend with Apache License 2.0 | 5 votes |
@Override public Concrete.Pattern visitPatternID(PatternIDContext ctx) { Position position = tokenPosition(ctx.start); List<String> longName = visitLongNamePath(ctx.longName()); return longName.size() == 1 ? new Concrete.NamePattern(position, true, new ParsedLocalReferable(position, longName.get(0)), null) : new Concrete.ConstructorPattern(position, true, LongUnresolvedReference.make(position, longName), Collections.emptyList(), Collections.emptyList()); }
Example #11
Source File: InMemorySubscriptionStorage.java From carbon-commons with 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 #12
Source File: QueryOperationTest.java From aws-sdk-java-v2 with Apache License 2.0 | 5 votes |
@Test public void transformResults_multipleItems_returnsCorrectItems() { List<FakeItem> queryResultItems = generateFakeItemList(); List<Map<String, AttributeValue>> queryResultMaps = queryResultItems.stream().map(QueryOperationTest::getAttributeValueMap).collect(toList()); QueryResponse queryResponse = generateFakeQueryResults(queryResultMaps); Page<FakeItem> queryResultPage = queryOperation.transformResponse(queryResponse, FakeItem.getTableSchema(), PRIMARY_CONTEXT, null); assertThat(queryResultPage.items(), is(queryResultItems)); }
Example #13
Source File: InterceptorTest.java From skywalking with 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 #14
Source File: VipTestValidator.java From zstack with 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 #15
Source File: FileDescriptor.java From servicetalk with Apache License 2.0 | 5 votes |
private void addMessageTypes(final List<DescriptorProto> messageTypes, @Nullable String parentProtoScope, @Nullable String parentJavaScope, final Map<String, ClassName> messageTypesMap) { messageTypes.forEach(t -> { final String protoTypeName = (parentProtoScope != null ? parentProtoScope : "") + '.' + t.getName(); final String javaClassName = parentJavaScope + '.' + t.getName(); messageTypesMap.put(protoTypeName, ClassName.bestGuess(javaClassName)); addMessageTypes(t.getNestedTypeList(), protoTypeName, javaClassName, messageTypesMap); }); }
Example #16
Source File: Input.java From swblocks-decisiontree with 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 #17
Source File: UnsetCodec.java From morphia with 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 #18
Source File: FilterHelper.java From lams with 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 #19
Source File: JavaResourceGenerator.java From org.hl7.fhir.core with 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 #20
Source File: BotsingMojo.java From botsing with 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 #21
Source File: TiposAtividadesControle.java From redesocial with 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 #22
Source File: RepetitionRuleTest.java From flowable-engine with 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 File: ProfessionV3.java From freehealth-connector with 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 File: MoviesAdapter.java From YTS with 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); }
Example #25
Source File: DataSource.java From tickmate with 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 #26
Source File: JobEntryDeleteFile.java From pentaho-kettle with 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 #27
Source File: RemoteAccessApiTest.java From swaggy-jenkins with 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 #28
Source File: SPFragment.java From pandora with 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 #29
Source File: DEUtil.java From birt with 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 #30
Source File: TemProfileFromKimLookupableHelperServiceImpl.java From kfs with 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; }