alfresco Alfresco model with dynamic list Basic example

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

content-model.xml :

....
<constraints>
    <constraint name="my:aConstraintList" type="x.y.z.project.model.constraint.AConstraintList">
    </constraint>
....
<property name="my:aValue">
    <title>My Value</title>
    <type>d:text</type>
    <constraints>
          <constraint ref="my:aConstraintList"></constraint>
    </constraints>
 </property>

and the Java class declared before :

public class AConstraintList extends ListOfValuesConstraint implements Serializable {

    ....
    @Override
    public final List<String> getAllowedValues() {
        // Return here the list of values. Enum, call a webservice, etc.
    }

     @Override
     public final String getDisplayLabel(final String value, final MessageLookup messageLookup) {
         // Return here the label for the value
     }
}


Got any alfresco Question?