[JBoss JIRA] (FORGE-1792) Add scopes to a the faces-new-bean command
by Antonio Goncalves (JIRA)
[ https://issues.jboss.org/browse/FORGE-1792?page=com.atlassian.jira.plugin... ]
Antonio Goncalves updated FORGE-1792:
-------------------------------------
Parent Issue: FORGE-1926 (was: FORGE-1593)
> Add scopes to a the faces-new-bean command
> ------------------------------------------
>
> Key: FORGE-1792
> URL: https://issues.jboss.org/browse/FORGE-1792
> Project: Forge
> Issue Type: Sub-task
> Security Level: Public(Everyone can see)
> Components: Java EE
> Affects Versions: 2.5.0.Final
> Reporter: Antonio Goncalves
> Fix For: 2.x Future
>
>
> The command {{faces-new-bean}} should be able to add a scope. Then, depending on the scope, the generated code would be different (e.g. implements Serializable for most of the other stateful scopes)
> {code}
> faces-new-bean --named MyBean --scoped Conversation
> {code}
> This would generate the following code
> {code}
> @Named
> @ConversationScoped
> public class MyBean implements Serializable {
> @Inject
> private Conversation conversation;
> public String begin() {
> conversation.begin();
> }
> public String end() {
> conversation.end();
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 6 months
[JBoss JIRA] (FORGE-1594) Being able to create an empty JSF page
by Antonio Goncalves (JIRA)
[ https://issues.jboss.org/browse/FORGE-1594?page=com.atlassian.jira.plugin... ]
Antonio Goncalves updated FORGE-1594:
-------------------------------------
Parent Issue: FORGE-1926 (was: FORGE-1593)
> Being able to create an empty JSF page
> --------------------------------------
>
> Key: FORGE-1594
> URL: https://issues.jboss.org/browse/FORGE-1594
> Project: Forge
> Issue Type: Sub-task
> Security Level: Public(Everyone can see)
> Components: Scaffold
> Affects Versions: 2.0.0.Final
> Reporter: Antonio Goncalves
> Assignee: Antonio Goncalves
> Priority: Minor
> Fix For: 2.x Future
>
>
> At the moment the only way to generate JSF pages is with scaffolding. When you create an application, you realize that these scaffolded pages are not enough and that you need to create new ones. To save time and help the developer in creating new pages, it would be good to have a command such :
> {code}
> faces-new-view --named mypage
> {code}
> This will create a mypage.xhtml on the root of the webapp directory. You could also give a different directory with :
> {code}
> faces-new-view --named mypage --targetDirectory admin
> {code}
> This will create the page under webapp/admin/mypage.xhtml.
> {code}
> <?xml version='1.0' encoding='UTF-8' ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <ui:composition xmlns="http://www.w3.org/1999/xhtml"
> xmlns:h="http://xmlns.jcp.org/jsf/html"
> xmlns:f="http://xmlns.jcp.org/jsf/core"
> xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
> template="/resources/scaffold/pageTemplate.xhtml">
> <ui:param name="pageTitle" value="mypage"/>
> <ui:define name="header">
> mypage
> </ui:define>
> <ui:define name="subheader">
> mypage
> </ui:define>
> <ui:define name="footer"/>
> <ui:define name="main">
> </ui:define>
> </ui:composition>
> {code}
> The name of the page {{mypage}} is used for the title, header, subheader. But we could customize this using optional attributes for title, header, subheader :
> {code}
> faces-new-view --named mypage --targetDirectory admin --title Administration Page --header Admin Header --subheader Admin Sub Header
> {code}
> It would just create a minimum JSF page such as :
> {code}
> <?xml version='1.0' encoding='UTF-8' ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <ui:composition xmlns="http://www.w3.org/1999/xhtml"
> xmlns:h="http://xmlns.jcp.org/jsf/html"
> xmlns:f="http://xmlns.jcp.org/jsf/core"
> xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
> template="/resources/scaffold/pageTemplate.xhtml">
> <ui:param name="pageTitle" value="Administration Page"/>
> <ui:define name="header">
> Admin Header
> </ui:define>
> <ui:define name="subheader">
> Admin Sub Header
> </ui:define>
> <ui:define name="footer"/>
> <ui:define name="main">
> </ui:define>
> </ui:composition>
> {code}
> If there were several templates, we could do :
> {code}
> faces-new-view --named mypage --template MyTemplate.xhtml
> {code}
> PS : I'm on holidays skiing, and the internet connection is really bad. So I could search for similar JIRAs if they existed
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 6 months
[JBoss JIRA] (FORGE-1667) Improve the constraint-new-annotation command
by Antonio Goncalves (JIRA)
[ https://issues.jboss.org/browse/FORGE-1667?page=com.atlassian.jira.plugin... ]
Antonio Goncalves updated FORGE-1667:
-------------------------------------
Parent Issue: FORGE-1926 (was: FORGE-1615)
> Improve the constraint-new-annotation command
> ----------------------------------------------
>
> Key: FORGE-1667
> URL: https://issues.jboss.org/browse/FORGE-1667
> Project: Forge
> Issue Type: Sub-task
> Security Level: Public(Everyone can see)
> Components: Java EE
> Affects Versions: 2.1.1.Final
> Reporter: Antonio Goncalves
> Fix For: 2.x Future
>
>
> Splitting [FORGE-1667] so it's easier to implement step by step
> See : NewAnnotationCommand and NewAnnotationCommandTest
> This allows to add extra features to the {{constraint-new-annotation}} command.
> h2. Adding resource bundle message
> At the moment, the command create a *constraint annotation* with no implementation, and a default *error message*. It would be good to add a resource bundle key for the message :
> {code}
> constraint-new-annotation --named URL
> {code}
> {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-annotation --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-annotation}} 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-annotation --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 was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 6 months
[JBoss JIRA] (FORGE-1801) Being able to add a custom annotation to a property
by Antonio Goncalves (JIRA)
[ https://issues.jboss.org/browse/FORGE-1801?page=com.atlassian.jira.plugin... ]
Antonio Goncalves updated FORGE-1801:
-------------------------------------
Parent Issue: FORGE-1926 (was: FORGE-1615)
> Being able to add a custom annotation to a property
> ---------------------------------------------------
>
> Key: FORGE-1801
> URL: https://issues.jboss.org/browse/FORGE-1801
> Project: Forge
> Issue Type: Sub-task
> Security Level: Public(Everyone can see)
> Components: Java EE
> Affects Versions: 2.5.0.Final
> Reporter: Antonio Goncalves
> Fix For: 2.x Future
>
>
> With [FORGE-1616] I can now create my own constraint. For example, this is the way I create an ISBN constraint :
> {code}
> constraint-new-annotation --named ISBN
> {code}
> The constraint is created, by default, under the {{constraint}} package. Now the problem, is that I can't apply it to a property because the constraint is not known. If I add a constraint, and press TAB for completion, ISBN does not appear :
> {code}
> [Book.java]$ constraint-add --onProperty isbn --constraint TAB
> Valid Null NotNull AssertTrue AssertFalse Min Max DecimalMin DecimalMax Size Digits Past Future Pattern
> {code}
> Even if I try to add the location of the constraint, it does not work :
> {code}
> [Book.java]$ constraint-add --onProperty isbn --constraint ../constraints/ISBN
> [0] - Valid
> [1] - Null
> [2] - NotNull
> [3] - AssertTrue
> [4] - AssertFalse
> [5] - Min
> [6] - Max
> [7] - DecimalMin
> [8] - DecimalMax
> [9] - Size
> [10] - Digits
> [11] - Past
> [12] - Future
> [13] - Pattern
> ***ERROR*** Constraint must be specified.
> {code}
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 6 months
[JBoss JIRA] (FORGE-1618) Command constraint-new-validator to create a new validator implementation
by Antonio Goncalves (JIRA)
[ https://issues.jboss.org/browse/FORGE-1618?page=com.atlassian.jira.plugin... ]
Antonio Goncalves updated FORGE-1618:
-------------------------------------
Parent Issue: FORGE-1926 (was: FORGE-1615)
> 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
> Security Level: Public(Everyone can see)
> Components: Java EE
> 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(Max constraint) {
> }
> @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(Max constraint) {
> }
> @Override
> public boolean isValid(String value, ConstraintValidatorContext context) {
> return false;
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 6 months
[JBoss JIRA] (FORGE-1617) Command constraint-new-field to add a new field to an existing constraint
by Antonio Goncalves (JIRA)
[ https://issues.jboss.org/browse/FORGE-1617?page=com.atlassian.jira.plugin... ]
Antonio Goncalves updated FORGE-1617:
-------------------------------------
Parent Issue: FORGE-1926 (was: FORGE-1615)
> 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
> Security Level: Public(Everyone can see)
> Components: Java EE
> 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 was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 6 months
[JBoss JIRA] (FORGE-1926) Adding more commands to Forge
by Antonio Goncalves (JIRA)
Antonio Goncalves created FORGE-1926:
----------------------------------------
Summary: Adding more commands to Forge
Key: FORGE-1926
URL: https://issues.jboss.org/browse/FORGE-1926
Project: Forge
Issue Type: Task
Security Level: Public (Everyone can see)
Components: UI - Shell
Affects Versions: 2.7.0.Final
Reporter: Antonio Goncalves
Fix For: 2.x Future
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 6 months