cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Menard <nirvd...@gmail.com>
Subject Re: svn commit: r894431 - /cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
Date Tue, 29 Dec 2009 16:33:37 GMT
Hi Olga,

Small nitpick, but could you please include the issue summary along with the
issue key in the commit message?  It makes it a lot easier for those of us
unfamiliar with the issue to get some context for the commit.

-- 
Kevin


On Tue, Dec 29, 2009 at 11:25 AM, <oltka@apache.org> wrote:

> Author: oltka
> Date: Tue Dec 29 16:25:47 2009
> New Revision: 894431
>
> URL: http://svn.apache.org/viewvc?rev=894431&view=rev
> Log:
> CAY-1353
>
> fix
>
> Modified:
>
>  cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
>
> Modified:
> cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
> URL:
> http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java?rev=894431&r1=894430&r2=894431&view=diff
>
> ==============================================================================
> ---
> cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
> (original)
> +++
> cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
> Tue Dec 29 16:25:47 2009
> @@ -45,8 +45,6 @@
>  import org.apache.cayenne.pref.Domain;
>  import org.apache.cayenne.pref.PreferenceDetail;
>  import org.apache.cayenne.swing.BindingBuilder;
> -import org.apache.cayenne.swing.BindingDelegate;
> -import org.apache.cayenne.swing.ObjectBinding;
>  import org.apache.cayenne.util.Util;
>  import org.apache.cayenne.validation.BeanValidationFailure;
>  import org.apache.cayenne.validation.SimpleValidationFailure;
> @@ -193,7 +191,7 @@
>             if (attribute instanceof EmbeddedAttribute) {
>                 EmbeddedAttribute embeddedAttribute = (EmbeddedAttribute)
> attribute;
>                 for (ObjAttribute subAttribute :
> embeddedAttribute.getAttributes()) {
> -                    ValidationFailure failure =
> validateAttribute(subAttribute);
> +                    ValidationFailure failure =
> validateEmbeddedAttribute(subAttribute);
>                     if (failure != null) {
>                         validationBuffer.addFailure(failure);
>                         return;
> @@ -295,6 +293,68 @@
>
>         return null;
>     }
> +
> +    protected ValidationFailure validateEmbeddedAttribute(ObjAttribute
> attribute) {
> +
> +        String name = attribute.getEntity().getName();
> +
> +        // validate embeddedAttribute and attribute names
> +        // embeddedAttribute returned attibute as
> [name_embeddedAttribute].[name_attribute]
> +        String[] attributes = attribute.getName().split("\\.");
> +        String nameEmbeddedAttribute = attributes[0];
> +        int beginIndex = attributes[0].length();
> +        String attr = attribute.getName().substring(beginIndex+1);
> +
> +        ValidationFailure emptyEmbeddedName =
> BeanValidationFailure.validateNotEmpty(
> +                name,
> +                "attribute.name",
> +                nameEmbeddedAttribute);
> +        if (emptyEmbeddedName != null) {
> +            return emptyEmbeddedName;
> +        }
> +
> +        ValidationFailure badEmbeddedName =
> CodeValidationUtil.validateJavaIdentifier(
> +                name,
> +                "attribute.name",
> +                nameEmbeddedAttribute);
> +        if (badEmbeddedName != null) {
> +            return badEmbeddedName;
> +        }
> +
> +        ValidationFailure emptyName =
> BeanValidationFailure.validateNotEmpty(
> +                name,
> +                "attribute.name",
> +                attr);
> +        if (emptyName != null) {
> +            return emptyName;
> +        }
> +
> +        ValidationFailure badName =
> CodeValidationUtil.validateJavaIdentifier(
> +                name,
> +                "attribute.name",
> +                attr);
> +        if (badName != null) {
> +            return badName;
> +        }
> +
> +        ValidationFailure emptyType =
> BeanValidationFailure.validateNotEmpty(
> +                name,
> +                "attribute.type",
> +                attribute.getType());
> +        if (emptyType != null) {
> +            return emptyType;
> +        }
> +
> +        ValidationFailure badType =
> BeanValidationFailure.validateJavaClassName(
> +                name,
> +                "attribute.type",
> +                attribute.getType());
> +        if (badType != null) {
> +            return badType;
> +        }
> +
> +        return null;
> +    }
>
>     protected ValidationFailure validateRelationship(
>             ObjRelationship relationship,
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message