Examples of BaseBean


Examples of org.happyfaces.beans.base.BaseBean

public class BaseBeanTest {

    @SuppressWarnings("rawtypes")
    @Test
    public void testInitEntity() {
        BaseBean backingBean = new BaseBean<TestEntity>(TestEntity.class) {
            private static final long serialVersionUID = 1L;
            @Override
            protected IService<TestEntity> getPersistenceService() {
                return new DummyPersistenceService();
            }
        };
       
        // test new instance of TestEntity is created when objectId is not set.
        IEntity initEntity = backingBean.initEntity();
        Assert.assertNotNull(initEntity);
        Assert.assertTrue(initEntity instanceof TestEntity);
        Assert.assertNull(initEntity.getId());
        backingBean.setObjectId(22L);
       
        //
        initEntity = backingBean.initEntity();
        Assert.assertNotNull(initEntity);
        Assert.assertTrue(initEntity instanceof TestEntity);
        Assert.assertEquals(Long.valueOf(22L), initEntity.getId());
       
        // not exist
        backingBean.setObjectId(23L);
        initEntity = backingBean.initEntity();
        Assert.assertNull(initEntity);
    }
View Full Code Here

Examples of org.netbeans.modules.schema2beans.BaseBean

            len = props.length;
        if (len > 0)
            retVal = new java.util.ArrayList();
        for (int i = 0; i < len; i++) {
            // get the bean that is the property's parent.
            BaseBean candidate = gm.getPropertyParent(props[i]);
            if (type.isInstance(candidate))
                retVal.add(candidate);
        }
        return retVal;
    }
View Full Code Here

Examples of org.netbeans.modules.schema2beans.BaseBean

    }


    public int getCardinal(){
        String name = baseBean.name();
        BaseBean parent = baseBean.parent();
        BaseProperty baseProperty = parent.getProperty(name);
        return baseProperty.getInstanceType();
    }
View Full Code Here

Examples of org.netbeans.modules.schema2beans.BaseBean

        ///Object[] arguments = new Object[]{"Name", baseBean.name()};  //NOI18N
        ///System.out.println(MessageFormat.format(format, arguments));
        ///arguments = new Object[]{"FullName", baseBean.fullName()};   //NOI18N
        ///System.out.println(MessageFormat.format(format, arguments));

        BaseBean bean =  baseBean;
        BaseBean parentBean = null;
        String xpath = bean.dtdName();
        ///boolean root =  bean.isRoot();
        boolean root = isRootElement(bean);
        parentBean = bean.parent();
        while(!root){
            xpath = parentBean.dtdName() + Constants.XPATH_DELIMITER + xpath;
            bean = parentBean;
            parentBean = bean.parent();
            ///root = bean.isRoot();
            root = isRootElement(bean);
        }
View Full Code Here

Examples of org.netbeans.modules.schema2beans.BaseBean

        return xpath;
    }


    public String getIndexedXPath() {
        BaseBean bean =  baseBean;
        BaseBean parentBean = null;
        String xpath = bean.dtdName();
        int index = getIndex(baseBean);
        if(index != -1){
            xpath = utils.getIndexedName(xpath,  index);
        }

        boolean root = isRootElement(bean);
        parentBean = bean.parent();

        String name = null;
        while(!root){
            name = parentBean.dtdName();
            index = getIndex(parentBean);
            if(index != -1) {
                name = utils.getIndexedName(name, index);
            }
            xpath = name + Constants.XPATH_DELIMITER + xpath;
View Full Code Here

Examples of org.netbeans.modules.schema2beans.BaseBean

        return xpath;
    }


    boolean isRootElement(BaseBean bean){
        BaseBean parent = bean.parent();
        boolean root;
        if(parent.name().equals(bean.name())){
            root = true;
        } else {
            root = false;
        }
        return root;
View Full Code Here

Examples of org.netbeans.modules.schema2beans.BaseBean

    int getIndex(BaseBean baseBean){
        int index = -1;
        boolean root = isRootElement(baseBean);
        if(!root){
            String name = baseBean.name();
            BaseBean parent = baseBean.parent();
            if(parent != null) {
                index = parent.indexOf(name, baseBean);
            }
        }
        return index;
    }   
View Full Code Here

Examples of org.netbeans.modules.schema2beans.BaseBean

    }
   
    /** helper method */
    private static BaseBean findSingleCompatibleBean(String argOneName, BaseBean argOne, String argTwoName,
            String argTwo, String propName, Class type) {
        BaseBean retVal = null;
        if (null == argTwo || argTwo.length() < 1)
            throw new IllegalArgumentException(argTwoName);
       
        List l = findCompatibleBeansWithValue(argOne, propName, argTwo,
            type);
View Full Code Here

Examples of org.netbeans.modules.schema2beans.BaseBean

            len = props.length;
        if (len > 0)
            retVal = new ArrayList();
        for (int i = 0; i < len; i++) {
            // get the bean that is the property's parent.
            BaseBean candidate = gm.getPropertyParent(props[i]);
            if (type.isInstance(candidate))
                retVal.add(candidate);
        }
        return retVal;
    }
View Full Code Here

Examples of org.netbeans.modules.schema2beans.BaseBean

    }
   
    /** helper method */
    private static BaseBean findSingleCompatibleBean(String argOneName, BaseBean argOne, String argTwoName,
            String argTwo, String propName, Class type) {
        BaseBean retVal = null;
        if (null == argTwo || argTwo.length() < 1)
            throw new IllegalArgumentException(argTwoName);
       
        List l = findCompatibleBeansWithValue(argOne, propName, argTwo,
            type);
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.