示例#1
0
  private ControllerMappingDescriptor toMappingDescriptor(final DomElement mappingElement) {
    final ControllerMappingDescriptor.Builder builder = ControllerMappingDescriptor.create();
    final String controllerPath =
        mappingElement.getAttribute(MAPPING_DESCRIPTOR_CONTROLLER_ATTRIBUTE);
    builder.controller(ResourceKey.from(this.currentApplication, controllerPath));

    final String orderValue = mappingElement.getAttribute(MAPPING_DESCRIPTOR_ORDER_ATTRIBUTE);
    if (isNotEmpty(orderValue)) {
      builder.order(Integer.parseInt(orderValue));
    }

    final DomElement matchElement = mappingElement.getChild(MAPPING_DESCRIPTOR_MATCH_TAG_NAME);
    if (matchElement != null) {
      final String match = matchElement.getValue();
      if (isNotEmpty(match)) {
        builder.contentConstraint(match);
      }
    }

    final DomElement patternElement = mappingElement.getChild(MAPPING_DESCRIPTOR_PATTERN_TAG_NAME);
    if (patternElement != null) {
      final String pattern = patternElement.getValue();
      if (isNotEmpty(pattern)) {
        final boolean invert =
            "true"
                .equals(patternElement.getAttribute(MAPPING_DESCRIPTOR_INVERT_ATTRIBUTE, "false"));
        builder.pattern(pattern);
        builder.invertPattern(invert);
      }
    }

    return builder.build();
  }
示例#2
0
  @Override
  protected void doParse(final DomElement root) throws Exception {
    assertTagName(root, ROOT_TAG_NAME);

    final XmlFormMapper formMapper = new XmlFormMapper(this.currentApplication);
    this.siteDescriptorBuilder.form(formMapper.buildForm(root.getChild(CONFIG_TAG_NAME)));
    this.siteDescriptorBuilder.metaSteps(MixinNames.from(parseMetaSteps(root)));
    this.siteDescriptorBuilder.filterDescriptors(
        FilterDescriptors.from(
            parseFilterDescriptors(root.getChild(FILTER_DESCRIPTORS_PARENT_TAG_NAME))));
    this.siteDescriptorBuilder.mappingDescriptors(
        ControllerMappingDescriptors.from(
            parseMappingDescriptors(root.getChild(MAPPINGS_DESCRIPTOR_TAG_NAME))));
  }
示例#3
0
 @Override
 protected void doParse(final DomElement root) throws Exception {
   assertTagName(root, ROOT_TAG_NAME);
   this.appDescriptorBuilder.key(currentApplication);
   final DomElement descriptionElement = root.getChild(DESCRIPTION);
   if (descriptionElement != null) {
     this.appDescriptorBuilder.description(descriptionElement.getValue());
   }
 }