Examples of ModelDef


Examples of org.auraframework.def.ModelDef

     * Verify that accessing a non-existing property on model throws Exception.
     */
    public void testNonExistingPropertiesOnModel() throws Exception {
        DefDescriptor<ModelDef> javaModelDefDesc = DefDescriptorImpl.getInstance(
                "java://org.auraframework.impl.java.model.TestModel", ModelDef.class);
        ModelDef mDef = javaModelDefDesc.getDef();
        assertNotNull(mDef);
        Model model = mDef.newInstance();
        try {
            model.getValue(new PropertyReferenceImpl("fooBar", new Location("test", 0)));
            fail("Model should not be able to getValue of a non existing property.");
        } catch (Exception e) {
            checkExceptionStart(e, AuraExecutionException.class, "TestModel: no such property: fooBar",
View Full Code Here

Examples of org.slim3.gen.task.GenModelTask.ModelDef

     * @throws IOException
     * @throws XPathExpressionException
     */
    protected DaoDesc createDaoDesc() throws IOException,
            XPathExpressionException {
        ModelDef modelDef = parse(modelDefinition);
        String basePackageName = getBasePackageName();
        String modelPackageName = basePackageName + "." + Constants.MODEL_PACKAGE;
        String daoPackageName = basePackageName + "." + Constants.DAO_PACKAGE;
        String daoSimpleClassName = modelDef.modelRelativeClassName + Constants.DAO_SUFFIX;

View Full Code Here

Examples of org.slim3.gen.task.GenModelTask.ModelDef

     * @throws Exception
     */
    @Test
    public void testParse() throws Exception {
        GenModelTask task = new GenModelTask();
        ModelDef parsedText = task.parse("Hoge extends Foo");
        assertThat(parsedText.modelRelativeClassName, is("Hoge"));
        assertThat(parsedText.modelRelativeSuperclassName, is("Foo"));
    }
View Full Code Here

Examples of xdoclet.modules.ojb.model.ModelDef

                throw new ConstraintException("Collection "+collDef.getName()+" in class "+collDef.getOwner().getName()+" does not specify its element class");
            }
        }

        // now checking the element type
        ModelDef           model            = (ModelDef)collDef.getOwner().getOwner();
        String             elementClassName = collDef.getProperty(PropertyHelper.OJB_PROPERTY_ELEMENT_CLASS_REF);
        ClassDescriptorDef elementClassDef  = model.getClass(elementClassName);

        if (elementClassDef == null)
        {
            throw new ConstraintException("Collection "+collDef.getName()+" in class "+collDef.getOwner().getName()+" references an unknown class "+elementClassName);
        }
View Full Code Here

Examples of xdoclet.modules.ojb.model.ModelDef

        }

        if (CHECKLEVEL_STRICT.equals(checkLevel))
        {   
            InheritanceHelper helper         = new InheritanceHelper();
            ModelDef          model          = (ModelDef)collDef.getOwner().getOwner();
            String            specifiedClass = collDef.getProperty(PropertyHelper.OJB_PROPERTY_COLLECTION_CLASS);
            String            variableType   = collDef.getProperty(PropertyHelper.OJB_PROPERTY_VARIABLE_TYPE);
   
            try
            {
View Full Code Here

Examples of xdoclet.modules.ojb.model.ModelDef

     * @param collDef The collection
     * @return The corresponding remote collection
     */
    private CollectionDescriptorDef findRemoteCollection(CollectionDescriptorDef collDef)
    {
        ModelDef                modelDef      = (ModelDef)collDef.getOwner().getOwner();
        ClassDescriptorDef      elementClass  = modelDef.getClass(collDef.getProperty(PropertyHelper.OJB_PROPERTY_ELEMENT_CLASS_REF));
        String                  indirTable    = collDef.getProperty(PropertyHelper.OJB_PROPERTY_INDIRECTION_TABLE);
        boolean                 hasRemoteKey  = collDef.hasProperty(PropertyHelper.OJB_PROPERTY_REMOTE_FOREIGNKEY);
        String                  remoteKey     = collDef.getProperty(PropertyHelper.OJB_PROPERTY_REMOTE_FOREIGNKEY);
        CollectionDescriptorDef remoteCollDef = null;

View Full Code Here

Examples of xdoclet.modules.ojb.model.ModelDef

                throw new ConstraintException("Collection "+collDef.getName()+" in class "+collDef.getOwner().getName()+" does not specify its element class");
            }
        }

        // now checking the element type
        ModelDef           model            = (ModelDef)collDef.getOwner().getOwner();
        String             elementClassName = collDef.getProperty(PropertyHelper.OJB_PROPERTY_ELEMENT_CLASS_REF);
        ClassDescriptorDef elementClassDef  = model.getClass(elementClassName);

        if (elementClassDef == null)
        {
            throw new ConstraintException("Collection "+collDef.getName()+" in class "+collDef.getOwner().getName()+" references an unknown class "+elementClassName);
        }
View Full Code Here

Examples of xdoclet.modules.ojb.model.ModelDef

        }

        if (CHECKLEVEL_STRICT.equals(checkLevel))
        {   
            InheritanceHelper helper         = new InheritanceHelper();
            ModelDef          model          = (ModelDef)collDef.getOwner().getOwner();
            String            specifiedClass = collDef.getProperty(PropertyHelper.OJB_PROPERTY_COLLECTION_CLASS);
            String            variableType   = collDef.getProperty(PropertyHelper.OJB_PROPERTY_VARIABLE_TYPE);
   
            try
            {
View Full Code Here

Examples of xdoclet.modules.ojb.model.ModelDef

            }
        }

        // now checking the type
        ClassDescriptorDef ownerClassDef   = (ClassDescriptorDef)refDef.getOwner();
        ModelDef           model           = (ModelDef)ownerClassDef.getOwner();
        String             targetClassName = refDef.getProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF);
        ClassDescriptorDef targetClassDef  = model.getClass(targetClassName);

        if (targetClassDef == null)
        {
            throw new ConstraintException("The class "+targetClassName+" referenced by "+refDef.getName()+" in class "+ownerClassDef.getName()+" is unknown or not persistent");
        }
        if (!targetClassDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_OJB_PERSISTENT, false))
        {
            throw new ConstraintException("The class "+targetClassName+" referenced by "+refDef.getName()+" in class "+ownerClassDef.getName()+" is not persistent");
        }
       
        if (CHECKLEVEL_STRICT.equals(checkLevel))
        {
            try
            {
                InheritanceHelper helper = new InheritanceHelper();

                if (refDef.isAnonymous())
                {
                    // anonymous reference: class must be a baseclass of the owner class
                    if (!helper.isSameOrSubTypeOf(ownerClassDef, targetClassDef.getName(), true))
                    {
                        throw new ConstraintException("The class "+targetClassName+" referenced by the anonymous reference "+refDef.getName()+" in class "+ownerClassDef.getName()+" is not a basetype of the class");
                    }
                }
                else
                {   
                    // specified element class must be a subtype of the variable type (if it exists, i.e. not for anonymous references)
                    String  varType      = refDef.getProperty(PropertyHelper.OJB_PROPERTY_VARIABLE_TYPE);
                    boolean performCheck = true;
   
                    // but we first check whether there is a useable type for the the variable type
                    if (model.getClass(varType) == null)
                    {
                        try
                        {
                            InheritanceHelper.getClass(varType);
                        }
View Full Code Here

Examples of xdoclet.modules.ojb.model.ModelDef

                throw new ConstraintException("Collection "+collDef.getName()+" in class "+collDef.getOwner().getName()+" does not specify its element class");
            }
        }

        // now checking the element type
        ModelDef           model            = (ModelDef)collDef.getOwner().getOwner();
        String             elementClassName = collDef.getProperty(PropertyHelper.OJB_PROPERTY_ELEMENT_CLASS_REF);
        ClassDescriptorDef elementClassDef  = model.getClass(elementClassName);

        if (elementClassDef == null)
        {
            throw new ConstraintException("Collection "+collDef.getName()+" in class "+collDef.getOwner().getName()+" references an unknown class "+elementClassName);
        }
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.