Package pt.webdetails.cdf.dd.model.core.validation

Examples of pt.webdetails.cdf.dd.model.core.validation.ValidationException


  {
    assert builder != null;

    if(StringUtils.isEmpty(builder._source))
    {
      throw new ValidationException(new RequiredAttributeError("Source"));
    }

    if(builder._type == null)
    {
      throw new ValidationException(new RequiredAttributeError("Type"));
    }

    this.name = StringUtils.defaultIfEmpty(builder._name, builder._source);
    this.app = StringUtils.defaultIfEmpty(builder._app, "");
    this.source = builder._source;
View Full Code Here


    String catDesc = builder._categoryLabel;
    if(StringUtils.isEmpty(cat))
    {
      if(StringUtils.isNotEmpty(catDesc))
      {
        throw new ValidationException(new RequiredAttributeError("Category"));
      }
     
      cat     = DEF_CATEGORY;
      catDesc = DEF_CATEGORY_LABEL;
    }
View Full Code Here

    assert propSource != null;
   
    String propName = builder._propName;
    if(StringUtils.isEmpty(propName))
    {
      throw new ValidationException(new RequiredAttributeError("PropertyName"));
    }

    PropertyType prop = propSource.getProperty(propName);
    if(prop == null)
    {
      throw new ValidationException(
        new ComponentTypeUndefinedPropertyError(owner.getLabel(), propName));
    }
   
    String alias = builder._alias;
    if(StringUtils.isEmpty(alias)) { alias = propName; }
View Full Code Here

    super(builder, owner, metaModel);
   
    PropertyTypeUsage propUsage = builder._propUsage;
    if(propUsage == null)
    {
      throw new ValidationException(new RequiredAttributeError("PropertyUsage"));
    }

    this._propUsage = propUsage;
  }
View Full Code Here

  {
    super(builder, metaModel);
   
    if(builder._layoutXP == null)
    {
      throw new ValidationException(new RequiredAttributeError("LayoutXPContext"));
    }
   
    this._layoutXP = builder._layoutXP;
  }
View Full Code Here

    super(builder, owner, metaModel);
   
    PropertyType prop = builder._prop;
    if(prop == null)
    {
      throw new ValidationException(new RequiredAttributeError("Property"));
    }

    String alias = builder._alias;
    if(StringUtils.isEmpty(alias)) { alias = prop.getName(); }
View Full Code Here

   
    if(metaModel == null) { throw new IllegalArgumentException("metaModel"); }
   
    if(builder._wcdf == null)
    {
      throw new ValidationException(new RequiredAttributeError("Wcdf"));
    }
   
    this._wcdf = builder._wcdf;
    this._sourcePath = Utils.sanitizeSlashesInPath(StringUtils.defaultIfEmpty(builder._sourcePath, ""));
    this._sourceDate = builder._sourceDate == null ? new Date() : builder._sourceDate;
View Full Code Here

  {
    super(builder);

    if(builder._meta == null)
    {
      throw new ValidationException(new RequiredAttributeError("Meta"));
    }

    this._meta = builder._meta;
  }
View Full Code Here

      if(owner == null) { throw new IllegalArgumentException("owner"); }
      if(metaModel == null) { throw new IllegalArgumentException("metaModel"); }

      if(StringUtils.isEmpty(this._alias))
      {
        throw new ValidationException(new RequiredAttributeError("Alias"));
      }

      ComponentType compType = owner.getMeta();
     
      // Bind by alias first
      PropertyTypeUsage propUsage = compType.tryGetPropertyUsage(this._alias);
      if(propUsage == null)
      {
        // Only then bind by name
        propUsage = compType.tryGetPropertyUsageByName(this._alias);
      }
     
      if(propUsage != null)
      {
        ExpectedPropertyBinding.Builder builder = new ExpectedPropertyBinding.Builder();
        builder
          .setPropertyUsage(propUsage)
          .setValue(this.getValue());

        return builder.build(owner, metaModel);
      }
     
      // Then try to bind by name to a global property
      PropertyType prop = metaModel.tryGetPropertyType(this._alias);
      if(prop != null)
      {
        ExtensionPropertyBinding.Builder builder = new ExtensionPropertyBinding.Builder();
       
        // HACK: CCC V1 properties must be made to look like when they were defined
        boolean isCCC = this._alias.startsWith("ccc");
        String alias = isCCC ?
            Utils.toFirstLowerCase(this._alias.substring(3)) :
            this._alias;
       
        builder
          .setAlias(alias)
          .setProperty(prop)
          .setValue(this.getValue());

        return builder.build(owner, metaModel);
      }

      throw new ValidationException(
          new ComponentUnresolvedPropertyBindingError(
              this._alias,
              owner.getId(),
              owner.getMeta().getLabel()));
    }
View Full Code Here

TOP

Related Classes of pt.webdetails.cdf.dd.model.core.validation.ValidationException

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.