Search in sources :

Example 1 with Organization

use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.

the class OrganizationRepositoryTests method saveOrganization.

@Test
public void saveOrganization() {
    Organization o = new Organization();
    Address a = new Address();
    a.setCountryName("United States");
    a.setLocality("Washington");
    a.setRegion("DC");
    a.setPostalCode("20005");
    a.setStreetAddress("1110 Vermont Ave. NW, Suite 500");
    o.setAddress(a);
    ContactPoint cp = new ContactPoint();
    cp.setEmail("info@developmentgateway.org");
    cp.setName("John Doe");
    cp.setTelephone("555-1234567");
    cp.setUrl("http://developmentgateway.org");
    cp.setFaxNumber("555-7654321");
    o.setContactPoint(cp);
    Identifier i = new Identifier();
    i.setId("DG");
    i.setLegalName("Development Gateway");
    o.setIdentifier(i);
    o.getRoles().add(OrganizationType.procuringEntity);
    o.getAdditionalIdentifiers().add(i);
    Organization save = vnOrganizationRepository.save(o);
    assertThat(save.getId(), is(not(nullValue())));
    LOGGER.info(save.getId());
}
Also used : ContactPoint(org.devgateway.ocds.persistence.mongo.ContactPoint) Organization(org.devgateway.ocds.persistence.mongo.Organization) Identifier(org.devgateway.ocds.persistence.mongo.Identifier) Address(org.devgateway.ocds.persistence.mongo.Address) Test(org.junit.Test) AbstractMongoTest(org.devgateway.toolkit.persistence.mongo.AbstractMongoTest)

Example 2 with Organization

use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.

the class EBidAwardRowImporter method createReleaseFromReleaseRow.

@Override
public Release createReleaseFromReleaseRow(final String[] row) throws ParseException {
    Release release = repository.findByPlanningBidNo(getRowCell(row, 0));
    if (release == null) {
        release = newReleaseFromAwardFactory(getRowCell(row, 0));
    }
    if (release.getTender() == null) {
        VNTender tender = new VNTender();
        tender.setId(release.getOcid());
        release.setTender(tender);
    }
    release.getTender().getSubmissionMethod().add(Tender.SubmissionMethod.electronicSubmission);
    VNAward award = new VNAward();
    award.setId(release.getOcid() + "-award-" + release.getAwards().size());
    release.getAwards().add(award);
    Amount value = new Amount();
    value.setCurrency("VND");
    value.setAmount(getDecimal(getRowCell(row, 1)));
    award.setValue(value);
    Organization supplier = organizationRepository.findByAllIds(getRowCellUpper(row, 2));
    if (supplier == null) {
        supplier = OrganizationRepositoryUtil.newAndInsertOrganization(Organization.OrganizationType.supplier, getRowCellUpper(row, 2), organizationRepository);
    } else {
        supplier = OrganizationRepositoryUtil.ensureOrgIsOfTypeAndSave(supplier, Organization.OrganizationType.supplier, organizationRepository);
    }
    Organization supplierOrganization = supplier;
    Detail detail = null;
    if (supplierOrganization != null && getRowCell(row, 1) != null) {
        Amount value2 = new Amount();
        value2.setCurrency("VND");
        value2.setAmount(getDecimal(getRowCell(row, 1)));
        VNTendererOrganization tendererOrganization = new VNTendererOrganization(supplier);
        tendererOrganization.setBidValue(value2);
        supplierOrganization = tendererOrganization;
        detail = newBidDetailFromAwardData(getRowCell(row, 0), value2, supplier);
    }
    award.setStatus("Y".equals(getRowCell(row, 5)) ? Award.Status.active : Award.Status.unsuccessful);
    // active=successful awards have suppliers
    if (Award.Status.active.equals(award.getStatus())) {
        award.getSuppliers().add(supplier);
    }
    award.setContractTime(getRowCell(row, 3));
    award.setBidOpenRank(getInteger(getRowCell(row, 4)));
    award.setIneligibleYN(getRowCell(row, 6));
    award.setIneligibleRson(getRowCell(row, 7));
    if (getRowCell(row, 8) != null) {
        award.setAlternateDate(getExcelDate(getRowCell(row, 8)));
    }
    if (getRowCell(row, 10) != null) {
        award.setDate(getExcelDate(getRowCell(row, 10)));
    }
    if (getRowCell(row, 9) != null) {
        award.setPublishedDate(getExcelDate(getRowCell(row, 9)));
    }
    // tenderers
    if (supplierOrganization != null) {
        release.getTender().getTenderers().add(supplierOrganization);
    }
    if (detail != null) {
        release.getBids().getDetails().add(detail);
    }
    release.getTender().setNumberOfTenderers(release.getTender().getTenderers().size());
    // copy items from tender
    award.getItems().addAll(release.getTender().getItems());
    checkForAwardOutliers(release, award);
    return release;
}
Also used : VNTendererOrganization(org.devgateway.ocvn.persistence.mongo.dao.VNTendererOrganization) Organization(org.devgateway.ocds.persistence.mongo.Organization) VNTendererOrganization(org.devgateway.ocvn.persistence.mongo.dao.VNTendererOrganization) Amount(org.devgateway.ocds.persistence.mongo.Amount) VNTender(org.devgateway.ocvn.persistence.mongo.dao.VNTender) VNAward(org.devgateway.ocvn.persistence.mongo.dao.VNAward) Release(org.devgateway.ocds.persistence.mongo.Release) Detail(org.devgateway.ocds.persistence.mongo.Detail)

Example 3 with Organization

use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.

the class OrganizationEndpointsTest method testOrganizationIdEndpoint.

@Test
public void testOrganizationIdEndpoint() {
    final Organization organizationId = organizationSearchController.byId(ORG_ID);
    Assert.assertNotNull(organizationId);
}
Also used : Organization(org.devgateway.ocds.persistence.mongo.Organization) Test(org.junit.Test) AbstractWebTest(org.devgateway.toolkit.web.AbstractWebTest)

Example 4 with Organization

use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.

the class OrganizationEndpointsTest method testBuyerIdEndpoint.

@Test
public void testBuyerIdEndpoint() {
    final Organization organizationId = buyerSearchController.byId(ORG_ID);
    Assert.assertNotNull(organizationId);
}
Also used : Organization(org.devgateway.ocds.persistence.mongo.Organization) Test(org.junit.Test) AbstractWebTest(org.devgateway.toolkit.web.AbstractWebTest)

Example 5 with Organization

use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.

the class OrganizationEndpointsTest method testOrganizationSearchText.

@Test
public void testOrganizationSearchText() {
    final TextSearchRequest osr = new TextSearchRequest();
    osr.setText("Development");
    final List<Organization> organizations = organizationSearchController.searchText(osr);
    Assert.assertEquals(1, organizations.size(), 0);
}
Also used : TextSearchRequest(org.devgateway.ocds.web.rest.controller.request.TextSearchRequest) Organization(org.devgateway.ocds.persistence.mongo.Organization) Test(org.junit.Test) AbstractWebTest(org.devgateway.toolkit.web.AbstractWebTest)

Aggregations

Organization (org.devgateway.ocds.persistence.mongo.Organization)19 Test (org.junit.Test)11 AbstractWebTest (org.devgateway.toolkit.web.AbstractWebTest)9 Identifier (org.devgateway.ocds.persistence.mongo.Identifier)5 TextSearchRequest (org.devgateway.ocds.web.rest.controller.request.TextSearchRequest)5 Address (org.devgateway.ocds.persistence.mongo.Address)3 Amount (org.devgateway.ocds.persistence.mongo.Amount)3 ContactPoint (org.devgateway.ocds.persistence.mongo.ContactPoint)3 Release (org.devgateway.ocds.persistence.mongo.Release)3 VNTender (org.devgateway.ocvn.persistence.mongo.dao.VNTender)3 Detail (org.devgateway.ocds.persistence.mongo.Detail)2 VNAward (org.devgateway.ocvn.persistence.mongo.dao.VNAward)2 VNTendererOrganization (org.devgateway.ocvn.persistence.mongo.dao.VNTendererOrganization)2 AbstractMongoTest (org.devgateway.toolkit.persistence.mongo.AbstractMongoTest)2 Before (org.junit.Before)2 Period (org.devgateway.ocds.persistence.mongo.Period)1 ContrMethod (org.devgateway.ocvn.persistence.mongo.dao.ContrMethod)1 VNOrganization (org.devgateway.ocvn.persistence.mongo.dao.VNOrganization)1 VNPlanning (org.devgateway.ocvn.persistence.mongo.dao.VNPlanning)1 PageRequest (org.springframework.data.domain.PageRequest)1