Exemplo n.º 1
0
  /**
   * @param defaultName If the name is not customized, this name will be used as the default. Note
   *     that the name conversion <b>MUST</b> be applied before this method is called if necessary.
   * @param source Source schema component from which a field is built.
   */
  public CElementPropertyInfo createElementProperty(
      String defaultName, boolean forConstant, XSParticle source, RawTypeSet types) {

    if (!types.refs.isEmpty())
      // if this property is empty, don't acknowleedge the customization
      // this allows pointless property customization to be reported as an error
      markAsAcknowledged();
    constantPropertyErrorCheck();

    String name = getPropertyName(forConstant);
    if (name == null) name = defaultName;

    CElementPropertyInfo prop =
        wrapUp(
            new CElementPropertyInfo(
                name,
                types.getCollectionMode(),
                types.id(),
                types.getExpectedMimeType(),
                source,
                getCustomizations(source),
                source.getLocator(),
                types.isRequired()),
            source);

    types.addTo(prop);

    BIInlineBinaryData.handle(source.getTerm(), prop);
    return prop;
  }
Exemplo n.º 2
0
  public CReferencePropertyInfo createReferenceProperty(
      String defaultName,
      boolean forConstant,
      XSComponent source,
      RawTypeSet types,
      boolean isMixed,
      boolean dummy,
      boolean content,
      boolean isMixedExtended) {

    if (types
        == null) { // this is a special case where we need to generate content because potential
      // subtypes would need to be able to override what's store inside
      content = true;
    } else {
      if (!types.refs.isEmpty())
        // if this property is empty, don't acknowleedge the customization
        // this allows pointless property customization to be reported as an error
        markAsAcknowledged();
    }
    constantPropertyErrorCheck();

    String name = getPropertyName(forConstant);
    if (name == null) name = defaultName;

    CReferencePropertyInfo prop =
        wrapUp(
            new CReferencePropertyInfo(
                name,
                (types == null) ? true : types.getCollectionMode().isRepeated() || isMixed,
                (types == null) ? false : types.isRequired(),
                isMixed,
                source,
                getCustomizations(source),
                source.getLocator(),
                dummy,
                content,
                isMixedExtended),
            source);
    if (types != null) {
      types.addTo(prop);
    }

    BIInlineBinaryData.handle(source, prop);
    return prop;
  }