Package com.codingcrayons.aspectfaces.metamodel

Examples of com.codingcrayons.aspectfaces.metamodel.JavaInspector


    SimpleCache afCache = new SimpleCache();
    AFWeaver.setDefaultCacheProvider(afCache);

    AFWeaver.addStaticConfiguration(getConfig(CONFIG));
    AFWeaver afWeaver = new AFWeaver(CONFIG, new JavaInspector(Administrator.class));

    Context context = new Context(Administrator.class.getName(), null, null, null, false);

    String fragment = afWeaver.generate(context, keyA);
    assertEquals(afCache.get(keyA), fragment);
View Full Code Here


  private String layoutInitTemplate(final String template, String startBoundary, String endBoundary, String layoutPath)
    throws AnnotationDescriptorNotFoundException, EvaluatorException, AnnotationNotRegisteredException,
    AnnotationNotFoundException, TemplateFileNotFoundException, TemplateFileAccessException,
    ConfigurationNotSetException, TagParserException {
    JavaInspector inspector = new JavaInspector(Administrator.class);
    Context context = new Context();

    AFWeaver.registerAllAnnotations();
    AFWeaver.setOpenVariableBoundaryIdentifier(startBoundary);
    AFWeaver.setCloseVariableBoundaryIdentifier(endBoundary);

    // set config (ignores fields)
    Configuration configuration = new Configuration("NAME") {
      @Override
      public String getAbsolutePath() {
        return "";
      }

      @Override
      protected StringBuilder getTemplate(String fileTemplatePath, String prefix)
        throws TemplateFileNotFoundException {
        if (fileTemplatePath.contains("layout")) {
          InputStream is = this.getClass().getResourceAsStream(fileTemplatePath);
          String tagContent = "";
          try {
            tagContent = Files.readInputStream(is);
          } catch (Exception e) {
            e.printStackTrace();
          }
          // add to cache
          return new StringBuilder(tagContent);
        } else {
          return new StringBuilder(template);
        }
      }

      @Override
      protected String getDelimiter() {
        return File.separator;
      }
    };
    configuration.addMapping(new Mapping("String", "path"));
    configuration.addMapping(new Mapping("Long", "path"));
    configuration.addMapping(new Mapping("Owner", "path"));
    configuration.addMapping(new Mapping("Integer", "path"));
    Settings settings = new Settings();
    configuration.setSettings(settings);
    context.setConfiguration(configuration);
    context.setOrderAnnotation("com.codingcrayons.aspectfaces.annotations.UiFormOrder");

    List<MetaProperty> metaProperties = inspector.inspect(context);
    UIFragmentComposer composer = new UIFragmentComposer();
    composer.addAllFields(metaProperties);
    context.setLayout(layoutPath);
    String out = composer.composeForm(context).getCompleteForm().toString();
View Full Code Here

      + "rendered=\"#{empty renderNAME ? 'true' : renderName}\"\n" + "id=\"#{prefix}name\" />\n\n"
      + "YES! \n" + "string \n" + "String \n" + "name \n" + "Name \n" + "person \n" + "Person \n"
      + "com.codingcrayons.aspectfaces.variableresolver.tagvariableresolvertest$person \n"
      + "com.codingcrayons.aspectfaces.variableResolver.TagVariableResolverTest$Person \n" + "iPerson.name ";

    JavaInspector inspector = new JavaInspector(Person.class);
    // context
    Context context = new Context();
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("myVar", "YES!");
    context.setVariables(variables);

    AFWeaver.registerAllAnnotations();
    AFWeaver.setOpenVariableBoundaryIdentifier("$");
    AFWeaver.setCloseVariableBoundaryIdentifier("$");

    // set config (ignores fields)
    String CONFIG = "detail.config.xml";
    File file = new File(getResource("configuration/" + CONFIG));
    Configuration configuration = new StaticConfiguration(file.getName());
    configuration.addMapping(new Mapping("String", "path"));
    context.setConfiguration(configuration);

    List<MetaProperty> metaProperties = inspector.inspect(context);
    UIFragmentComposer composer = new UIFragmentComposer();
    composer.addAllFields(metaProperties);
    for (MetaProperty property : metaProperties) {
      @SuppressWarnings("unchecked")
      List<Variable> localVars = Collections.concatLists(context.getVariableList(),
View Full Code Here

  @Test()
  public void testPermanentIgnoringAnnotations() throws AFException, FileNotFoundException {
    AFWeaver.init(new FileInputStream(getResource(AF_EMPTY_PROPS)));
    AFWeaver.addStaticConfiguration(getConfig(emptyConfigurationName));
    afWeaver = new AFWeaver(emptyConfigurationName, new JavaInspector(Administrator.class));

    Configuration configuration = afWeaver.getConfiguration();
    Set<String> ignoringAnnotations = configuration.getIgnoringAnnotations();

    assertEquals(ignoringAnnotations.size(), 1);
View Full Code Here

  @Test()
  public void testClearedPermanentIgnoringAnnotations() throws AFException, FileNotFoundException {
    AFWeaver.init(new FileInputStream(getResource(AF_PROPS)));
    AFWeaver.addStaticConfiguration(getConfig(noItemConfigurationName));
    afWeaver = new AFWeaver(noItemConfigurationName, new JavaInspector(Administrator.class));

    Configuration configuration = afWeaver.getConfiguration();
    Set<String> ignoringAnnotations = configuration.getIgnoringAnnotations();

    assertEquals(ignoringAnnotations.size(), 3);
View Full Code Here

  }

  private void setUpDefaults() throws AFException, FileNotFoundException {
    AFWeaver.init(new FileInputStream(getResource(AF_PROPS)));
    AFWeaver.addStaticConfiguration(getConfig(emptyConfigurationName));
    afWeaver = new AFWeaver(emptyConfigurationName, new JavaInspector(Administrator.class));
  }
View Full Code Here

  }

  private void setUpNoDefaults() throws AFException, FileNotFoundException {
    AFWeaver.init(new FileInputStream(getResource(AF_EMPTY_PROPS)));
    AFWeaver.addStaticConfiguration(getConfig(configurationName));
    afWeaver = new AFWeaver(configurationName, new JavaInspector(Administrator.class));
  }
View Full Code Here

    // ignoreAnnotation : Email Column NotNull
    AFWeaver.addStaticConfiguration(getConfig(configurationName));
    // ignore : none
    // ignoreAnnotation : empty
    AFWeaver.addStaticConfiguration(getConfig(noItemConfigurationName));
    afWeaver = new AFWeaver(configurationName, new JavaInspector(Administrator.class));
    Configuration configuration = afWeaver.getConfiguration();
    afWeaver = new AFWeaver(noItemConfigurationName, new JavaInspector(Administrator.class));
    Configuration configuration2 = afWeaver.getConfiguration();
    // expects : version fullName id secret password
    Set<String> fields = configuration.getIgnoreFields();
    // expects : UiIgnore Transient Email Column NotNull
    Set<String> annotations = configuration.getIgnoringAnnotations();
View Full Code Here

      new StaticConfiguration(CONFIG), new File(getConfig(CONFIG)), false, false
    );

    Context context = new Context("Test", null, null, null, false);
    context.setConfiguration(ConfigurationStorage.getInstance().getConfiguration(CONFIG));
    JavaInspector javaInspector = new JavaInspector(this.getClass());
    List<MetaProperty> metaProperties = javaInspector.inspect(context);

    for (MetaProperty metaProperty : metaProperties) {
      if (metaProperty.getName().equals(P_STRING)) {
        this.pString = this.getVariable(metaProperty.getConfigVariables(), P_STRING);
      } else if (metaProperty.getName().equals(P_INTEGER)) {
View Full Code Here

      }
      // Possible extension
      hookAddToAFContext(context);

      afWeaver.setConfiguration(configName);
      afWeaver.setInspector(new JavaInspector(clazz));

      return afWeaver.generate(context);
    } catch (AFException e) {
      return viewFragmentExceptionString(e);
    }
View Full Code Here

TOP

Related Classes of com.codingcrayons.aspectfaces.metamodel.JavaInspector

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.