Package net.stinfoservices.pacifiq.server.model

Examples of net.stinfoservices.pacifiq.server.model.BusinessPartner


    public BusinessPartner findBusinessPartner(Long id) throws Exception {
        try {
            List<BusinessPartner> bps = entityManager
                    .createQuery("SELECT o.businessPartner FROM " + IModel.DATABASE_PRE + "ConcreteBusinessPartner o WHERE o.id = :id")
                    .setParameter("id", id).getResultList();
            BusinessPartner result = null;

            if (bps.size() > 0) {
                result = bps.get(0);
            }
View Full Code Here


        if (bp == null) {
            return (null);
        }

        try {
            BusinessPartner p = entityManager.merge(bp);

            entityManager.persist(p);
            p = entityManager.find(BusinessPartner.class, p.getId());
            LOGGER.info(MessageFormat.format(ResourceBundle.getBundle("system").getString("OBJECT_SAVED"), this.getClass().getSimpleName(),
                    p.getId()));

            return (p);
        } catch (Exception ex) {
            throw new CustomException(ex);
        }
View Full Code Here

        if (bp == null) {
            return;
        }

        try {
            BusinessPartner nbp = entityManager.merge(bp);

            entityManager.remove(nbp);

            LOGGER.info(MessageFormat.format(ResourceBundle.getBundle("system").getString("OBJECT_DELETED"), this.getClass().getSimpleName(),
                    nbp.getId()));
        } catch (Exception ex) {
            throw new CustomException(ex);
        }
    }
View Full Code Here

    @DatabaseSetup(value = UPDATE_DATASET)
    @DatabaseTearDown(value = UPDATE_DATASET, type = DatabaseOperation.DELETE)
    @Override
    public void testFind() throws Exception {
        ConcreteBusinessPartner cbp = cbpDAO.find(1L);
        BusinessPartner bp = new BusinessPartner();
        ConcreteBusinessPartner cbpc = new ConcreteBusinessPartner();

        cbpc.setId(1L);
        cbpc.setAddress(UPDATED_ADDRESS);
        cbpc.setCountry(COUNTRY);
        cbpc.setVersion(2);
        bp.setId(1L);
        bp.setName(BUSINESSPARTNER_NAME);
        bp.setVersion(1);
        cbpc.setBusinessPartner(bp);
        assertNotNull(cbp);
        assertEquals(UPDATED_ADDRESS, cbp.getAddress());
        assertEquals(COUNTRY, cbp.getCountry());
        assertEquals(cbpc, cbp);
View Full Code Here

    @DatabaseSetup(value = UPDATE_DATASET)
    @DatabaseTearDown(value = UPDATE_DATASET, type = DatabaseOperation.DELETE)
    @Override
    public void testFindAll() throws Exception {
        List<ConcreteBusinessPartner> cbps = cbpDAO.findAll();
        BusinessPartner bp = new BusinessPartner();
        ConcreteBusinessPartner cbp = new ConcreteBusinessPartner();

        cbp.setId(1L);
        cbp.setAddress(UPDATED_ADDRESS);
        cbp.setCountry(COUNTRY);
        cbp.setVersion(2);
        bp.setId(1L);
        bp.setName(BUSINESSPARTNER_NAME);
        bp.setVersion(1);
        cbp.setBusinessPartner(bp);
        assertSame(1, cbps.size());
        assertNotNull(cbps.get(0));
        assertEquals(cbps.get(0), cbp);
    }
View Full Code Here

    @DatabaseSetup(value = UPDATE_DATASET)
    @DatabaseTearDown(value = UPDATE_DATASET, type = DatabaseOperation.DELETE)
    @Override
    public void testFindEntries() throws Exception {
        List<ConcreteBusinessPartner> cbps = cbpDAO.findEntries(0, 1);
        BusinessPartner bp = new BusinessPartner();
        ConcreteBusinessPartner cbp = new ConcreteBusinessPartner();

        assertSame(1, cbps.size());
        assertNotNull(cbps.get(0));
        cbp.setId(1L);
        cbp.setAddress(UPDATED_ADDRESS);
        cbp.setCountry(COUNTRY);
        cbp.setVersion(2);
        bp.setId(1L);
        bp.setName(BUSINESSPARTNER_NAME);
        bp.setVersion(1);
        cbp.setBusinessPartner(bp);
        assertEquals(cbps.get(0), cbp);
        cbps = cbpDAO.findEntries(0, 0);
        assertSame(0, cbps.size());
    }
View Full Code Here

     */
    @Test
    @DatabaseSetup(value = UPDATE_DATASET)
    @DatabaseTearDown(value = UPDATE_DATASET, type = DatabaseOperation.DELETE)
    public void testFindBusinessPartner() throws Exception {
        BusinessPartner bp = new BusinessPartner();
        ConcreteBusinessPartner cbp = new ConcreteBusinessPartner();

        cbp.setId(1L);
        cbp.setAddress(UPDATED_ADDRESS);
        cbp.setCountry(COUNTRY);
        cbp.setVersion(2);
        bp.setId(1L);
        bp.setName(BUSINESSPARTNER_NAME);
        bp.setVersion(1);
        cbp.setBusinessPartner(bp);
        assertEquals(bp, cbpDAO.findBusinessPartner(cbp.getId()));
    }
View Full Code Here

            DatabaseConnection connection = new DatabaseConnection(dataSource.getConnection());
            IDataSet expectedDataSet = new FlatXmlDataSetBuilder().build(this.getClass()
                    .getResource("/dbunit/dao/admin/concretebusinesspartner-create_no-id.xml").openStream());
            ConcreteBusinessPartner cbp = new ConcreteBusinessPartner();
            ConcreteBusinessPartner ncbp;
            BusinessPartner bp = new BusinessPartner();

            cbp.setId(null);
            cbp.setAddress("");
            cbp.setCountry(COUNTRY);
            bp.setId(1L);
            bp.setName(BUSINESSPARTNER_NAME);
            bp.setVersion(1);
            cbp.setBusinessPartner(bp);
            cbp.setVersion(1);
            ncbp = cbpDAO.save(cbp);
            assertEquals(ncbp.getAddress(), cbp.getAddress());
            assertEquals(ncbp.getCountry(), cbp.getCountry());
View Full Code Here

        try {
            DatabaseConnection connection = new DatabaseConnection(dataSource.getConnection());
            IDataSet expectedDataSet = new FlatXmlDataSetBuilder().build(this.getClass().getResource(UPDATE_DATASET).openStream());
            ConcreteBusinessPartner cbp = new ConcreteBusinessPartner();
            ConcreteBusinessPartner ncbp;
            BusinessPartner bp = new BusinessPartner();

            cbp.setId(1L);
            cbp.setAddress(UPDATED_ADDRESS);
            cbp.setCountry(COUNTRY);
            bp.setId(1L);
            bp.setName(BUSINESSPARTNER_NAME);
            bp.setVersion(1);
            cbp.setBusinessPartner(bp);
            cbp.setVersion(1);
            ncbp = cbpDAO.save(cbp);
            assertEquals(cbp.getAddress(), ncbp.getAddress());
            assertEquals(cbp.getCountry(), ncbp.getCountry());
View Full Code Here

    @DatabaseSetup(value = CREATE_DATASET)
    @ExpectedDatabase(value = EMPTY_DATASET, assertionMode = DatabaseAssertionMode.NON_STRICT)
    @DatabaseTearDown(value = EMPTY_DATASET, type = DatabaseOperation.DELETE)
    @Override
    public void testRemove() throws Exception {
        BusinessPartner bp = new BusinessPartner();
        ConcreteBusinessPartner cbp = new ConcreteBusinessPartner();

        cbp.setId(1L);
        cbp.setAddress(UPDATED_ADDRESS);
        cbp.setCountry(COUNTRY);
        cbp.setVersion(1);
        bp.setId(1L);
        bp.setName(BUSINESSPARTNER_NAME);
        bp.setVersion(1);
        cbp.setBusinessPartner(bp);
        cbpDAO.remove(cbp);
    }
View Full Code Here

TOP

Related Classes of net.stinfoservices.pacifiq.server.model.BusinessPartner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.