]> git.mxchange.org Git - jcore-utils.git/blobdiff - src/org/mxchange/jcoreee/validator/BaseObjectValidator.java
More cleanup
[jcore-utils.git] / src / org / mxchange / jcoreee / validator / BaseObjectValidator.java
index d1eb11522e7ba4fe432553280729de6d4a0239c9..67e5508d779db7b6bc3638a25e9a32cde84ce5c6 100644 (file)
@@ -18,14 +18,12 @@ package org.mxchange.jcoreee.validator;
 
 import java.text.MessageFormat;
 import java.util.Arrays;
-import java.util.ResourceBundle;
 import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.validator.Validator;
 import javax.faces.validator.ValidatorException;
-import org.mxchange.jcore.BaseFrameworkSystem;
-import org.mxchange.jcore.FrameworkInterface;
+import org.mxchange.jcoree.BaseEeSystem;
 
 /**
  * A general object validation class. Please implement javax.faces.validator.Validator
@@ -34,7 +32,7 @@ import org.mxchange.jcore.FrameworkInterface;
  *
  * @author Roland Haeder
  */
-public abstract class BaseObjectValidator extends BaseFrameworkSystem implements FrameworkInterface, Validator {
+public abstract class BaseObjectValidator extends BaseEeSystem implements Validator {
 
        /**
         * Needs to be implemented as the Validator interface needs to be implemented.
@@ -47,19 +45,6 @@ public abstract class BaseObjectValidator extends BaseFrameworkSystem implements
        @Override
        abstract public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException;
 
-       /**
-        * Initializes resource bundle
-        *
-        * @param FacesContext instance
-        */
-       private void initResourceBundle (final FacesContext context) {
-               // Is it set?
-               if (null == this.getBundle()) {
-                       // Set it now
-                       setBundle(ResourceBundle.getBundle("org.mxchange.localization.bundle", context.getViewRoot().getLocale()));
-               }
-       }
-
        /**
         * The method pre-validates the given value. It makes sure that the component's id is found in
         * requiredFields and is not null. Once the component's id has been found, it stops iteration on
@@ -73,10 +58,7 @@ public abstract class BaseObjectValidator extends BaseFrameworkSystem implements
         */
        protected void preValidate (final FacesContext context, final UIComponent component, final Object value, final String[] requiredFields) throws ValidatorException {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("context={0},component={1},value={2},requiredFields={3} - CALLED!", context, component, value, Arrays.toString(requiredFields))); //NOI18N
-
-               // Set resource bundle
-               this.initResourceBundle(context);
+               this.getLogger().logTrace(MessageFormat.format("context={0},component={1},value={2},requiredFields={3} - CALLED!", context, component, value, Arrays.toString(requiredFields))); //NOI18N
 
                // Init message and key
                FacesMessage facesMessage = null;
@@ -91,7 +73,7 @@ public abstract class BaseObjectValidator extends BaseFrameworkSystem implements
                // Check component's id against required fields and find a match
                for (final String field : requiredFields) {
                        // Get logger
-                       this.getLogger().debug(MessageFormat.format("field={0},clientId={1}", field, clientId)); //NOI18N
+                       this.getLogger().logDebug(MessageFormat.format("field={0},clientId={1}", field, clientId)); //NOI18N
 
                        // Is it the same?
                        if (clientId.endsWith(field)) {
@@ -103,7 +85,7 @@ public abstract class BaseObjectValidator extends BaseFrameworkSystem implements
                                        errKey = String.format("error.%s.is_null", field); //NOI18N
 
                                        // Value it null
-                                       facesMessage = new FacesMessage(this.getMessageStringFromKey(errKey));
+                                       facesMessage = new FacesMessage(BaseEeSystem.getMessageStringFromKey(errKey));
                                }
 
                                // Abort here
@@ -112,7 +94,7 @@ public abstract class BaseObjectValidator extends BaseFrameworkSystem implements
                }
 
                // Debug message
-               this.getLogger().debug(MessageFormat.format("isValidField={0}", isValidField)); //NOI18N
+               this.getLogger().logDebug(MessageFormat.format("isValidField={0}", isValidField)); //NOI18N
 
                // Valid field?
                if (!isValidField) {
@@ -121,7 +103,7 @@ public abstract class BaseObjectValidator extends BaseFrameworkSystem implements
                }
 
                // Debug message
-               this.getLogger().debug(MessageFormat.format("facesMessage={0}", facesMessage)); //NOI18N
+               this.getLogger().logDebug(MessageFormat.format("facesMessage={0}", facesMessage)); //NOI18N
 
                // Is it not null?
                if (null != facesMessage) {
@@ -129,6 +111,6 @@ public abstract class BaseObjectValidator extends BaseFrameworkSystem implements
                }
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 }