View Javadoc
1   /**
2    * Copyright (C) 2014-2017 Philip Helger (www.helger.com)
3    * philip[at]helger[dot]com
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    *         http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package com.helger.schematron.pure.validation;
18  
19  import javax.annotation.Nonnull;
20  import javax.annotation.Nullable;
21  import javax.annotation.concurrent.NotThreadSafe;
22  
23  import org.w3c.dom.Node;
24  
25  import com.helger.commons.state.EContinue;
26  import com.helger.schematron.pure.model.PSAssertReport;
27  import com.helger.schematron.pure.model.PSPattern;
28  import com.helger.schematron.pure.model.PSPhase;
29  import com.helger.schematron.pure.model.PSRule;
30  import com.helger.schematron.pure.model.PSSchema;
31  
32  /**
33   * The empty default implementation of {@link IPSValidationHandler}. This class
34   * may serve as the basis for your implementations.
35   * 
36   * @author Philip Helger
37   */
38  @NotThreadSafe
39  public class PSValidationHandlerDefault implements IPSValidationHandler
40  {
41    public void onStart (@Nonnull final PSSchema aSchema,
42                         @Nullable final PSPhase aActivePhase) throws SchematronValidationException
43    {
44      // empty
45    }
46  
47    public void onPattern (@Nonnull final PSPattern aPattern) throws SchematronValidationException
48    {
49      // empty
50    }
51  
52    public void onRule (@Nonnull final PSRule aRule, @Nonnull final String sContext) throws SchematronValidationException
53    {
54      // empty
55    }
56  
57    @Nonnull
58    public EContinue onFailedAssert (@Nonnull final PSAssertReport aAssertReport,
59                                     @Nonnull final String sTestExpression,
60                                     @Nonnull final Node aRuleMatchingNode,
61                                     final int nNodeIndex,
62                                     @Nullable final Object aContext) throws SchematronValidationException
63    {
64      return EContinue.CONTINUE;
65    }
66  
67    @Nonnull
68    public EContinue onSuccessfulReport (@Nonnull final PSAssertReport aAssertReport,
69                                         @Nonnull final String sTestExpression,
70                                         @Nonnull final Node aRuleMatchingNode,
71                                         final int nNodeIndex,
72                                         @Nullable final Object aContext) throws SchematronValidationException
73    {
74      return EContinue.CONTINUE;
75    }
76  
77    public void onEnd (@Nonnull final PSSchema aSchema,
78                       @Nullable final PSPhase aActivePhase) throws SchematronValidationException
79    {
80      // empty
81    }
82  }