Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6542905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:16:57+00:00 2026-05-25T11:16:57+00:00

I have a property within a data model, that property must have a value

  • 0

I have a property within a data model, that property must have a value constrained from a type know and defined as a class.

The constraints values defined by the following type and the allowedValues/allowedLabels list are filled

package com.ds.ui.constraints;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
import javax.faces.model.SelectItem;
import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint;
import org.apache.log4j.Logger;
import com.ds.ui.bean.dialog.util.BeanUtil;

public class PositionPermissionsConstraints extends ListOfValuesConstraint
    implements Serializable {

public void initialize(){
    LOG.debug("PositionPermissionsConstraints Initializer");
    super.setCaseSensitive(false);
    preparePermissionList();
}

public void preparePermissionList(){
    ResourceBundle bundle = ResourceBundle.getBundle(BeanUtil.RESOURECE_BUNDLE);
    List<String> av = new ArrayList<String>();
    av
    .add(PositionPermissionsConstraints.
            CREATE_ORGANIZATION_PERMISSION);
    this.allowedLabels
    .add(bundle.getString(CREATE_ORGANIZATION_PERMISSION));
    av
        .add(PositionPermissionsConstraints.
                UPDATE_ORGANIZATION_PERMISSION);
    this.allowedLabels
    .add(bundle.getString(UPDATE_ORGANIZATION_PERMISSION));         
    av
        .add(PositionPermissionsConstraints.
                DELETE_ORGANIZATION_PERMISSION);
    this.allowedLabels
    .add(bundle.getString(DELETE_ORGANIZATION_PERMISSION));         
    av
        .add(PositionPermissionsConstraints.
                CREATE_ROOT_POSITION_PERMISSION);
    this.allowedLabels
    .add(bundle.getString(CREATE_ROOT_POSITION_PERMISSION));            
    av
        .add(PositionPermissionsConstraints.
                MANAGE_ROOT_POSITION_PERMISSION);
    this.allowedLabels
    .add(bundle.getString(MANAGE_ROOT_POSITION_PERMISSION));
    av
    .add(PositionPermissionsConstraints.
            CREATE_SUBORDINATE_POSITION_PERMISSION);
    this.allowedLabels
    .add(bundle.getString(CREATE_SUBORDINATE_POSITION_PERMISSION));         
    av
        .add(PositionPermissionsConstraints.
                UPDATE_SUBORDINATE_POSITION_PERMISSION);
    this.allowedLabels
    .add(bundle.getString(UPDATE_SUBORDINATE_POSITION_PERMISSION));         
    av
        .add(PositionPermissionsConstraints.
                DELETE_SUBORDINATE_POSITION_PERMISSION);
    this.allowedLabels
    .add(bundle.getString(DELETE_SUBORDINATE_POSITION_PERMISSION));         
    av
        .add(PositionPermissionsConstraints.
                MANAGE_POSITION_PERMISSION);
    this.allowedLabels
    .add(bundle.getString(MANAGE_POSITION_PERMISSION));         
    av
        .add(PositionPermissionsConstraints.
                ASSIGN_POSITION_TO_USER_PERMISSION);
    this.allowedLabels
    .add(bundle.getString(ASSIGN_POSITION_TO_USER_PERMISSION));
    this.setAllowedValues(av);
    this.setAllowedLabels(allowedLabels);

}

public List<SelectItem> prepareSelectItemsList(){
    ResourceBundle bundle = ResourceBundle.getBundle(BeanUtil.RESOURECE_BUNDLE);
    List<SelectItem> selectItems = new ArrayList<SelectItem>();
    for(String value : getAllowedValues()){
        SelectItem selectItem = new SelectItem(value,bundle.getString(value));
        selectItems.add(selectItem);
    }
    return selectItems;
}

private static final String CREATE_ORGANIZATION_PERMISSION = "CREATE_ORGANIZATION";
private static final String UPDATE_ORGANIZATION_PERMISSION = "UPDATE_ORGANIZATION";
private static final String DELETE_ORGANIZATION_PERMISSION = "DELETE_ORGANIZATION";
private static final String CREATE_ROOT_POSITION_PERMISSION = "CREATE_ROOT_POSITION";
private static final String MANAGE_ROOT_POSITION_PERMISSION = "MANAGE_ROOT_POSITION";
private static final String CREATE_SUBORDINATE_POSITION_PERMISSION = "CREATE_SUBORDINATE_POSITION";
private static final String UPDATE_SUBORDINATE_POSITION_PERMISSION = "UPDATE_SUBORDINATE_POSITION";
private static final String DELETE_SUBORDINATE_POSITION_PERMISSION = "DELETE_SUBORDINATE_POSITION";
private static final String MANAGE_POSITION_PERMISSION = "MANAGE_POSITION";
private static final String ASSIGN_POSITION_TO_USER_PERMISSION = "ASSIGN_POSITION_TO_USER";

private List<String> allowedLabels = new ArrayList<String>();
private static final long serialVersionUID = 1L;
private static Logger LOG = Logger.getLogger(PositionPermissionsConstraints.class);

public List<String> getAllowedLabels() {
    return allowedLabels;
}
public void setAllowedLabels(List<String> allowedLabels) {
    this.allowedLabels = allowedLabels;
}}

As you see the allowedValues/labels are filled but once i correlate the property with this constraint by using model definition itself the values are seeing rather than values and labels.

labels are multi lingual as you can see, so how can i enforce the labels to be displayed and how can i enforce the multi lingual.

May be i need to develop a new component generators !

Please, can any one guide me by a clear steps.

thanks
Mohammed Amr

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:16:58+00:00Added an answer on May 25, 2026 at 11:16 am

    Within Alfresco, if you define a normal constraint list, only the value will be displayed.

    What Alfresco does in the generator/renderer is make a HTML
    Each constraint will get presented as <option value=${value}>${value}</option>

    Thus if you really want to create a list with different value and different labels, you need to create your own Generator + Renderer.
    You could use the default as an example and build upon it.
    You need to output <option value=${value}>${label}</option>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a property within a class, that I need to iterate through all
I have been trying to return a collection from a property within a class
I have a name of a property and need to find its value within
I have a property of type uint on my entity. Something like: public class
I have a observable collection exposed as a property within a view model. The
I have a property called IsSecureConnection that is part of my object's interface. This
I have a property on a domain object that is declared in a many-to-one
I have a model (called Test): property :id, Serial property :title, String, :length =>
I have a top-level page called ReceiveItem . Within that page, I have a
I've written a Directshow filter that derives from CTransInPlace and implements a single property

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.