Java Code Examples for org.apache.wicket.core.util.lang.PropertyResolver#getValue()

The following examples show how to use org.apache.wicket.core.util.lang.PropertyResolver#getValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MapOfListModel.java    From syncope with Apache License 2.0 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public List<T> getObject() {
    final String expression = propertyExpression();
    final Object target = getInnermostModelOrObject();

    if (target == null || StringUtils.isBlank(expression) || expression.startsWith(".")) {
        throw new IllegalArgumentException("Property expressions cannot start with a '.' character");
    }

    final Map<String, List<T>> map = (Map<String, List<T>>) PropertyResolver.getValue(expression, target);

    final List<T> res;
    if (map.containsKey(key)) {
        res = map.get(key);
    } else {
        res = new ArrayList<>();
        map.put(key, res);
    }
    return res;
}
 
Example 2
Source File: OClusterMetaPanel.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected V getValue(OCluster entity, String critery) {
    if(OClustersWidget.CONFLICT_STRATEGY.equals(critery))
    {
        ORecordConflictStrategy strategy = entity.getRecordConflictStrategy();
        return (V)(strategy!=null?strategy.getName():null);
    }
    else if(OClustersWidget.COMPRESSION.equals(critery))
    {
        return (V)entity.compression();
    }
    else {
        return (V) PropertyResolver.getValue(critery, entity);
    }
}
 
Example 3
Source File: OPropertyMetaPanel.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected V getValue(OProperty entity, String critery) {
	CustomAttribute custom;
	if(OPropertyPrototyper.COLLATE.equals(critery))
	{
		OCollate collate = entity.getCollate();
		return (V)(collate!=null?collate.getName():null);
	}
	else if((custom = CustomAttribute.getIfExists(critery))!=null)
	{
		return custom.getValue(entity);
	}
	else
	{
		return (V) PropertyResolver.getValue(critery, entity);
	}
}
 
Example 4
Source File: AbstractJavaSortableDataProvider.java    From wicket-orientdb with Apache License 2.0 5 votes vote down vote up
protected Comparable<?> comparableValue(T input, S sortParam)
{
	String property = getSortPropertyExpression(sortParam);
	if(property==null) return null;
	Object value = PropertyResolver.getValue(property, input);
	return value instanceof Comparable?(Comparable<?>)value:null;
}
 
Example 5
Source File: OIndexMetaPanel.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected V getValue(OIndex<?> entity, String critery) {
	if(OIndexPrototyper.DEF_COLLATE.equals(critery))
	{
		OIndexDefinition definition = entity.getDefinition();
		if(definition instanceof OCompositeIndexDefinition) return (V)"composite";
		OCollate collate = definition.getCollate();
		return (V)(collate!=null?collate.getName():null);
	}
	else
	{
		return (V) PropertyResolver.getValue(critery, entity);
	}
}
 
Example 6
Source File: OClassMetaPanel.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected V getValue(OClass entity, String critery) {
	CustomAttribute custom;
	if("clusterSelection".equals(critery))
	{
		OClusterSelectionStrategy strategy = entity.getClusterSelection();
		return (V)(strategy!=null?strategy.getName():null);
	}
	else if(OClassPrototyper.SUPER_CLASSES.equals(critery))
	{
		List<OClass> superClasses = entity.getSuperClasses();
		// Additional wrapping to ArrayList is required , because getSuperClasses return unmodifiable list
		return (V)(superClasses != null ? new ArrayList<OClass>(superClasses) : new ArrayList<OClass>());
	}
	else if((CustomAttribute.ON_CREATE_FIELDS.getName().equals(critery)) && (custom = CustomAttribute.getIfExists(critery)) != null)
	{
		String onCreateFields = custom.getValue(entity);
		return (V)(!Strings.isNullOrEmpty(onCreateFields)
				? Lists.newArrayList(onCreateFields.split(","))
				: new ArrayList<String>());
	}
	else if((custom = CustomAttribute.getIfExists(critery))!=null)
	{
		return custom.getValue(entity);
	}
	else
	{
		return (V)PropertyResolver.getValue(critery, entity);
	}
}
 
Example 7
Source File: DateColumn.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@Override
protected IModel<String> createLabelModel(IModel<T> rowModel) {
       Date date = (Date) PropertyResolver.getValue(getPropertyExpression(), rowModel.getObject());
       if (date == null) {
       	return new Model<String>("");
       }        
       return new Model<String>(LOCALE_DATE_FORMAT.format(date));
}