You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2009/03/02 05:48:48 UTC
svn commit: r749184 - in
/myfaces/extensions/validator/branches/beanval_integration/trunk:
examples/hello_world/src/main/java/org/apache/myfaces/blank/
validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/
va...
Author: gpetracek
Date: Mon Mar 2 04:48:47 2009
New Revision: 749184
URL: http://svn.apache.org/viewvc?rev=749184&view=rev
Log:
first idea for group validation via annotations
Added:
myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/WebXmlParameter.java
myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/
myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/extractor/
myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/extractor/DefaultGroupControllerScanningExtractor.java
myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/
myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/BeanValidationController.java
myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/GroupValidationKeys.java
myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/ValidateGroup.java
Modified:
myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptor.java
myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/ExtValBeanValidationContext.java
Modified: myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java?rev=749184&r1=749183&r2=749184&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java (original)
+++ myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java Mon Mar 2 04:48:47 2009
@@ -19,13 +19,16 @@
package org.apache.myfaces.blank;
import org.apache.myfaces.blank.domain.Person;
+import org.apache.myfaces.extensions.validator.beanval.annotation.group.BeanValidationController;
/**
* A typical simple backing bean, that is backed to <code>helloworld.jsp</code>
*
*/
+@BeanValidationController
public class HelloWorldController
{
+ //@BeanValidationController(@ValidateGroup(viewId = "/page2.jsp"))
private Person person = new Person();
/**
Modified: myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptor.java?rev=749184&r1=749183&r2=749184&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptor.java (original)
+++ myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptor.java Mon Mar 2 04:48:47 2009
@@ -27,10 +27,14 @@
import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
import org.apache.myfaces.extensions.validator.core.interceptor.AbstractRendererInterceptor;
import org.apache.myfaces.extensions.validator.util.ExtValUtils;
import org.apache.myfaces.extensions.validator.beanval.interceptor.PropertyValidationInterceptor;
import org.apache.myfaces.extensions.validator.beanval.property.BeanValidationPropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.beanval.annotation.group.BeanValidationController;
+import org.apache.myfaces.extensions.validator.beanval.annotation.group.ValidateGroup;
+import org.apache.myfaces.extensions.validator.beanval.annotation.extractor.DefaultGroupControllerScanningExtractor;
import org.apache.myfaces.extensions.validator.internal.ToDo;
import org.apache.myfaces.extensions.validator.internal.Priority;
@@ -44,7 +48,11 @@
import javax.validation.Validation;
import javax.validation.ValidatorFactory;
import javax.validation.ConstraintViolation;
+import javax.validation.GroupSequence;
import java.util.Set;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.io.IOException;
/**
@@ -110,6 +118,8 @@
MetaDataExtractor metaDataExtractor = ExtValUtils.getComponentMetaDataExtractor();
PropertyInformation propertyInformation = metaDataExtractor.extract(facesContext, uiComponent);
+
+ addGroupsToContext(propertyInformation, uiComponent.getClientId(facesContext));
Class baseBeanClass = (propertyInformation.getInformation(
PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class)).getBaseObject().getClass();
@@ -180,4 +190,76 @@
logger.trace("jsr303 validation finished");
}
}
+
+ private void addGroupsToContext(PropertyInformation propertyInformation, String clientId)
+ {
+ PropertyDetails propertyDetails = propertyInformation
+ .getInformation(PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class);
+
+ String[] key = propertyDetails.getKey().split("\\.");
+
+ Object firstBean = ExtValUtils.getELHelper().getBean(key[0]);
+
+ List<GroupSequence> foundGroupSequencesForCurrentView = new ArrayList<GroupSequence>();
+
+ processClass(firstBean.getClass(), foundGroupSequencesForCurrentView);
+ processFieldsAndProperties(key[0] + "." + key[1], firstBean, key[1], foundGroupSequencesForCurrentView);
+ processFieldsAndProperties(
+ propertyDetails.getKey(),
+ propertyDetails.getBaseObject(),
+ propertyDetails.getProperty(),
+ foundGroupSequencesForCurrentView);
+
+ for(GroupSequence currentGroupSequence : foundGroupSequencesForCurrentView)
+ {
+ for(Class currentGroup : currentGroupSequence.sequence())
+ {
+ ExtValBeanValidationContext.getCurrentInstance()
+ .addGroup(currentGroup, FacesContext.getCurrentInstance().getViewRoot().getViewId(), clientId);
+ }
+ }
+ }
+
+ private void processClass(Class classToInspect, List<GroupSequence> foundGroupSequencesForCurrentView)
+ {
+ //TODO process super classes and interfaces as well
+ if(classToInspect.isAnnotationPresent(BeanValidationController.class))
+ {
+ addGroupSequencesForCurrentView(
+ (BeanValidationController) classToInspect.getAnnotation(BeanValidationController.class),
+ foundGroupSequencesForCurrentView);
+ }
+ }
+
+ private void processFieldsAndProperties(
+ String key, Object base, String property, List<GroupSequence> foundGroupSequencesForCurrentView)
+ {
+ PropertyInformation propertyInformation = new DefaultGroupControllerScanningExtractor()
+ .extract(FacesContext.getCurrentInstance(), new PropertyDetails(key, base, property));
+
+ for(MetaDataEntry metaDataEntry : propertyInformation.getMetaDataEntries())
+ {
+ if(metaDataEntry.getValue() instanceof BeanValidationController)
+ {
+ addGroupSequencesForCurrentView(
+ (BeanValidationController)metaDataEntry.getValue(), foundGroupSequencesForCurrentView);
+ }
+ }
+ }
+
+ private void addGroupSequencesForCurrentView(
+ BeanValidationController beanValidationController, List<GroupSequence> foundGroupSequencesForCurrentView)
+ {
+ for(ValidateGroup validateGroup : beanValidationController.value())
+ {
+ for(String currentViewIdEntry : validateGroup.viewId())
+ {
+ if(currentViewIdEntry.equals(FacesContext.getCurrentInstance().getViewRoot().getViewId()) ||
+ currentViewIdEntry.equals("*"))
+ {
+ foundGroupSequencesForCurrentView.addAll(Arrays.asList(validateGroup.groupSequence()));
+ }
+ }
+ }
+ }
}
Modified: myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/ExtValBeanValidationContext.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/ExtValBeanValidationContext.java?rev=749184&r1=749183&r2=749184&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/ExtValBeanValidationContext.java (original)
+++ myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/ExtValBeanValidationContext.java Mon Mar 2 04:48:47 2009
@@ -129,12 +129,53 @@
{
if(this.currentGroups.size() < 1)
{
- return new Class[] {Default.class};
+ if(!"true".equalsIgnoreCase(WebXmlParameter.DEACTIVATE_IMPLICIT_DEFAULT_GROUP_VALIDATION))
+ {
+ return new Class[] {Default.class};
+ }
+ return new Class[0];
}
- String key = getGroupKey(viewId, componentId);
+ String key = getGroupKey(viewId, null);
+ Class[] resultsForPage = buildResultFor(key);
- return (Class[]) this.currentGroups.get(key).toArray();
+ key = getGroupKey(viewId, componentId);
+ Class[] resultsForComponent = buildResultFor(key);
+
+ if(resultsForPage.length == 0)
+ {
+ return resultsForComponent;
+ }
+ else if(resultsForComponent.length == 0)
+ {
+ return resultsForPage;
+ }
+
+ return mergeResult(resultsForPage, resultsForComponent);
+ }
+
+ private Class[] buildResultFor(String key)
+ {
+ List<Class> list = this.currentGroups.get(key);
+ int listSize = list != null ? list.size() : 0;
+ Class[] results = new Class[listSize];
+
+ for(int i = 0; i < listSize; i++)
+ {
+ results[i] = this.currentGroups.get(key).get(i);
+ }
+
+ return results;
+ }
+
+ private Class[] mergeResult(Class[] resultsForPage, Class[] resultsForComponent)
+ {
+ Class[] mergedResult = new Class[resultsForPage.length + resultsForComponent.length];
+
+ System.arraycopy(resultsForPage, 0, mergedResult, 0, resultsForPage.length);
+ System.arraycopy(resultsForComponent, 0, mergedResult, resultsForPage.length, resultsForComponent.length);
+
+ return mergedResult;
}
public void removeGroup(Class groupClass)
Added: myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/WebXmlParameter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/WebXmlParameter.java?rev=749184&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/WebXmlParameter.java (added)
+++ myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/WebXmlParameter.java Mon Mar 2 04:48:47 2009
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.beanval;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.util.WebXmlUtils;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public interface WebXmlParameter
+{
+ static final String DEACTIVATE_IMPLICIT_DEFAULT_GROUP_VALIDATION = WebXmlUtils
+ .getInitParameter("DEACTIVATE_IMPLICIT_DEFAULT_GROUP_VALIDATION");
+}
\ No newline at end of file
Added: myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/extractor/DefaultGroupControllerScanningExtractor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/extractor/DefaultGroupControllerScanningExtractor.java?rev=749184&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/extractor/DefaultGroupControllerScanningExtractor.java (added)
+++ myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/extractor/DefaultGroupControllerScanningExtractor.java Mon Mar 2 04:48:47 2009
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.beanval.annotation.extractor;
+
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.DefaultComponentMetaDataExtractor;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
+import org.apache.myfaces.extensions.validator.core.property.DefaultPropertyInformation;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.myfaces.extensions.validator.beanval.annotation.group.GroupValidationKeys;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+public class DefaultGroupControllerScanningExtractor extends DefaultComponentMetaDataExtractor
+{
+ @Override
+ public PropertyInformation extract(FacesContext facesContext, Object object)
+ {
+ if (!(object instanceof PropertyDetails))
+ {
+ throw new IllegalStateException(object.getClass() + " is not a " + PropertyDetails.class.getName());
+ }
+
+ PropertyDetails propertyDetails = (PropertyDetails)object;
+
+ Class entityClass = propertyDetails.getBaseObject().getClass();
+
+ PropertyInformation propertyInformation = new DefaultPropertyInformation();
+
+ propertyInformation.setInformation(
+ GroupValidationKeys.GROUPS_TO_VALIDATE, propertyDetails);
+
+ /*
+ * find and add annotations
+ */
+ addPropertyAccessAnnotations(entityClass, propertyDetails.getProperty(), propertyInformation);
+ addFieldAccessAnnotations(entityClass, propertyDetails.getProperty(), propertyInformation);
+
+ return propertyInformation;
+ }
+}
Added: myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/BeanValidationController.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/BeanValidationController.java?rev=749184&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/BeanValidationController.java (added)
+++ myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/BeanValidationController.java Mon Mar 2 04:48:47 2009
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.beanval.annotation.group;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+
+@Target({METHOD, FIELD, TYPE})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface BeanValidationController
+{
+ ValidateGroup[] value() default @ValidateGroup();
+}
Added: myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/GroupValidationKeys.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/GroupValidationKeys.java?rev=749184&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/GroupValidationKeys.java (added)
+++ myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/GroupValidationKeys.java Mon Mar 2 04:48:47 2009
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.beanval.annotation.group;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public interface GroupValidationKeys
+{
+ static final String GROUPS_TO_VALIDATE = "groups_to_validate";
+}
Added: myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/ValidateGroup.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/ValidateGroup.java?rev=749184&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/ValidateGroup.java (added)
+++ myfaces/extensions/validator/branches/beanval_integration/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/group/ValidateGroup.java Mon Mar 2 04:48:47 2009
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.beanval.annotation.group;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.validation.GroupSequence;
+import javax.validation.groups.Default;
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+
+@Target({METHOD, FIELD, TYPE})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface ValidateGroup
+{
+ public abstract String[] viewId() default "*";
+
+ public abstract GroupSequence[] groupSequence() default @GroupSequence(sequence = Default.class);
+}
\ No newline at end of file