[JBoss JIRA] (FORGE-1620) Command constraint-new-payload to create a new payload
by Antonio Goncalves (JIRA)
Antonio Goncalves created FORGE-1620:
----------------------------------------
Summary: Command constraint-new-payload to create a new payload
Key: FORGE-1620
URL: https://issues.jboss.org/browse/FORGE-1620
Project: Forge
Issue Type: Sub-task
Components: Scaffold
Affects Versions: 2.1.1.Final
Reporter: Antonio Goncalves
Fix For: 2.x Future
It would be nice to have a command to create a new Payload. It's quite easy to generate and would help :
{code}
constraint-new-payload --named Error
{code}
Will generate :
{code}
public class Error implements Payload {
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 1 month
[JBoss JIRA] (FORGE-1619) Command constraint-new-group to create a new group
by Antonio Goncalves (JIRA)
Antonio Goncalves created FORGE-1619:
----------------------------------------
Summary: Command constraint-new-group to create a new group
Key: FORGE-1619
URL: https://issues.jboss.org/browse/FORGE-1619
Project: Forge
Issue Type: Sub-task
Components: Scaffold
Affects Versions: 2.1.1.Final
Reporter: Antonio Goncalves
Fix For: 2.x Future
It would be nice to have a command to create a new group. It's quite easy to generate and would help :
{code}
constraint-new-group --named Payment
{code}
Will generate :
{code}
public interface Payment {
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 1 month
[JBoss JIRA] (FORGE-1616) Command constraint-new-constraint to create a new constraint
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/FORGE-1616?page=com.atlassian.jira.plugin... ]
George Gastaldi updated FORGE-1616:
-----------------------------------
Labels: Starter (was: )
> Command constraint-new-constraint to create a new constraint
> ------------------------------------------------------------
>
> Key: FORGE-1616
> URL: https://issues.jboss.org/browse/FORGE-1616
> Project: Forge
> Issue Type: Sub-task
> Components: Java EE
> Affects Versions: 2.1.1.Final
> Reporter: Antonio Goncalves
> Labels: Starter
> Fix For: 2.x Future
>
>
> This allows the developer to create a constraint (with or without implementation) with a default error message (as a resource bundle).
> h2. Constraint with no implementation
> The following command will create a *constraint annotation* with no implementation, and a default *error message* :
> {code}
> constraint-new-constraint --named URL
> {code}
> This command first creates the constraint annotation (notice validatedBy = {})
> {code}
> @Documented
> @Constraint(validatedBy = {})
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> public @interface URL {
> String message() default "{org.mycompany.myproject.constraints.URL.message}";
> Class<?>[] groups() default { };
> Class<? extends Payload>[] payload() default { };
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @Documented
> public @interface List {
> URL[] value();
> }
> }
> {code}
> Then, it creates a message entry in the {{ValidationMessages.properties}} file (the file is created under {{resources}} directory if it doesn't already exist)
> {code}
> org.mycompany.myproject.constraints.URL.message=invalid URL
> {code}
> We could have attributes to the command to change the target
> {code}
> constraint-new-constraint --named URL --targets METHOD FIELD
> {code}
> This will generate the following code only with @Target METHOD, FIELD
> {code}
> @Documented
> @Constraint(validatedBy = {})
> @Target( { METHOD, FIELD })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> public @interface URL {
> String message() default "{org.mycompany.myproject.constraints.URL.message}";
> Class<?>[] groups() default { };
> Class<? extends Payload>[] payload() default { };
> @Target( { METHOD, FIELD })
> @Retention(RUNTIME)
> @Documented
> public @interface List {
> URL[] value();
> }
> }
> {code}
>
> h2. Constraint with an implementation
> The {{constraint-new-constraint}} can have a {{validatedBy}} and a {{type}} attribute, it will then create a *constraint annotation*, an *error message*, and a default *implementation* :
> {code}
> constraint-new-constraint --named URL --validatedBy URLValidator --type String
> {code}
> The constraint will now refer to the implementation class {{URLValidator.class}} :
> {code}
> @Documented
> @Constraint(validatedBy = URLValidator.class)
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> public @interface URL {
> String message() default "{org.mycompany.myproject.constraints.URL.message}";
> Class<?>[] groups() default { };
> Class<? extends Payload>[] payload() default { };
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @Documented
> public @interface List {
> URL[] value();
> }
> }
> {code}
> And the default implementation will look like :
> {code}
> public class URLValidator implements ConstraintValidator<URL, String> {
> @Override
> public void initialize(URL url) {
> }
> @Override
> public boolean isValid(String value, ConstraintValidatorContext context) {
> return false;
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 1 month
[JBoss JIRA] (FORGE-1618) Command constraint-new-validator to create a new validator implementation
by Antonio Goncalves (JIRA)
Antonio Goncalves created FORGE-1618:
----------------------------------------
Summary: Command constraint-new-validator to create a new validator implementation
Key: FORGE-1618
URL: https://issues.jboss.org/browse/FORGE-1618
Project: Forge
Issue Type: Sub-task
Components: Scaffold
Affects Versions: 2.1.1.Final
Reporter: Antonio Goncalves
Fix For: 2.x Future
An existing constraint can have several implementations of different types. The following commands will create two implementations of the {{Max}} constraints: one for type {{Number}} and one for {{String}} :
{code}
constraint-new-validator --named MaxValidatorForNumber --type Number --targetConstraint Max
constraint-new-validator --named MaxValidatorForString --type String --targetConstraint Max
{code}
The generated code would look like this for Number :
{code}
public class MaxValidatorForString implements ConstraintValidator<Max, Number> {
@Override
public void initialize(URL url) {
}
@Override
public boolean isValid(Number value, ConstraintValidatorContext context) {
return false;
}
}
{code}
And like that for String :
{code}
public class MaxValidatorForString implements ConstraintValidator<Max, String> {
@Override
public void initialize(URL url) {
}
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
return false;
}
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 1 month
[JBoss JIRA] (FORGE-1616) Command constraint-new-constraint to create a new constraint
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/FORGE-1616?page=com.atlassian.jira.plugin... ]
George Gastaldi updated FORGE-1616:
-----------------------------------
Component/s: Java EE
(was: Scaffold)
> Command constraint-new-constraint to create a new constraint
> ------------------------------------------------------------
>
> Key: FORGE-1616
> URL: https://issues.jboss.org/browse/FORGE-1616
> Project: Forge
> Issue Type: Sub-task
> Components: Java EE
> Affects Versions: 2.1.1.Final
> Reporter: Antonio Goncalves
> Fix For: 2.x Future
>
>
> This allows the developer to create a constraint (with or without implementation) with a default error message (as a resource bundle).
> h2. Constraint with no implementation
> The following command will create a *constraint annotation* with no implementation, and a default *error message* :
> {code}
> constraint-new-constraint --named URL
> {code}
> This command first creates the constraint annotation (notice validatedBy = {})
> {code}
> @Documented
> @Constraint(validatedBy = {})
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> public @interface URL {
> String message() default "{org.mycompany.myproject.constraints.URL.message}";
> Class<?>[] groups() default { };
> Class<? extends Payload>[] payload() default { };
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @Documented
> public @interface List {
> URL[] value();
> }
> }
> {code}
> Then, it creates a message entry in the {{ValidationMessages.properties}} file (the file is created under {{resources}} directory if it doesn't already exist)
> {code}
> org.mycompany.myproject.constraints.URL.message=invalid URL
> {code}
> We could have attributes to the command to change the target
> {code}
> constraint-new-constraint --named URL --targets METHOD FIELD
> {code}
> This will generate the following code only with @Target METHOD, FIELD
> {code}
> @Documented
> @Constraint(validatedBy = {})
> @Target( { METHOD, FIELD })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> public @interface URL {
> String message() default "{org.mycompany.myproject.constraints.URL.message}";
> Class<?>[] groups() default { };
> Class<? extends Payload>[] payload() default { };
> @Target( { METHOD, FIELD })
> @Retention(RUNTIME)
> @Documented
> public @interface List {
> URL[] value();
> }
> }
> {code}
>
> h2. Constraint with an implementation
> The {{constraint-new-constraint}} can have a {{validatedBy}} and a {{type}} attribute, it will then create a *constraint annotation*, an *error message*, and a default *implementation* :
> {code}
> constraint-new-constraint --named URL --validatedBy URLValidator --type String
> {code}
> The constraint will now refer to the implementation class {{URLValidator.class}} :
> {code}
> @Documented
> @Constraint(validatedBy = URLValidator.class)
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> public @interface URL {
> String message() default "{org.mycompany.myproject.constraints.URL.message}";
> Class<?>[] groups() default { };
> Class<? extends Payload>[] payload() default { };
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @Documented
> public @interface List {
> URL[] value();
> }
> }
> {code}
> And the default implementation will look like :
> {code}
> public class URLValidator implements ConstraintValidator<URL, String> {
> @Override
> public void initialize(URL url) {
> }
> @Override
> public boolean isValid(String value, ConstraintValidatorContext context) {
> return false;
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 1 month
[JBoss JIRA] (FORGE-1617) Command constraint-new-field to add a new field to an existing constraint
by Antonio Goncalves (JIRA)
Antonio Goncalves created FORGE-1617:
----------------------------------------
Summary: Command constraint-new-field to add a new field to an existing constraint
Key: FORGE-1617
URL: https://issues.jboss.org/browse/FORGE-1617
Project: Forge
Issue Type: Sub-task
Components: Scaffold
Affects Versions: 2.1.1.Final
Reporter: Antonio Goncalves
Fix For: 2.x Future
Some constraints need to have fields (attributes). For example, the {{URL}} constraint needs three fields : a protocol, a host, and a port :
{code}
constraint-new-field --named protocol --type String --targetConstraint URL
constraint-new-field --named host --type String --targetConstraint URL
constraint-new-field --named port --type String --targetConstraint URL
{code}
This will add the three attributes to the existing constraint {{URL}} :
{code}
@Documented
@Constraint(validatedBy = URLValidator.class)
@Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@ReportAsSingleViolation
public @interface URL {
String message() default "{org.mycompany.myproject.constraints.URL.message}";
Class<?>[] groups() default { };
Class<? extends Payload>[] payload() default { };
String protocol() default "";
String host() default "";
int port() default -1;
@Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@Documented
public @interface List {
URL[] value();
}
}
{code}
But it will also add the three attributes to the implementation : attributes and {{initialize}} method :
{code}
public class URLValidator implements ConstraintValidator<URL, String> {
private String protocol;
private String host;
private int port;
@Override
public void initialize(URL url) {
this.protocol = url.protocol();
this.host = url.host();
this.port = url.port();
}
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
return false;
}
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 1 month
[JBoss JIRA] (FORGE-1616) Command constraint-new-constraint to create a new constraint
by Antonio Goncalves (JIRA)
Antonio Goncalves created FORGE-1616:
----------------------------------------
Summary: Command constraint-new-constraint to create a new constraint
Key: FORGE-1616
URL: https://issues.jboss.org/browse/FORGE-1616
Project: Forge
Issue Type: Sub-task
Components: Scaffold
Affects Versions: 2.1.1.Final
Reporter: Antonio Goncalves
Fix For: 2.x Future
This allows the developer to create a constraint (with or without implementation) with a default error message (as a resource bundle).
h2. Constraint with no implementation
The following command will create a *constraint annotation* with no implementation, and a default *error message* :
{code}
constraint-new-constraint --named URL
{code}
This command first creates the constraint annotation (notice validatedBy = {})
{code}
@Documented
@Constraint(validatedBy = {})
@Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@ReportAsSingleViolation
public @interface URL {
String message() default "{org.mycompany.myproject.constraints.URL.message}";
Class<?>[] groups() default { };
Class<? extends Payload>[] payload() default { };
@Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@Documented
public @interface List {
URL[] value();
}
}
{code}
Then, it creates a message entry in the {{ValidationMessages.properties}} file (the file is created under {{resources}} directory if it doesn't already exist)
{code}
org.mycompany.myproject.constraints.URL.message=invalid URL
{code}
We could have attributes to the command to change the target
{code}
constraint-new-constraint --named URL --targets METHOD FIELD
{code}
This will generate the following code only with @Target METHOD, FIELD
{code}
@Documented
@Constraint(validatedBy = {})
@Target( { METHOD, FIELD })
@Retention(RUNTIME)
@ReportAsSingleViolation
public @interface URL {
String message() default "{org.mycompany.myproject.constraints.URL.message}";
Class<?>[] groups() default { };
Class<? extends Payload>[] payload() default { };
@Target( { METHOD, FIELD })
@Retention(RUNTIME)
@Documented
public @interface List {
URL[] value();
}
}
{code}
h2. Constraint with an implementation
The {{constraint-new-constraint}} can have a {{validatedBy}} and a {{type}} attribute, it will then create a *constraint annotation*, an *error message*, and a default *implementation* :
{code}
constraint-new-constraint --named URL --validatedBy URLValidator --type String
{code}
The constraint will now refer to the implementation class {{URLValidator.class}} :
{code}
@Documented
@Constraint(validatedBy = URLValidator.class)
@Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@ReportAsSingleViolation
public @interface URL {
String message() default "{org.mycompany.myproject.constraints.URL.message}";
Class<?>[] groups() default { };
Class<? extends Payload>[] payload() default { };
@Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@Documented
public @interface List {
URL[] value();
}
}
{code}
And the default implementation will look like :
{code}
public class URLValidator implements ConstraintValidator<URL, String> {
@Override
public void initialize(URL url) {
}
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
return false;
}
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 1 month
[JBoss JIRA] (FORGE-1614) New JPA entity command does not warn if existing entities are overwritten
by Vineet Reynolds (JIRA)
Vineet Reynolds created FORGE-1614:
--------------------------------------
Summary: New JPA entity command does not warn if existing entities are overwritten
Key: FORGE-1614
URL: https://issues.jboss.org/browse/FORGE-1614
Project: Forge
Issue Type: Feature Request
Components: Java EE
Affects Versions: 2.1.1.Final
Reporter: Vineet Reynolds
When a new JPA entity is created, no warnings are issued when the name of the user-supplied entity matches an already existing entity. The existing entity is lost including any fields, and a new one is created in it's place.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 1 month