Package com.denimgroup.threadfix.framework.impl.model

Examples of com.denimgroup.threadfix.framework.impl.model.ModelFieldSet


     * @param globalDataBinderParser can be null, if a databinderparser is set with the setter it will be used too
     */
    public void expandParameters(@Nonnull SpringEntityMappings entityMappings,
                                 @Nullable SpringDataBinderParser globalDataBinderParser) {
        if (modelObject != null) {
            ModelFieldSet fields = entityMappings.getPossibleParametersForModelType(modelObject);
            parameters.addAll(fields.getPossibleParameters());
        }

        Set<String> allowedParams = null, disallowedParams = null;

        if (dataBinderParser != null) {
View Full Code Here


    private void collapse() {
        Map<String, String> superClassMap = new HashMap<>();

        for (ViewModelParser parser : modelParsers) {
            for (Map.Entry<String, Set<ModelField>> entry : parser.map.entrySet()) {
                fieldMap.put(entry.getKey(), new ModelFieldSet(entry.getValue()));
            }

            superClassMap.putAll(parser.superClassMap);
        }
View Full Code Here

                if (entityParser.getSuperClass() != null) {
                    superClassMap.put(entityParser.getClassName(), entityParser.getSuperClass());
                }

                fieldMap.put(entityParser.getClassName(), new ModelFieldSet(entityParser.getFieldMappings()));
            }
        }
    }
View Full Code Here

    private void expandParameters(Action action) {
        if (dotNetModelMappings != null) {

            for (ModelField field : action.parametersWithTypes) {
                ModelFieldSet parameters = dotNetModelMappings.getPossibleParametersForModelType(field.getType());
                if (!parameters.getFieldSet().isEmpty()) {
                    action.parameters.remove(field.getParameterKey());
                    for (ModelField possibleParameter : parameters) {
                        action.parameters.add(possibleParameter.getParameterKey());
                    }
                }
View Full Code Here

    @Test
    public void testSuperclassPropertiesInModelFields() {
        DotNetModelMappings mappings = new DotNetModelMappings(getContosoLocation());

        ModelFieldSet enrollmentFields = mappings.getPossibleParametersForModelType("Enrollment");

        assert enrollmentFields.contains("Student.ID") :
                "Student.ID wasn't found in Enrollment.Student.ID";
    }
View Full Code Here

  @Test
  public void testOwnerFields() {
    File file = new File(TestConstants.PETCLINIC_SOURCE_LOCATION);
    SpringEntityMappings mappings = new SpringEntityMappings(file);
   
    ModelFieldSet ownerFields = mappings.getPossibleParametersForModelType("Owner");
   
    assertTrue(ownerFields != null);
    assertTrue(ownerFields.getField("lastName").getType().equals("String"));
    assertTrue(ownerFields.getField("firstName").getType().equals("String"));
    assertTrue(ownerFields.getField("address").getType().equals("String"));
    assertTrue(ownerFields.getField("city").getType().equals("String"));
    assertTrue(ownerFields.getField("telephone").getType().equals("String"));
    assertTrue(ownerFields.getField("id").getType().equals("Integer"));
  }
View Full Code Here

  @Test
  public void testPetFields() {
    File file = new File(TestConstants.PETCLINIC_SOURCE_LOCATION);
    SpringEntityMappings mappings = new SpringEntityMappings(file);
   
    ModelFieldSet petFields = mappings.getPossibleParametersForModelType("Pet");
   
    assertTrue(petFields.getField("id").getType().equals("Integer"));
    assertTrue(petFields.getField("name").getType().equals("String"));
    assertTrue(petFields.getField("birthDate").getType().equals("DateTime"));
    assertTrue(petFields.getField("type.name").getType().equals("String"));
   
  }
View Full Code Here

  @Test
  public void testVetFields() {
    File file = new File(TestConstants.PETCLINIC_SOURCE_LOCATION);
    SpringEntityMappings mappings = new SpringEntityMappings(file);
   
    ModelFieldSet vetFields = mappings.getPossibleParametersForModelType("Vet");
   
    assertTrue(vetFields.getField("lastName").getType().equals("String"));
    assertTrue(vetFields.getField("firstName").getType().equals("String"));
    assertTrue(vetFields.getField("id").getType().equals("Integer"));
    assertTrue(vetFields.getField("nrOfSpecialties").getType().equals("int"));
   
  }
View Full Code Here

  @Test
  public void testPetTypeFields() {
    File file = new File(TestConstants.PETCLINIC_SOURCE_LOCATION);
    SpringEntityMappings mappings = new SpringEntityMappings(file);
   
    ModelFieldSet typeFields = mappings.getPossibleParametersForModelType("PetType");
   
    assertTrue(typeFields.getField("name").getType().equals("String"));
  }
View Full Code Here

TOP

Related Classes of com.denimgroup.threadfix.framework.impl.model.ModelFieldSet

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.