本文整理了Java中com.haulmont.cuba.core.entity.Entity.getValueEx()
方法的一些代码示例,展示了Entity.getValueEx()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getValueEx()
方法的具体详情如下:
包路径:com.haulmont.cuba.core.entity.Entity
类名称:Entity
方法名:getValueEx
暂无
代码示例来源:origin: com.haulmont.cuba/cuba-web
@Override
public T apply(E entity) {
return propertyPath != null
? entity.getValueEx(propertyPath)
: null;
}
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
@Override
public V getValue() {
E item = datasource.getItem();
if (item != null) {
return item.getValueEx(metaPropertyPath);
}
return null;
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
@Override
public Object getItemValue(Object itemId, Object propertyId) {
MetaPropertyPath propertyPath = (MetaPropertyPath) propertyId;
return container.getItem(itemId).getValueEx(propertyPath);
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
@Override
public Object getItemValue(Object itemId, Object propertyId) {
MetaPropertyPath propertyPath = (MetaPropertyPath) propertyId;
return datasource.getItemNN(itemId).getValueEx(propertyPath);
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
@Override
public V getValue() {
E item = container.getItemOrNull();
if (item != null) {
return item.getValueEx(metaPropertyPath);
}
return null;
}
代码示例来源:origin: com.haulmont.charts/charts-gui
/**
* Returns the value of entity property with the specified property name.
*
* @param property name of entity property
* @return the value of entity property with the specified property name.
* <ul>
* <li>If property value is an instance of {@link Collection},
* then method returns {@link List} of {@link EntityDataItem}.</li>
* <li>Otherwise method returns value by {@link Instance#getValue(java.lang.String)}</li>
* </ul>
*/
@Override
public Object getValue(String property) {
Object value = item.getValueEx(property);
if (value instanceof Collection) {
List<DataItem> items = new ArrayList<>();
for (Object item : (Collection) value) {
items.add(new EntityDataItem((Entity) item));
}
return items;
}
return value;
}
代码示例来源:origin: com.haulmont.cuba/cuba-core
protected List<String> convertWhere(String tableAlias, FieldEntry fieldEntry, Entity entity) {
List<String> where = new ArrayList<>();
if (fieldEntry.isEmbedded) {
for (FieldEntry entry : fieldEntry.fieldsMapping.values()) {
where.addAll(convertWhere(tableAlias, entry, entity));
}
} else {
where.add(tableAlias + "." + fieldEntry.columnName + " = " +
convertValue(entity, fieldEntry.getFieldName(), entity.getValueEx(fieldEntry.getFieldName())));
}
return where;
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
protected Object getValueByProperty(E item, MetaPropertyPath property) {
Preconditions.checkNotNullArgument(item);
return item.getValueEx(property.toString());
}
代码示例来源:origin: com.haulmont.cuba/cuba-core
protected Pair<List<String>, List<String>> getInsertStrings(FieldEntry fieldEntry, Entity entity) {
List<String> columnNames = new ArrayList<>();
List<String> valuesStr = new ArrayList<>();
String fieldName = fieldEntry.getFieldName();
if (fieldEntry.isEmbedded) {
for (FieldEntry entry : fieldEntry.fieldsMapping.values()) {
Pair<List<String>, List<String>> insertStrings = getInsertStrings(entry, entity);
columnNames.addAll(insertStrings.getFirst());
valuesStr.addAll(insertStrings.getSecond());
}
} else {
Object value = entity.getValueEx(fieldName);
columnNames.add(fieldEntry.columnName);
valuesStr.add(convertValue(entity, fieldName, value));
}
return new Pair<>(columnNames, valuesStr);
}
代码示例来源:origin: com.haulmont.cuba/cuba-core
protected Pair<List<String>, List<String>> getUpdateStrings(FieldEntry fieldEntry, Entity entity) {
List<String> valuesStr = new ArrayList<>();
List<String> whereStr = new ArrayList<>();
String fieldName = fieldEntry.getFieldName();
if (!fieldName.equalsIgnoreCase(ID)) {
if (fieldEntry.isEmbedded) {
for (FieldEntry entry : fieldEntry.fieldsMapping.values()) {
Pair<List<String>, List<String>> updateStrings = getUpdateStrings(entry, entity);
valuesStr.addAll(updateStrings.getSecond());
}
} else {
Object value = entity.getValueEx(fieldName);
valuesStr.add(format("%s=%s", fieldEntry.columnName, convertValue(entity, fieldName, value)));
}
} else {
if (fieldEntry.isEmbedded) {
for (FieldEntry entry : fieldEntry.fieldsMapping.values()) {
Pair<List<String>, List<String>> updateStrings = getUpdateStrings(entry, entity);
whereStr.addAll(updateStrings.getFirst());
}
} else {
Object value = entity.getValueEx(fieldName);
whereStr.add(format("%s=%s", fieldEntry.columnName, convertValue(entity, fieldName, value)));
}
}
return new Pair<>(valuesStr, whereStr);
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
@Override
public String apply(Object o) {
if (!(o instanceof Entity)) {
return "";
}
Entity entity = (Entity) o;
if (captionMode == CaptionMode.PROPERTY
&& captionProperty != null) {
if (entity.getMetaClass().getPropertyPath(captionProperty) == null) {
throw new IllegalArgumentException(String.format("Couldn't find property with name '%s'", captionProperty));
}
Object propertyValue = entity.getValueEx(captionProperty);
return propertyValue != null
? propertyValue.toString()
: " ";
}
return metadata.getTools().getInstanceName(entity);
}
代码示例来源:origin: com.haulmont.fts/fts-core
protected String createAllFieldContent(Entity entity, EntityDescr descr) throws IndexingException {
StringBuilder sb = new StringBuilder();
for (String propName : descr.getLocalProperties()) {
Object value = entity.getValueEx(propName); // using getValueEx() to support embedded entities
String str = valueFormatter.format(value);
if (str != null && !StringUtils.isBlank(str)) {
if (ftsConfig.getStoreContentInIndex()) {
appendString(sb, makeFieldName(propName));
}
appendString(sb, str);
}
}
if (entity instanceof FileDescriptor) {
appendString(sb, makeFieldName(FTS.FILE_CONT_PROP));
sb.append(FTS.FIELD_SEP).append(((FileDescriptor) entity).getName().replaceAll("\\s+", FTS.FIELD_SEP));
appendFileContent(sb, (FileDescriptor) entity);
}
if (log.isTraceEnabled())
log.trace("Entity {} all field: {}", entity, sb.toString());
return sb.toString();
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
protected Object getValueByProperty(T item, MetaPropertyPath property) {
Preconditions.checkNotNullArgument(item);
if (property.getMetaProperties().length == 1) {
return item.getValue(property.getMetaProperty().getName());
} else {
return item.getValueEx(property);
}
}
代码示例来源:origin: com.haulmont.cuba/cuba-web
Object value = item.getValueEx(propertyPath);
String stringValue;
if (value instanceof String) {
stringValue = item.getValueEx(propertyPath);
} else {
if (DynamicAttributesUtils.isDynamicAttribute(propertyPath.getMetaProperty())) {
Entity item = dataBinding.getTableItems().getItem(itemId);
if (item != null) {
Boolean value = item.getValueEx(propertyPath);
if (BooleanUtils.isTrue(value)) {
style = "boolean-cell boolean-cell-true";
代码示例来源:origin: com.haulmont.cuba/cuba-gui
/**
* Set field's "required" flag to false if the value has been filtered by Row Level Security
* This is necessary to allow user to submit form with filtered attribute even if attribute is required
*/
public static void handleFilteredAttributes(Field component, Datasource datasource, MetaPropertyPath mpp) {
if (component.isRequired()
&& datasource.getState() == Datasource.State.VALID
&& datasource.getItem() != null
&& mpp.getMetaProperty().getRange().isClass()) {
Entity targetItem = datasource.getItem();
MetaProperty[] propertiesChain = mpp.getMetaProperties();
if (propertiesChain.length > 1) {
String basePropertyItem = Arrays.stream(propertiesChain)
.limit(propertiesChain.length - 1)
.map(MetadataObject::getName)
.collect(Collectors.joining("."));
targetItem = datasource.getItem().getValueEx(basePropertyItem);
}
if (targetItem instanceof BaseGenericIdEntity) {
String metaPropertyName = mpp.getMetaProperty().getName();
Object value = targetItem.getValue(metaPropertyName);
BaseGenericIdEntity baseGenericIdEntity = (BaseGenericIdEntity) targetItem;
String[] filteredAttributes = getFilteredAttributes(baseGenericIdEntity);
if (value == null && filteredAttributes != null
&& ArrayUtils.contains(filteredAttributes, metaPropertyName)) {
component.setRequired(false);
}
}
}
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
Collection<? extends V> itemValue = getItem().getValueEx(metaPropertyPath.toPathString());
Collection<V> oldValue = itemValue != null ? new ArrayList<>(itemValue) : null;
代码示例来源:origin: com.haulmont.cuba/cuba-gui
Collection<V> itemValue = getMaster().getItem().getValueEx(metaPropertyPath.toPathString());
Collection<V> oldValue = itemValue == null
? null
代码示例来源:origin: com.haulmont.cuba/cuba-core
MetaProperty metaProperty = propertyPath.getMetaProperty();
String value = stringify(entity.getValueEx(name), metaProperty);
attr.setValue(value);
Object valueId = getValueId(entity.getValueEx(name));
if (valueId != null)
attr.setValueId(valueId.toString());
代码示例来源:origin: com.haulmont.cuba/cuba-web
if (StringUtils.isNotEmpty(captionProperty)) {
E item = getItems().getItemNN(rowId);
Object captionValue = item.getValueEx(captionProperty);
return captionValue != null ? String.valueOf(captionValue) : null;
代码示例来源:origin: com.haulmont.cuba/cuba-web
if (DynamicAttributesUtils.isDynamicAttribute(columnId)) {
metaProperty = dynamicAttributesTools.getMetaPropertyPath(item.getMetaClass(), columnId).getMetaProperty();
value = dynamicAttributesTools.getDynamicAttributeValueAsString(metaProperty, item.getValueEx(columnId));
} else {
value = item.getValueEx(columnId);
内容来源于网络,如有侵权,请联系作者删除!