Package org.geotools.validation

Examples of org.geotools.validation.Validation


        TestDTO thisTest = null;
        //plugin is selected?
        if (selection instanceof PlugInDTO) {
            // create a new validation test object
            PlugInDTO plugin = (PlugInDTO) selection;
            Validation newTest = null;
            try {
                newTest = processor.createValidation(plugin);
            } catch (Exception e1) {
                // log the exception and return
                MessageDialog
                        .openError(
                                PlatformUI.getWorkbench()
                                        .getActiveWorkbenchWindow()
                                        .getShell(),
                                "Exception Occurred", e1.getClass().toString() + " " + e1.getMessage())//$NON-NLS-1$//$NON-NLS-2$
                ValidationPlugin.log(e1.getMessage(), e1);
                return null;
            }
            // determine which TestSuiteDTO to use (for now, use the default)
            String testSuiteDTOKey = defaultTestSuite;
            // add the validation to the processor (creates a testDTO
            // and adds the validation to the appropriate lookup)
            processor.addValidation(newTest, plugin, testSuiteDTOKey);
            // if a defaultTypeRef exists, set any typeRefs to that value
            if ((defaultTypeRef != null) && defaultTypeRef.length() > 0) {
                thisTest = (TestDTO) processor.getTests().get(newTest.getName());
                Map args = thisTest.getArgs();
                for (Iterator i = args.keySet().iterator(); i.hasNext();) {
                    ArgumentDTO arg = (ArgumentDTO) args.get(i.next());
                    String argName = arg.getName();
                    //is it a typeRef?
View Full Code Here


            Object currentItem = i.next();
      something = FVLookup.get(currentItem);
      if (something != null) {
        ArrayList tests = (ArrayList) something;
        for (Object thisTest : tests) {
          Validation thisValidation = (Validation) thisTest;
          if (thisValidation.getName().equalsIgnoreCase(testName)) {
            featureLookup.remove(currentItem);
          }
        }
      }
    }
    //remove from IVLookup
    Map IVLookup = integrityLookup;
    for (Iterator i = IVLookup.keySet().iterator(); i.hasNext();) {
            Object something;
            Object currentItem = i.next();
      something = IVLookup.get(currentItem);
      if (something != null) {
        ArrayList tests = (ArrayList) something;
        for (Object thisTest : tests) {
          Validation thisValidation = (Validation) thisTest;
          if (thisValidation.getName().equalsIgnoreCase(testName)) {
            integrityLookup.remove(currentItem);
          }
        }
      }
    }
View Full Code Here

    // (navigate through the featureLookup until we find an instance of the test)
    for (Iterator i = featureLookup.keySet().iterator(); i.hasNext();) {
      ArrayList testList = (ArrayList) featureLookup.get(i.next());
      // iterate through each item in the list
      for (Object thisTest : testList) {
        Validation test = (Validation) thisTest;
        // this is the matching validation for the given test
        if (test.getName().equals(testName)) {
          validator = (FeatureValidation) test;
          break;
        }
      }
    }
View Full Code Here

    // (navigate through the featureLookup until we find an instance of the test)
    for (Iterator i = integrityLookup.keySet().iterator(); i.hasNext();) {
      ArrayList testList = (ArrayList) integrityLookup.get(i.next());
      // iterate through each item in the list
      for (Object thisTest : testList) {
        Validation test = (Validation) thisTest;
        // this is the matching validation for the given test
        if (test.getName().equals(testName)) {
          validator = (IntegrityValidation) test;
          break;
        }
      }
    }
View Full Code Here

      }
    }   
    //store the complete list of Args for future use (will be overwritten by the latest test creation)
    this.allArgs = newArgs;
    //create a new validation
    Validation validation = plugIn.createValidation(getUniqueName(getTests(), "Test"),dto.getDescription(), newArgs); //$NON-NLS-1$
    return validation;
  }
View Full Code Here

    //get all validation tests from the featureLookup
    Set<Validation> validations = new HashSet<Validation>();
    for (Iterator i = featureLookup.keySet().iterator(); i.hasNext();) {
      ArrayList list = (ArrayList) featureLookup.get(i.next());
      for (int j = 0; j < list.size(); j++) {
        Validation test = (Validation) list.get(j);
        validations.add(test);
      }
    }
   
    //clear the FV Lookup
    featureLookup.clear();
   
    //add each test to the Lookup (again)
    for (Iterator i = validations.iterator(); i.hasNext();) {
      Validation validation = (Validation) i.next();
      if (validation instanceof FeatureValidation) {
        //FeatureValidation FV = (FeatureValidation) validation;
        //addToFVLookup(FV); // <-- this is the proper way to do this
       
        //NOTE: code below is a verbatim copy of addToFVLookup(), which is private
        //TODO: change org.geotools.validation.ValidationProcessor.addToFVLookup() to public or protected?
            String[] featureTypeList = validation.getTypeRefs();
 
            if (featureTypeList == Validation.ALL) // if null (ALL)
        {
          ArrayList<Validation> tests = (ArrayList) featureLookup.get(ANYTYPENAME);
View Full Code Here

    // get all validation tests from the integrityLookup
    Set<Validation> validations = new HashSet<Validation>();
    for (Iterator i = integrityLookup.keySet().iterator(); i.hasNext();) {
      ArrayList list = (ArrayList) integrityLookup.get(i.next());
      for (int j = 0; j < list.size(); j++) {
        Validation test = (Validation) list.get(j);
        validations.add(test);
      }
    }

    // clear the IV Lookup
    integrityLookup.clear();

    // add each test to the Lookup (again)
    for (Iterator i = validations.iterator(); i.hasNext();) {
      Validation validation = (Validation) i.next();
      if (validation instanceof IntegrityValidation) {
        // IntegrityValidation IV = (IntegrityValidation) validation;
        // addToIVLookup(IV); // <-- this is the proper way to do this

        // NOTE: code below is a verbatim copy of addToIVLookup(), which is private
        // TODO: change org.geotools.validation.ValidationProcessor.addToIVLookup() to public or protected?
        String[] integrityTypeList = validation.getTypeRefs();

        if (integrityTypeList == Validation.ALL) // if null (ALL)
        {
          ArrayList<Validation> tests = (ArrayList) integrityLookup.get(ANYTYPENAME);
          if (tests == null) { // if an ALL test doesn't exist yet
View Full Code Here

    //iterate through each item in the map (should contain a single ArrayList)
    for (Iterator i = FVLookup.keySet().iterator(); i.hasNext();) {
      ArrayList testList = (ArrayList) FVLookup.get(i.next());
      //iterate through each item in the list
      for (Object thisTest : testList) {
        Validation validation = (Validation) thisTest;
        // this is the matching validation for the given test
        if (validation.getName().equals(test.getName())) {
          //create a property descriptor containing the argument name and plugin class
          PropertyDescriptor property = new PropertyDescriptor(arg.getName(), validation.getClass());
              if (property == null) {
                  // error here
                  continue;
              }
              //store the value of the argument in the property descriptor
              try {
                property.getWriteMethod().invoke(validation,
                      new Object[] { arg.getValue() });
              } catch (IllegalArgumentException e) {
                String val = arg.getValue() == null? arg.getValue().toString():"null"; //$NON-NLS-1$
                  throw new ValidationException("test failed to configure " //$NON-NLS-1$
                      + validation.getClass().getSimpleName() + " " + arg.getName()+ " "+val, e); //$NON-NLS-1$ //$NON-NLS-2$
              } catch (IllegalAccessException e) {
            String val = arg.getValue() == null? arg.getValue().toString():"null"; //$NON-NLS-1$
            throw new ValidationException("test failed to configure " //$NON-NLS-1$
              + validation.getClass().getSimpleName() + " " + arg.getName()+ " "+val, e); //$NON-NLS-1$ //$NON-NLS-2$
              } catch (InvocationTargetException e) {
            String val = arg.getValue() == null? arg.getValue().toString():"null"; //$NON-NLS-1$
            throw new ValidationException("test failed to configure " //$NON-NLS-1$
              + validation.getClass().getSimpleName() + " " + arg.getName()+ " "+val, e); //$NON-NLS-1$ //$NON-NLS-2$
              }
        }
      }
    }
  }
View Full Code Here

                }

                try {
                    PlugIn plugIn = (org.geotools.validation.PlugIn) defaultPlugIns.get(dto.getPlugIn()
                                                                                           .getName());
                    Validation validation = plugIn.createValidation(dto.getName(),
                            dto.getDescription(), testArgs);

                    if (validation instanceof FeatureValidation) {
                        addValidation((FeatureValidation) validation);
                    }
View Full Code Here

                }

                try {
                    PlugIn plugIn = (org.geotools.validation.PlugIn) defaultPlugIns.get(dto.getPlugIn()
                                                                                           .getName());
                    Validation validation = plugIn.createValidation(dto.getName(),
                            dto.getDescription(), testArgs);

                    if (validation instanceof FeatureValidation) {
                        addValidation((FeatureValidation) validation);
                    }
View Full Code Here

TOP

Related Classes of org.geotools.validation.Validation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.