• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ObjectSelect类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.cayenne.query.ObjectSelect的典型用法代码示例。如果您正苦于以下问题:Java ObjectSelect类的具体用法?Java ObjectSelect怎么用?Java ObjectSelect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ObjectSelect类属于org.apache.cayenne.query包,在下文中一共展示了ObjectSelect类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: performShowConcept

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
private void performShowConcept(String line) {
	Matcher m = Pattern.compile("s (\\d*)").matcher(line);
	if (m.matches()) {
		try {
			long conceptId = Long.parseLong(m.group(1));
			ObjectContext context = cayenne.get().newContext();
			Concept c = ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(conceptId)).selectOne(context);
			if (c != null) {
				setCurrentConcept(c);
				printConcept(c, false);
			}
			else {
				System.err.println("No concept found with identifier: "+conceptId);
			}
		}
		catch (NumberFormatException e) {
			System.err.println("Invalid concept identifier");
		}
	}
	if ("s".equalsIgnoreCase(line.trim()) && currentConcept() != null) {
		printConcept(currentConcept(), true);
	}
}
 
开发者ID:wardle,项目名称:rsterminology,代码行数:24,代码来源:Browser.java


示例2: update

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
@Override
void update(Description d, String[] csv) {
	d.setDescriptionId(descriptionId(csv));
	ObjectSelect<Concept> query = ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(conceptId(csv)));
	Concept c = query.selectOne(d.getObjectContext());
	if (c != null ) {
		d.setConcept(c);
		d.setDescriptionStatusCode(descriptionStatus(csv));
		d.setDescriptionTypeCode(descriptionType(csv));
		d.setInitialCapitalStatus(initialCapitalStatus(csv));
		d.setLanguageCode(languageCode(csv));
		d.setTerm(term(csv));
	}
	else {
		System.err.println("No concept found for description : "+descriptionId(csv) + ":" + term(csv) + ". ConceptId=" + conceptId(csv));
		d.getObjectContext().deleteObject(d);
	}
}
 
开发者ID:wardle,项目名称:rsterminology,代码行数:19,代码来源:ParseRf1.java


示例3: timingForRecursiveParents

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
private void timingForRecursiveParents(ObjectContext context, long conceptId) {
	// try method 1, fetch concept and then fetch recursive parents
	long startTime = System.nanoTime();
	Concept ms1 = ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(26078007L)).selectOne(context);
	List<Long> parents = ParentCache.fetchRecursiveParentsForConcept(context, 26078007L);
	long duration = (System.nanoTime() - startTime) / 1000000;
	System.out.println("Time taken for fetch and then fetch: " + duration + " ms");		

	startTime = System.nanoTime();
	// try method 2, fetch concept and prefetch parents from cache in database
	ObjectSelect<Concept> q = ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(26078007L));
	q.prefetch(Concept.RECURSIVE_PARENT_CONCEPTS.joint());
	Concept ms = context.selectFirst(q);
	Set<Long> parents2 = ms.getCachedRecursiveParents();
	duration = (System.nanoTime() - startTime) / 1000000;
	System.out.println("Time taken for fetch with prefetch " + duration + " ms");		

	// are methods equivalent?  this may fail if database is inconsistent
	// assertTrue(parents2.equals(new HashSet<Long>(parents)));
}
 
开发者ID:wardle,项目名称:rsterminology,代码行数:21,代码来源:TestSnomedCt.java


示例4: testSearchMedications

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
@Test
public void testSearchMedications() throws CorruptIndexException, ParseException, IOException {
	ObjectContext context = getRuntime().newContext();
	Search search = Search.getInstance();
	Builder b = new Search.Request.Builder(search);
	List<ResultItem> sAmlodipine = b.searchUsingQueryParser("amlodip*").setMaxHits(1).withFilters(Search.Filter.DMD_VTM_OR_TF).build().search();
	assertEquals(1, sAmlodipine.size());
	Concept amlodipine = ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(sAmlodipine.get(0).getConceptId())).selectOne(context);
	assertNotNull(amlodipine);
	assertTrue(Vtm.isA(amlodipine));		// this should be a VTM
	List<ResultItem> aMadopar = b.search("madopar").setMaxHits(1).withFilters(Search.Filter.DMD_VTM_OR_TF).build().search();
	Concept madopar = ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(aMadopar.get(0).getConceptId())).selectOne(context);
	assertTrue(Tf.isA(madopar));

	assertEquals(0, b.search("madopar").clearFilters().withDirectParent(Dmd.Product.VIRTUAL_THERAPEUTIC_MOIETY.conceptId).build().search().size());
	assertEquals(0, b.search("madopar").clearFilters().withDirectParent(Dmd.Product.VIRTUAL_MEDICINAL_PRODUCT.conceptId).build().search().size());
	assertEquals(0, b.search("madopar").clearFilters().withDirectParent(Dmd.Product.VIRTUAL_MEDICINAL_PRODUCT_PACK.conceptId).build().search().size());
	assertNotEquals(0, b.search("madopar").clearFilters().withDirectParent(Dmd.Product.TRADE_FAMILY.conceptId).build().search().size());
	assertNotEquals(0, b.search("madopar").clearFilters().withDirectParent(Dmd.Product.ACTUAL_MEDICINAL_PRODUCT.conceptId).build().search().size());
	assertNotEquals(0, b.search("madopar").clearFilters().withDirectParent(Dmd.Product.ACTUAL_MEDICINAL_PRODUCT_PACK.conceptId).build().search().size());

}
 
开发者ID:wardle,项目名称:rsterminology,代码行数:23,代码来源:TestSnomedCt.java


示例5: testRequest

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
@Test
public void testRequest() throws CorruptIndexException, IOException, ParseException {
	ObjectContext context = getRuntime().newContext();
	Search search = Search.getInstance();
	List<ResultItem> sAmlodipine = new Search.Request.Builder(search).searchUsingQueryParser("amlodip*").withFilters(Search.Filter.DMD_VTM_OR_TF, Search.Filter.CONCEPT_ACTIVE).setMaxHits(1).build().search();
	assertEquals(1, sAmlodipine.size());
	Concept amlodipine = ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(sAmlodipine.get(0).getConceptId())).selectOne(context);
	assertTrue(Vtm.isA(amlodipine));
	
	List<ResultItem> sMultipleSclerosisInDrugs = new Search.Request.Builder(search).searchUsingQueryParser("multiple sclerosis").withFilters(Search.Filter.DMD_VTM_OR_TF).build().search();
	assertEquals(0, sMultipleSclerosisInDrugs.size());
	
	List<ResultItem> sMultipleSclerosis = new Search.Request.Builder(search).search("multiple sclerosis").withRecursiveParent(Category.DISEASE.conceptId).setMaxHits(1).build().search();
	assertEquals(1, sMultipleSclerosis.size());
	
	List<ResultItem> sMs = new Search.Request.Builder(search).search("ms").withRecursiveParent(Category.DISEASE.conceptId).withFilters(Search.Filter.CONCEPT_ACTIVE).setMaxHits(200).build().search();
	//sMs.forEach(ri -> System.out.println(ri));
	assertTrue(sMs.stream().anyMatch(ri -> ri.getConceptId()==24700007L));	// multiple sclerosis
	assertTrue(sMs.stream().anyMatch(ri -> ri.getConceptId()==79619009L));		// mitral stenosis
}
 
开发者ID:wardle,项目名称:rsterminology,代码行数:21,代码来源:TestSnomedCt.java


示例6: testLocale

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
@Test
public void testLocale() {
	ObjectContext context = getRuntime().newContext();
	Concept haemophilia = ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(90935002L)).selectOne(context);
	assertNotNull(haemophilia);
	// haemophilia has two preferred descriptions one for US and one for GB
	assertTrue(haemophilia.getDescriptions().stream()
			.filter(d -> d.isPreferred())
			.count() > 1);
	Description preferredGB = haemophilia.getPreferredDescription("en-GB").get();
	assertNotNull(preferredGB);
	assertTrue(preferredGB.isPreferred());
	assertTrue(preferredGB.isActive());
	assertEquals("en-GB", preferredGB.getLanguageCode());
	Description preferredUS = haemophilia.getPreferredDescription("en-US").get();
	assertEquals("en-US", preferredUS.getLanguageCode());
	
	Concept beclametasone = ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(1389007L)).selectOne(context);
	assertNotNull(beclametasone);
	Description bGp = beclametasone.getPreferredDescription("en-GB").get();
	assertTrue(bGp.isActive());

}
 
开发者ID:wardle,项目名称:rsterminology,代码行数:24,代码来源:TestSnomedCt.java


示例7: testDmd

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
@Test
public void testDmd() {
	ObjectContext context = getRuntime().newContext();
	Amp nifedipress = new Amp(ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(7855311000001102L)).selectOne(context));
	assertEquals(2, nifedipress.getExcipients().count());		//lactose and polysorbate
	
	assertTrue(nifedipress.isAvailable());	// this is currently true, but may change in the future
	
	Amp istin = new Amp(ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(5523911000001100L)).selectOne(context));
	assertEquals(0, istin.getExcipients().count());		// Excipient not declared (qualifier value) 8653301000001102
	assertTrue(istin.isAvailable());
	istin.getVtms().forEach(vtm -> assertTrue(vtm.isPrescribable()));
	
	Vmp rofecoxib = new Vmp(ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(330162006L)).selectOne(context));
	assertFalse(rofecoxib.isAvailable());	// rofecoxib isn't available anymore
	assertFalse(rofecoxib.isPrescribable());	// and so isn't prescribable either
	rofecoxib.getAmps().forEach(amp -> assertFalse(amp.isAvailable()));	// none of the AMPs are available either.
	rofecoxib.getTfs().forEach(tf -> assertFalse(tf.isPrescribable()));	// likewise for the TFs
	rofecoxib.getVtms().forEach(vtm -> assertFalse(vtm.isPrescribable()));
}
 
开发者ID:wardle,项目名称:rsterminology,代码行数:21,代码来源:TestPrescribing.java


示例8: testInvalidate_CustomData

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
@Test
public void testInvalidate_CustomData() {

    ObjectContext context = SERVER_RUNTIME.newContext();

    // make sure Cayenne-specific caches are created...
    ObjectSelect<Table1> g1 = ObjectSelect.query(Table1.class).localCache("cayenne1");
    assertEquals(0, g1.select(context).size());

    // add custom data
    CacheManager cacheManager = TEST_RUNTIME.getInstance(CacheManager.class);
    Cache<String, String> cache = cacheManager.getCache("cayenne1");
    cache.put("a", "b");

    assertEquals("b", cache.get("a"));


    // generate commit event
    context.newObject(Table1.class);
    context.commitChanges();

    // custom cache entries must expire
    assertNull(cache.get("a"));
}
 
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:25,代码来源:CacheInvalidationIT.java


示例9: testCachedQueries

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
@Test
public void testCachedQueries() {

    ObjectContext context = RUNTIME.newContext();
    ObjectSelect<Table1> g1 = ObjectSelect.query(Table1.class).localCache("g1");
    ObjectSelect<Table1> g2 = ObjectSelect.query(Table1.class).localCache("g2");

    dataManager.getTable(Table1.class).insert(1).insert(45);
    assertEquals(2, g1.select(context).size());

    // we are still cached, must not see the new changes
    dataManager.getTable(Table1.class).insert(2).insert(44);
    assertEquals(2, g1.select(context).size());

    // different cache group - must see the changes
    assertEquals(4, g2.select(context).size());

    // refresh the cache, so that "g1" could see the changes
    RUNTIME.getDataDomain().getQueryCache().removeGroup("g1");
    assertEquals(4, g1.select(context).size());
}
 
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:22,代码来源:CayenneJCacheModuleIT.java


示例10: match

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
public List<T> match(ObjectContext context, Map<Object, Map<String, Object>> mappedSegment) {

		Collection<Object> keys = mappedSegment.keySet();

		List<Expression> expressions = new ArrayList<>(keys.size());
		for (Object key : keys) {

			Expression e = mapper.expressionForKey(key);
			if (e != null) {
				expressions.add(e);
			}
		}

		// no keys (?)
		if (expressions.isEmpty()) {
			return Collections.emptyList();
		} else {
			return ObjectSelect.query(type).where(ExpressionFactory.or(expressions)).select(context);
		}
	}
 
开发者ID:nhl,项目名称:link-move,代码行数:21,代码来源:TargetMatcher.java


示例11: testPost_SingleId

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
@Test
public void testPost_SingleId() {

    Response response1 = target("/single-id")
            .queryParam("exclude", "age", "description")
            .request()
            .post(Entity.json("{\"id\":\"John\"}"));
    assertEquals(Response.Status.CREATED.getStatusCode(), response1.getStatus());

    E20 e20 = ObjectSelect.query(E20.class).selectFirst(newContext());
    assertNotNull(e20);
    assertEquals("John", e20.getName());

    assertEquals("{\"data\":[{\"id\":\"John\",\"name\":\"John\"}],\"total\":1}",
            response1.readEntity(String.class));

    Response response2 = target("/single-id").queryParam("exclude", "age", "description").request().post(
            Entity.json("{\"id\":\"John\"}"));

    assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response2.getStatus());
    assertTrue(response2.readEntity(String.class).contains("object already exists"));
}
 
开发者ID:nhl,项目名称:link-rest,代码行数:23,代码来源:POST_NaturalIdIT.java


示例12: testPost_MultiId

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
@Test
public void testPost_MultiId() {

    Response response1 = target("/multi-id").queryParam("exclude", "description").request().post(
            Entity.json("{\"id\":{\"age\":18,\"name\":\"John\"}}"));
    assertEquals(Response.Status.CREATED.getStatusCode(), response1.getStatus());

    E21 e21 = ObjectSelect.query(E21.class).selectFirst(newContext());
    assertNotNull(e21);
    assertEquals(Integer.valueOf(18), e21.getAge());
    assertEquals("John", e21.getName());

    assertEquals("{\"data\":[{\"id\":{\"age\":18,\"name\":\"John\"},\"age\":18,\"name\":\"John\"}],\"total\":1}",
            response1.readEntity(String.class));

    Response response2 = target("/multi-id").queryParam("exclude", "description").request().post(
            Entity.json("{\"id\":{\"age\":18,\"name\":\"John\"}}"));

    assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response2.getStatus());
    assertTrue(response2.readEntity(String.class).contains("object already exists"));
}
 
开发者ID:nhl,项目名称:link-rest,代码行数:22,代码来源:POST_NaturalIdIT.java


示例13: setListViewData

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
protected void setListViewData() {
    final List<Artist> artists = ObjectSelect.query(Artist.class)
            .orderBy(ordering)
            .select(cayenneService.sharedContext());
    RecyclerView.Adapter adapter = new ArtistAdapter(artists, this, view -> {
        int itemPosition = recyclerView.getChildLayoutPosition(view);
        Artist item = artists.get(itemPosition);
        createOrEditArtist((Integer) item.getObjectId().getIdSnapshot().get(Artist.ID_PK_COLUMN));
    });
    recyclerView.setAdapter(adapter);
}
 
开发者ID:stariy95,项目名称:cayenne-android-demo,代码行数:12,代码来源:MainActivity.java


示例14: _performSearch

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
private List<ResultItem> _performSearch(String search, final List<Long> recursiveParents,
		final List<Long> directParents, int maxHits, boolean includeFsn, boolean includeInactive, boolean fuzzy,
		boolean fallbackFuzzy, String project) throws CorruptIndexException, IOException {
	Search.Request.Builder b = Search.getInstance().newBuilder();
	b.setMaxHits(maxHits)
	.withRecursiveParent(recursiveParents);
	if (search != null && search.length() > 0) {
		b.search(search);
	}
	if (!includeInactive) {
		b.onlyActive();
	}
	if (!includeFsn) {
		b.withoutFullySpecifiedNames();
	}
	if (fuzzy) {
		b.useFuzzy();
	}
	if (directParents.size() > 0) {
		b.withDirectParent(directParents);
	}
	List<ResultItem> result = b.build().search();
	if (!fuzzy && fallbackFuzzy && result.size() == 0) {
		result = b.useFuzzy().build().search();
	}
	if (project != null && project.length() > 0) {
		ICayennePersister cayenne = LinkRestRuntime.service(ICayennePersister.class, config);
		ObjectContext context = cayenne.newContext();
		Project p = ObjectSelect.query(Project.class, Project.NAME.eq(project)).selectOne(context);
		result = SearchUtilities.filterSearchForProject(result, p, recursiveParents);
	}
	return result;
}
 
开发者ID:wardle,项目名称:rsterminology,代码行数:34,代码来源:SearchResource.java


示例15: getByRead

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
/**
 * Search for a concept by using Read code
 */
@GET
@Path("read/{readCode}")
public DataResponse<Long> getByRead(@PathParam("readCode") String readCode, 
		@Context UriInfo uriInfo) {
	ICayennePersister cayenne = LinkRestRuntime.service(ICayennePersister.class, config);
	ObjectContext context = cayenne.newContext();
	Expression qual = Concept.CTV_ID.startsWith(readCode);
	List<Concept> concepts = ObjectSelect.query(Concept.class, qual).select(context);
	List<Long> results = concepts.stream().map(c -> c.getConceptId()).collect(Collectors.toList()); 
	return responseWithList(results);
}
 
开发者ID:wardle,项目名称:rsterminology,代码行数:15,代码来源:SearchResource.java


示例16: createOrUpdate

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
@Override
public void createOrUpdate(ObjectContext context, String[] data) {
	CrossMapSet set = ObjectSelect.query(CrossMapSet.class, CrossMapSet.SET_ID.eq(mapSetId(data))).selectOne(context);
	Concept concept = ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(conceptId(data))).selectOne(context);
	CrossMapTarget target = ObjectSelect.query(CrossMapTarget.class, CrossMapTarget.TARGET_ID.eq(mapTargetId(data))).selectOne(context);
	if (set != null && concept != null && target != null) {
		Expression qual = CrossMapTable.SET.eq(set).andExp(CrossMapTable.CONCEPT.eq(concept).andExp(CrossMapTable.TARGET.eq(target)));
		List<CrossMapTable> results = ObjectSelect.query(CrossMapTable.class, qual).select(context);
		CrossMapTable cmt = null;
		if (results.size() > 1) {
			System.err.println("Found duplicate rows matching setId: " + mapSetId(data) + " conceptId:" + conceptId(data) + " targetId:" + mapTargetId(data));
			context.deleteObjects(results);
		} else if (results.size() == 1) {
			cmt = results.get(0);
		}
		if (cmt == null) {
			cmt = context.newObject(CrossMapTable.class);
		}
		cmt.setSet(set);
		cmt.setMapSetId(set.getSetId());
		cmt.setConcept(concept);
		cmt.setConceptId(concept.getConceptId());
		cmt.setTarget(target);
		cmt.setTargetId(target.getTargetId());
		cmt.setOption(mapOption(data));
		cmt.setPriority(mapPriority(data));
		cmt.setRule(mapRule(data));
		cmt.setAdvice(mapAdvice(data));
		cmt.setDateUpdated(_dateCreated);
	}
	else {
		System.err.println("Could not identify set, concept or target: " + data);
	}
}
 
开发者ID:wardle,项目名称:rsterminology,代码行数:35,代码来源:ParseRf1.java


示例17: testFetchProject

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
@Test
public void testFetchProject() throws IOException {
	ObjectContext context = getRuntime().newContext();
	final String ACUTE_PAEDS_NAME="CAVACUTEPAEDS";
	Project p = ObjectSelect.query(Project.class, Project.NAME.eq(ACUTE_PAEDS_NAME)).selectOne(context);
	assertEquals(ACUTE_PAEDS_NAME, p.getName());

	// how many projects?
	long numberProjects = ObjectSelect.query(Project.class).count().selectOne(context);
	assertNotEquals(0, numberProjects);
	
	// calculate a list of common concepts manually rather than in a single fetch
	HashSet<Concept> common = new HashSet<Concept>();
	p.getOrderedParents().forEach(proj -> common.addAll(proj.getCommonConcepts()));

	// and now perform a filtered search...
	Search search = Search.getInstance();
	List<ResultItem> result = new Search.Request.Builder(search)
			.search("bronchio").onlyActive().withoutFullySpecifiedNames()
			.withRecursiveParent(Category.DISEASE.conceptId).build()
			.search();
	List<ResultItem> filtered1 = SearchUtilities.filterSearchForProject(result, p, Collections.singletonList(Category.DISEASE.conceptId));
	
	// and now prove we have the correct result
	List<Long> filtered2 = filtered1.stream().map(ResultItem::getConceptId).collect(Collectors.toList());
	List<Concept> filtered3 = ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.in(filtered2)).select(context);
	filtered3.stream().forEach(c -> {
		assertTrue(common.contains(c));
		System.out.println(c);
	});
}
 
开发者ID:wardle,项目名称:rsterminology,代码行数:32,代码来源:TestProject.java


示例18: testBasicConcepts

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
@Test
public void testBasicConcepts() {
	ObjectContext context = getRuntime().newContext();
	ObjectSelect<Concept> q = ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(24700007L));
	Concept ms = context.selectFirst(q);
	assertEquals(24700007L, (long)ms.getConceptId());
	assertTrue(ms.isAConcept(6118003));	// is multiple sclerosis a type of demyelinating disease?
	assertFalse(ms.isAConcept(32798002));	// is MS a type of parkinsonism?
	Description d = ms.getPreferredDescription();
	assertTrue(d.getStatus().get() == Description.Status.CURRENT);
	assertTrue(d.getType().get() == Description.Type.PREFERRED);
	assertTrue(d.isPreferred());
	assertTrue(d.isActive());
}
 
开发者ID:wardle,项目名称:rsterminology,代码行数:15,代码来源:TestSnomedCt.java


示例19: testCrossmaps

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
@Test 
public void testCrossmaps() {
	final long icd10 = 91000000146L;	
	ObjectContext context = getRuntime().newContext();
	ObjectSelect<Concept> q = ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(24700007L));
	Concept ms = context.selectFirst(q);
	Optional<String> msIcd10 = ms.getCrossMaps().stream()
		.filter(cm -> cm.getMapSetId() == icd10)
		.map(cm -> cm.getTarget().getCodes())
		.findFirst();
	if (msIcd10.isPresent()) {
		assertEquals("G35X", msIcd10.get());
	}
}
 
开发者ID:wardle,项目名称:rsterminology,代码行数:15,代码来源:TestSnomedCt.java


示例20: testRecursiveParentBuilding

import org.apache.cayenne.query.ObjectSelect; //导入依赖的package包/类
@Test 
public void testRecursiveParentBuilding() {
	ObjectContext context = getRuntime().newContext();
	Concept ms = ObjectSelect.query(Concept.class, Concept.CONCEPT_ID.eq(24700007L)).selectOne(context);
	Set<Long> recursiveParents = ms.getCachedRecursiveParents();
	ParentCache.buildParentCacheForConcept(ms);
	ms.clearCachedRecursiveParents();
	Set<Long> parents = new HashSet<Long>(ParentCache.fetchRecursiveParentsForConcept(context, 24700007L));
	Set<Long> recursiveParents2 = ms.getCachedRecursiveParents();
	assertTrue(recursiveParents.equals(parents));
	assertTrue(recursiveParents2.equals(parents));
}
 
开发者ID:wardle,项目名称:rsterminology,代码行数:13,代码来源:TestSnomedCt.java



注:本文中的org.apache.cayenne.query.ObjectSelect类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MessageEncryptor类代码示例发布时间:2022-05-23
下一篇:
Java BikingRouteResult类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap