use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.
the class OrganizationEndpointsTest method testSupplierSaerchText.
@Test
public void testSupplierSaerchText() {
final TextSearchRequest osr = new TextSearchRequest();
osr.setText("Development");
final List<Organization> organizations = supplierSearchController.searchText(osr);
Assert.assertEquals(0, organizations.size(), 0);
}
use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.
the class OrganizationEndpointsTest method importTestData.
@Before
public void importTestData() throws IOException, InterruptedException {
organizationRepository.deleteAll();
final Organization organization = new Organization();
organization.setName("Development Gateway");
organization.setId(ORG_ID);
final Address address = new Address();
address.setCountryName("Romania");
address.setLocality("Bucuresti");
address.setPostalCode("022671");
address.setRegion("Bucuresti");
address.setStreetAddress("7 Sos. Iancului");
organization.setAddress(address);
final ContactPoint contactPoint = new ContactPoint();
contactPoint.setEmail("mpostelnicu@developmentgateway.org");
contactPoint.setFaxNumber("01234567");
contactPoint.setTelephone("01234567");
contactPoint.setUrl("http://developmentgateway.org");
organization.setContactPoint(contactPoint);
final Identifier identifier = new Identifier();
identifier.setId(ORG_ID);
organization.getAdditionalIdentifiers().add(identifier);
organization.getRoles().add(Organization.OrganizationType.procuringEntity);
organization.getRoles().add(Organization.OrganizationType.buyer);
final Organization savedOrganization = organizationRepository.save(organization);
Assert.assertNotNull(savedOrganization);
Assert.assertEquals(ORG_ID, savedOrganization.getId());
}
use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.
the class OrganizationEndpointsTest method testBuyerSearchText.
@Test
public void testBuyerSearchText() {
final TextSearchRequest osr = new TextSearchRequest();
osr.setText("Development");
final List<Organization> organizations = buyerSearchController.searchText(osr);
Assert.assertEquals(1, organizations.size(), 0);
}
use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.
the class AbstractOrganizationSearchController method organizationSearchTextByType.
protected List<Organization> organizationSearchTextByType(final TextSearchRequest request, Organization.OrganizationType type) {
Query query = null;
if (request.getText() == null) {
query = new Query();
} else {
//this is for Full Text Search, in case we need this later, right now it's not very useful
//query = TextQuery.queryText(new TextCriteria().matching(request.getText())).sortByScore();
query = new Query().addCriteria(Criteria.where("name").regex(Pattern.compile(request.getText(), Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE)));
}
if (type != null) {
query.addCriteria(Criteria.where("roles").is(type)).with(new PageRequest(request.getPageNumber(), request.getPageSize()));
}
List<Organization> orgs = mongoTemplate.find(query, Organization.class);
return orgs;
}
use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.
the class VNImportAndEndpointsTest method testProcuringEntitySearchController.
@Test
public void testProcuringEntitySearchController() {
List<Organization> procuringEntities = procuringEntitySearchController.searchText(new TextSearchRequest());
Assert.assertEquals(3, procuringEntities.size(), 0);
}
Aggregations