Package com.philip.journal.home.bean

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


     * @throws XPathExpressionException XPath module exception.
     */
    Branch convertElementToBranch(final Element branchElement, final long parentId) throws XPathExpressionException
    {
        final BranchDAO branchDao = getDaoFacade().getBranchDAO();
        final Branch parent = branchDao.read(parentId);
        if (parent == null || branchElement == null) {
            throw JournalException.wrapperException(new IllegalArgumentException(Messages.Error.IAE_NULL));
        }

        Branch targetBranch = new Branch();
        final String[] branchProperties = BeanUtils.getProperties(targetBranch, EXCLUDED_PROPS);
        for (final String property : branchProperties) {
            final Object val = getElementPropValue(branchElement, BeanUtils.getPropertyType(targetBranch, property),
                    property);
            if (val != null) {
                try {
                    org.apache.commons.beanutils.BeanUtils.setProperty(targetBranch, property, val);
                } catch (final Exception e) {
                    throw new JournalException(e.getMessage(), e);
                }
            }
        }

        targetBranch.setParent(parent);
        final Branch storedBranch = branchDao.readByName(targetBranch.getName(), parentId);
        if (storedBranch == null) {
            targetBranch.setBranchId(0);
            branchDao.save(targetBranch);
        } else {
            targetBranch = storedBranch;
View Full Code Here

TOP

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

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.