Package com.darkhonor.rage.model

Examples of com.darkhonor.rage.model.Version


    @Test(expected=NullPointerException.class)
    public void testDeleteNullVersion()
    {
        System.out.println("deleteNullVersion");
        assertTrue(instance.isOpen());
        Version version = null;
        instance.delete(version);
    }
View Full Code Here


        assertTrue(instance.isOpen());
        Double versionNumber = new Double(2.1);
        assertNotNull(versionNumber);
        instance.delete(versionNumber);
        assertTrue(instance.isOpen());
        Version result = instance.find(new Double(2.1));
        assertNull(result);
    }
View Full Code Here

    private void persistDatabaseVersion(Double versionNumber)
    {
        EntityManager em = emf.createEntityManager();
        EntityTransaction tx = em.getTransaction();
        Version version = new Version(versionNumber);
        tx.begin();
        em.persist(version);
        tx.commit();
        em.close();
    }
View Full Code Here

        } else
        {
            EntityTransaction tx = null;
            // Don't need to put this into a Transaction since the transaction will
            // be created in the find method
            Version testVersion = this.find(version.getId());
            if (testVersion != null)
            {
                LOGGER.warn("(create) Version already exists in the data source");
                throw new IllegalArgumentException("Version alread exists in the data source");
            }
View Full Code Here

            LOGGER.error("(find) Version number is less than or equal to 0.0");
            throw new IllegalArgumentException("Version number is less than or "
                    + "equal to 0.0");
        } else
        {
            Version version;
            CriteriaBuilder cb = em.getCriteriaBuilder();
            CriteriaQuery<Version> cq = cb.createQuery(Version.class);
            Root<Version> categoryRoot = cq.from(Version.class);
            cq.where(cb.equal(categoryRoot.get("id"), versionNumber));
            TypedQuery<Version> versionQuery = em.createQuery(cq);
View Full Code Here

            throw new IllegalArgumentException("Version number is either null or blank");
        } else
        {
            EntityTransaction tx = em.getTransaction();
            tx.begin();
            Version deletedVersion = em.find(Version.class, version.getId());
            tx.commit();
            if (deletedVersion == null)
            {
                LOGGER.error("(delete) Provided Version does not exist");
                throw new IllegalArgumentException("Provided Version does not exist");
View Full Code Here

            throw new IllegalArgumentException("Version number is invalid");
        } else
        {
            EntityTransaction tx = em.getTransaction();
            tx.begin();
            Version deletedCategory = em.find(Version.class, versionNumber);
            tx.commit();
            if (deletedCategory == null)
            {
                LOGGER.error("(delete) Provided Version number does not exist");
                throw new IllegalArgumentException("Provided Version number does not exist");
View Full Code Here

TOP

Related Classes of com.darkhonor.rage.model.Version

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.