Package com.philip.journal.home.bean

Examples of com.philip.journal.home.bean.Entry


    /** Case 4: Matched both title and desc. */
    @SuppressWarnings("unchecked")
    @Test
    public final void testSearchEntriesSimple4()
    {
        final Entry entry = new Entry("Title 333", "Desc 333", null);
        final List<Entry> entryList = new ArrayList<Entry>();
        entryList.add(entry);
        when(getDaoFacade().getEntryDAO().searchIlike(Matchers.anyMap())).thenReturn(entryList);

        try {
View Full Code Here


        testBranch1.setBranchId(TEST_ID_RTBRANCH1);

        testSubBranch1 = new Branch("SubBranch1", testBranch1);
        testSubBranch1.setBranchId(TEST_ID_SUBBRANCH1);

        final Entry entry1 = new Entry("Entry Title 1", "Entry Desc 1", testBranch1);
        final Entry entry2 = new Entry("Entry Title 2", "Entry Desc 2", testBranch1);
        final Entry entry3 = new Entry("Entry Title 3", "Entry Desc 3", testSubBranch1);

        when(branchDAO.readAllByParent(Constant.ROOT_ID)).thenReturn(Arrays.asList(new Branch[] { testBranch1 }));
        when(branchDAO.readAllByParent(TEST_ID_RTBRANCH1)).thenReturn(Arrays.asList(new Branch[] { testSubBranch1 }));
        when(entryDAO.readAllByBranch(TEST_ID_RTBRANCH1)).thenReturn(Arrays.asList(new Entry[] {
                entry1,
View Full Code Here

     * Case 3: Normal flow for Entry.
     */
    @Test
    public final void testAttachPropertiesToElementCase3()
    {
        final Entry entry = new Entry("Entry Title", "Has CDATA <>", getTestRootBranch());
        final Element mockRootEl = mock(Element.class);
        final String[] entryProperties = BeanUtils.getProperties(entry, XmlHelper.EXCLUDED_PROPS);
        PowerMockito.mockStatic(BeanUtils.class);
        when(BeanUtils.getProperties(any(), (String[]) any())).thenReturn(entryProperties);
        when(BeanUtils.getProperty(entry, Entry.ID)).thenReturn(0);
View Full Code Here

        super.setUp();

        testSubBranch1 = new Branch(TEST_BRANCH_NAME1, getTestRootBranch());
        testSubBranch1.setBranchId(TEST_SUBBRANCH1_ID);

        testEntry = new Entry(null, null, testSubBranch1);
        testEntry.setNodeId(TEST_ENTRY_ID);
        testEntry.setTitle(TEST_ENTRY_TITLE);
        testEntry.setDescription(TEST_ENTRY_DETAIL);

        testSubBranch2 = new Branch(TEST_BRANCH_NAME2, getTestRootBranch());
View Full Code Here

        }
        final Branch branch = getDaoFacade().getBranchDAO().read(branchId);
        if (branch == null) {
            throw new IllegalArgumentException("Branch ID: " + branchId + " was not found in the datasource.");
        }
        Entry entry = getDaoFacade().getEntryDAO().read(entryId);
        if (entry == null) {
            entry = new Entry(title, description, branch);
            entry.setCreator((User) session.get(Constant.CURRENT_USER));
        } else {
            entry.setUpdater((User) session.get(Constant.CURRENT_USER));
            entry.setBranch(branch);
        }

        entry.setDescription(description);
        entry.setTitle(title);
        getDaoFacade().getEntryDAO().save(entry);
        return entry.getNodeId();
    }
View Full Code Here

    public void moveEntry(final Map<String, Object> session, final long newParentId, final long entryId)
    {
        final EntryDAO entryDao = getDaoFacade().getEntryDAO();
        final BranchDAO branchDao = getDaoFacade().getBranchDAO();

        final Entry entry = entryDao.read(entryId);
        final Branch parent = branchDao.read(newParentId);
        if (entry == null || parent == null) {
            throw new IllegalArgumentException(Error.IAE_GENERIC);
        } else {
            entry.setBranch(parent);
            entryDao.save(entry);
        }
    }
View Full Code Here

    {
        if (newTitle == null || "".equals(newTitle)) {
            throw new IllegalArgumentException(Error.IAE_NULLOREMPTY);
        } else {
            final EntryDAO entryDao = getDaoFacade().getEntryDAO();
            final Entry entry = entryDao.read(entryId);
            if (entry == null) {
                throw new IllegalArgumentException("Entry ID: " + entryId + " was not found.");
            } else {
                entry.setTitle(newTitle);
                entryDao.save(entry);
            }
        }
    }
View Full Code Here

    }

    @Override
    public void delete(final long entryId)
    {
        final Entry entry = super.readObject(Entry.ID, entryId);
        if (entry == null) {
            throw new JournalException("Delete failed for entryId [" + entryId + "]", "The object with the entryId ["
                    + entryId + "] was not found in the datastore.", "Cannot find [" + entryId + "]");
        }
        super.delete(entry);
View Full Code Here

TOP

Related Classes of com.philip.journal.home.bean.Entry

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.