cancel
Showing results for 
Search instead for 
Did you mean: 

constraints

srojas
Champ in-the-making
Champ in-the-making
hello, have somebody know how can i obtain the allowed valued of a constraint associates to a property via Foundation Services? Any example?

Thanks
1 REPLY 1

tfornoville
Champ in-the-making
Champ in-the-making
We have something like this in our project:


  public List<String> getAllAssetTypes()
  {
    List<String> result = null;
    DictionaryService dictionaryService = serviceRegistry.getDictionaryService();
    List<ConstraintDefinition> constraintDefinitions = dictionaryService.getProperty(RCDModel.PROP_ASSET_ASSETTYPE) .getConstraints();

    for (ConstraintDefinition cd : constraintDefinitions)
    {
      if (RCDModel.CONSTRAINT_ASSET_ASSETTYPES.equals(cd.getName()) || cd.getConstraint() instanceof ListOfValuesConstraint)
      {
        result = ((ListOfValuesConstraint)cd.getConstraint()).getAllowedValues();
      }
    }
    return result;
  }

Hope this helps.