Examples of HistoricalEvent


Examples of models.HistoricalEvent

public class AbstractController extends Controller
{
    public static void createHistoricalEvent(String category,
                                             String message)
    {
        HistoricalEvent historicalEvent = new HistoricalEvent();
        historicalEvent.creationDate = new Date();
        historicalEvent.category = category;
        historicalEvent.message = message;

        ActorSystem actorSystem = Akka.system();
View Full Code Here

Examples of org.nxplanner.history.HistoricalEvent

        try {
            String description = null;
            if (PropertyUtils.isReadable(object, "name")) {
                description = (String)PropertyUtils.getProperty(object, "name");
            }
            HistoricalEvent event = saveHistoryEvent(object, HistoricalEvent.CREATED, description);
            int id = delegate.insert(object);
            if (event != null) {
                event.setTargetObjectId(id);
            }
            return id;
        } catch (Exception e) {
            throw new RepositoryException(e);
        }
View Full Code Here

Examples of org.nxplanner.history.HistoricalEvent

    }

    public void testDeleteHistory() throws Exception {
        domainObject.setName("PROJECT_NAME");
        mockSessionControl.expectAndReturn(mockSession.load(Project.class, new Integer(OID)), domainObject);
        HistoricalEvent event = new HistoricalEvent(0, 0, "project",
                HistoricalEvent.DELETED, "PROJECT_NAME", XPlannerTestSupport.DEFAULT_PERSON_ID, new Date());
        mockSession.save(event);
        mockSessionControl.setMatcher(new BeanArgumentMatcher(null, new String[]{"when"}));
        mockSessionControl.setReturnValue(new Integer(OID+1));
        mockSession.find("", null, Hibernate.INTEGER);
View Full Code Here

Examples of org.nxplanner.history.HistoricalEvent

        verify();
    }

    public void testInsertHistory() throws Exception {
        HistoricalEvent event = new HistoricalEvent(0, 0, "project",
                HistoricalEvent.CREATED, null, XPlannerTestSupport.DEFAULT_PERSON_ID, new Date());
        mockSession.save(event);
        mockSessionControl.setMatcher(new BeanArgumentMatcher(null, new String[]{"when"}));
        mockSessionControl.setReturnValue(new Integer(OID+1));
        mockObjectRepositoryControl.expectAndReturn(mockObjectRepository.insert(domainObject), 111);
View Full Code Here

Examples of org.nxplanner.history.HistoricalEvent

        verify();
    }

    public void testUpdateHistory() throws Exception {
        HistoricalEvent event = new HistoricalEvent(0, 0, "project",
                HistoricalEvent.UPDATED, null, XPlannerTestSupport.DEFAULT_PERSON_ID, new Date());
        mockSession.save(event);
        mockSessionControl.setMatcher(new BeanArgumentMatcher(null, new String[]{"when"}));
        mockSessionControl.setReturnValue(new Integer(OID+1));
        mockSession.createQuery("placeholder");
View Full Code Here

Examples of org.nxplanner.history.HistoricalEvent

        assertHistoricalEvent(hibernateSession, targetObjectId, action, description, personId);
    }

    public void assertHistoricalEvent(MockSession hibernateSession, int targetObjectId, String action,
            String description, int personId) {
        HistoricalEvent event = getHistoricalEvent(hibernateSession, targetObjectId);
        Assert.assertNotNull("no historical event", event);
        Assert.assertEquals("wrong target ID", targetObjectId, event.getTargetObjectId());
        Assert.assertEquals("wrong action", action, event.getAction());
        Assert.assertEquals("wrong description", description, event.getDescription());
        Assert.assertEquals("wrong personId", personId, event.getPersonId());
        Assert.assertNotNull("wrong date", event.getWhen());
        Assert.assertFalse("wrong notified flag", event.isNotified());
    }
View Full Code Here

Examples of org.nxplanner.history.HistoricalEvent

        Assert.assertNotNull("wrong date", event.getWhen());
        Assert.assertFalse("wrong notified flag", event.isNotified());
    }

    public void assertNoHistoricalEvent(MockSession hibernateSession) {
        HistoricalEvent event = getHistoricalEvent(hibernateSession, 0);
        Assert.assertNull("unexpected historical event", event);
    }
View Full Code Here

Examples of org.nxplanner.history.HistoricalEvent

    private HistoricalEvent getHistoricalEvent(MockSession hibernateSession, int targetObjectId) {
        for (int i = 0; i < hibernateSession.saveObjects.size(); i++) {
            if (hibernateSession.saveObjects.get(i) instanceof HistoricalEvent &&
                    (targetObjectId == 0 ||
                    ((HistoricalEvent)hibernateSession.saveObjects.get(i)).getTargetObjectId() == targetObjectId)) {
                HistoricalEvent event = (HistoricalEvent)hibernateSession.saveObjects.remove(i);
                if (hibernateSession.saveObjects.size() > 0) {
                    hibernateSession.saveObject = hibernateSession.saveObjects.get(0);
                }
                return event;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.