private EntityListEntry createEntityListEntry() { /* EntityDescription */ EntityDescription entityDescription = new EntityDescription(); NamedEntityDescription namedEntityDescription = new NamedEntityDescription(); ScopedEntityName name = new ScopedEntityName(); name.setName("test"); name.setNamespace("test"); CodeSystemVersionReference ref = new CodeSystemVersionReference(); ref.setCodeSystem(new CodeSystemReference("test.ref")); ref.setVersion(new NameAndMeaningReference("test.ref.version")); namedEntityDescription.setEntityID(name); namedEntityDescription.setDescribingCodeSystemVersion(ref); namedEntityDescription.setAbout("test.about"); URIAndEntityName uriAndEntityName = new URIAndEntityName(); uriAndEntityName.setName("test.entityType"); uriAndEntityName.setNamespace("test.namespace"); uriAndEntityName.setUri("http://my/uri"); List<URIAndEntityName> uriAndEntityNameList = new ArrayList<URIAndEntityName>(1); uriAndEntityNameList.add(uriAndEntityName); namedEntityDescription.setEntityType(uriAndEntityNameList); entityDescription.setNamedEntity(namedEntityDescription); /* EntityListEntry */ EntityListEntry entry = new EntityListEntry(); entry.setEntry(entityDescription); return entry; }
@Override public EntityList readEntityDescriptions( EntityNameOrURI entityId, ResolvedReadContext readContext) { EntityList entities = createEntityList(); EntityListEntry entry = createEntityListEntry(); if (entityId.getEntityName().getName().equals("test.name") && readContext != null) { entry.setResourceName("success"); } else { entry.setResourceName("fail"); } entities.addEntry(entry); return entities; }