• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ListOfValuesConstraint类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint的典型用法代码示例。如果您正苦于以下问题:Java ListOfValuesConstraint类的具体用法?Java ListOfValuesConstraint怎么用?Java ListOfValuesConstraint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ListOfValuesConstraint类属于org.alfresco.repo.dictionary.constraint包,在下文中一共展示了ListOfValuesConstraint类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createList

import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint; //导入依赖的package包/类
/**
 * @return List of SelectItem components
 */
protected List<SelectItem> createList()
{
   List<SelectItem> items = new ArrayList<SelectItem>(5);
   Constraint storesConstraint = ConstraintRegistry.getInstance().getConstraint("defaultStoreSelector");
   for(String store : ((ListOfValuesConstraint) storesConstraint).getAllowedValues())
   {
       items.add(new SelectItem(store, store));
   }
   
   // make sure the list is sorted by the values
   QuickSort sorter = new QuickSort(items, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
   sorter.sort();
   
   return items;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:19,代码来源:UIStoreSelector.java


示例2: buildPropertyLabels

import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint; //导入依赖的package包/类
private Map<String, String> buildPropertyLabels(WorkflowTask task, Map<String, Object> properties)
{
    TypeDefinition taskType = task.getDefinition().getMetadata();
    final Map<QName, PropertyDefinition> propDefs = taskType.getProperties();
    return CollectionUtils.transform(properties, new Function<Entry<String, Object>, Pair<String, String>>()
    {
        @Override
        public Pair<String, String> apply(Entry<String, Object> entry)
        {
            String propName = entry.getKey();
            PropertyDefinition propDef = propDefs.get(qNameConverter.mapNameToQName(propName));
            if(propDef != null )
            {
                List<ConstraintDefinition> constraints = propDef.getConstraints();
                for (ConstraintDefinition constraintDef : constraints)
                {
                    Constraint constraint = constraintDef.getConstraint();
                    if (constraint instanceof ListOfValuesConstraint)
                    {
                        ListOfValuesConstraint listConstraint = (ListOfValuesConstraint) constraint;
                        String label = listConstraint.getDisplayLabel(String.valueOf(entry.getValue()), dictionaryService);
                        return new Pair<String, String>(propName, label);
                    }
                }
            }
            return null;
        }
    });
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:30,代码来源:WorkflowModelBuilder.java


示例3: afterPropertiesSet_setupConstraint

import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint; //导入依赖的package包/类
private void afterPropertiesSet_setupConstraint()
{
    if (this.selectorValuesConstraintShortName != null && !this.selectorValuesConstraintShortName.trim().isEmpty())
    {
        final ListOfValuesConstraint lovConstraint = new ListOfValuesConstraint();
        lovConstraint.setShortName(this.selectorValuesConstraintShortName);
        lovConstraint.setRegistry(this.constraintRegistry);
        lovConstraint.setAllowedValues(new ArrayList<>(this.storeBySelectorPropertyValue.keySet()));
        lovConstraint.initialize();
    }
}
 
开发者ID:Acosix,项目名称:alfresco-simple-content-stores,代码行数:12,代码来源:SelectorPropertyContentStore.java


示例4: setupConstraints

import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint; //导入依赖的package包/类
/**
 * Sets up client validation rules for any constraints the property has.
 * 
 * @param context FacesContext
 * propertySheet The property sheet being generated
 * @param property The property being generated
 * @param propertyDef The data dictionary definition of the property
 * @param component The component representing the property
 */
protected void setupConstraints(FacesContext context, 
      UIPropertySheet propertySheet, PropertySheetItem property, 
      PropertyDefinition propertyDef, UIComponent component)
{
   // only setup constraints if the property sheet is in edit mode,
   // validation is enabled
   if (propertySheet.inEditMode() && propertySheet.isValidationEnabled() &&
       propertyDef != null)
   {
      List<ConstraintDefinition> constraints = propertyDef.getConstraints();
      for (ConstraintDefinition constraintDef : constraints)
      {
         Constraint constraint = constraintDef.getConstraint();
            
         if (constraint instanceof RegexConstraint)
         {
            setupRegexConstraint(context, propertySheet, property, component,
                  (RegexConstraint)constraint, false);
         }
         else if (constraint instanceof StringLengthConstraint)
         {
            setupStringLengthConstraint(context, propertySheet, property, component,
                  (StringLengthConstraint)constraint, false);
         }
         else if (constraint instanceof NumericRangeConstraint)
         {
            setupNumericRangeConstraint(context, propertySheet, property, component,
                  (NumericRangeConstraint)constraint, false);
         }
         else if (constraint instanceof ListOfValuesConstraint)
         {
            // NOTE: This is dealt with at the component creation stage
            //       as a different component is usually required.
         }
      }
   }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:47,代码来源:BaseComponentGenerator.java


示例5: makeFieldConstraints

import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint; //导入依赖的package包/类
private List<FieldConstraint> makeFieldConstraints(PropertyDefinition propDef)
{
    List<FieldConstraint> fieldConstraints = null;
    List<ConstraintDefinition> constraints = propDef.getConstraints();
    if (constraints != null && constraints.size() > 0)
    {
        fieldConstraints = new ArrayList<FieldConstraint>(constraints.size());
        for (ConstraintDefinition constraintDef : constraints)
        {
            Constraint constraint = constraintDef.getConstraint();
            String type = constraint.getType();
            Map<String, Object> params = constraint.getParameters();
            
            
            //ListOfValuesConstraints have special handling for localising their allowedValues.
            //If the constraint that we are currently handling is a registered constraint then
            //we need to examine the underlying constraint to see if it is a LIST constraint
            if (RegisteredConstraint.class.isAssignableFrom(constraint.getClass()))
            {
                constraint = ((RegisteredConstraint)constraint).getRegisteredConstraint();
            }
            
            if (ListOfValuesConstraint.class.isAssignableFrom(constraint.getClass()))
            {
                ListOfValuesConstraint lovConstraint = (ListOfValuesConstraint) constraint;
                List<String> allowedValues = lovConstraint.getAllowedValues();
                List<String> localisedValues = new ArrayList<String>(allowedValues.size());
                
                // Look up each localised display-label in turn.
                for (String value : allowedValues)
                {
                    String displayLabel = lovConstraint.getDisplayLabel(value, dictionaryService);
                    // Change the allowedValue entry to the format the FormsService expects for localised strings: "value|label"
                    // If there is no localisation defined for any value, then this will give us "value|value".
                    localisedValues.add(value + "|" + displayLabel);
                }
                
                // Now replace the allowedValues param with our localised version.
                params.put(ListOfValuesConstraint.ALLOWED_VALUES_PARAM, localisedValues);
            }
            FieldConstraint fieldConstraint = new FieldConstraint(type, params);
            fieldConstraints.add(fieldConstraint);
        }
    }
    return fieldConstraints;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:47,代码来源:PropertyFieldProcessor.java


示例6: newInstance

import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint; //导入依赖的package包/类
@Override
protected Constraint newInstance()
{
    return new ListOfValuesConstraint();
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:6,代码来源:M2ConstraintDefinition.java


示例7: setupConverter

import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint; //导入依赖的package包/类
protected void setupConverter(FacesContext context, 
      UIPropertySheet propertySheet, PropertySheetItem property, 
      PropertyDefinition propertyDef, UIComponent component)
{
   // do default processing
   super.setupConverter(context, propertySheet, property, propertyDef, component);
   
   // if there isn't a converter and the property has a list of values constraint
   // on a number property we need to add the appropriate one.
   if (propertySheet.inEditMode() && propertyDef != null && 
       component instanceof UIOutput)
   {
      Converter converter = ((UIOutput)component).getConverter();
      if (converter == null)
      {
         ListOfValuesConstraint constraint = getListOfValuesConstraint(context, 
                  propertySheet, property);
         if (constraint != null)
         {
            String converterId = null;
            
            if (propertyDef.getDataType().getName().equals(DataTypeDefinition.INT))
            {
               converterId = IntegerConverter.CONVERTER_ID;
            }
            else if (propertyDef.getDataType().getName().equals(DataTypeDefinition.LONG))
            {
               converterId = LongConverter.CONVERTER_ID;
            }
            else if (propertyDef.getDataType().getName().equals(DataTypeDefinition.DOUBLE))
            {
               // NOTE: the constant for the double converter is wrong in MyFaces!!
               converterId = "javax.faces.Double";
            }
            else if (propertyDef.getDataType().getName().equals(DataTypeDefinition.FLOAT))
            {
               converterId = FloatConverter.CONVERTER_ID;
            }
            
            if (converterId != null)
            {
               createAndSetConverter(context, converterId, component);
            }
         }
      }
   }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:48,代码来源:TextFieldGenerator.java



注:本文中的org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SimpleProvider类代码示例发布时间:2022-05-22
下一篇:
Java Text类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap