本文整理了Java中com.haulmont.chile.core.model.MetaClass.getPropertyPath()
方法的一些代码示例,展示了MetaClass.getPropertyPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaClass.getPropertyPath()
方法的具体详情如下:
包路径:com.haulmont.chile.core.model.MetaClass
类名称:MetaClass
方法名:getPropertyPath
[英]Returns MetaPropertyPath object, representing path to the property from the current class
[中]返回MetaPropertyPath对象,表示从当前类到属性的路径
代码示例来源:origin: com.haulmont.cuba/cuba-gui
@Nullable
public MetaProperty getMetaProperty() {
MetaPropertyPath propertyPath = datasourceMetaClass.getPropertyPath(name);
return propertyPath != null ? propertyPath.getMetaProperty() : null;
}
}
代码示例来源:origin: com.haulmont.fts/fts-core
protected void includeByName(EntityDescr descr, MetaClass metaClass, String name) {
if (metaClass.getPropertyPath(name) != null) {
addPropertyToDescription(descr, name);
}
}
代码示例来源:origin: com.haulmont.cuba/cuba-core
protected Set<String> filterRemovedAttributes(MetaClass metaClass, Set<String> attributes) {
// filter attributes that do not exists in entity anymore
return attributes.stream()
.filter(attributeName -> {
if (DynamicAttributesUtils.isDynamicAttribute(attributeName)) {
return dynamicAttributesTools.getMetaPropertyPath(metaClass, attributeName) != null;
} else {
return metaClass.getPropertyPath(attributeName) != null;
}
})
.collect(Collectors.toSet());
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
@Override
public String getTreeCaption() {
if (!Strings.isNullOrEmpty(this.caption)) {
return locCaption;
} else {
MessageTools messageTools = AppBeans.get(MessageTools.class);
MetaPropertyPath mpp = datasourceMetaClass.getPropertyPath(name);
return mpp != null ? messageTools.getPropertyCaption(datasourceMetaClass, name) : name;
}
}
代码示例来源:origin: com.haulmont.charts/charts-web
protected MetaPropertyPath resolveMetaPropertyPath(MetaClass metaClass, String property) {
MetaPropertyPath mpp = metaClass.getPropertyPath(property);
if (mpp == null && DynamicAttributesUtils.isDynamicAttribute(property)) {
mpp = DynamicAttributesUtils.getMetaPropertyPath(metaClass, property);
}
return mpp;
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
protected MetaPropertyPath resolveMetaPropertyPath(MetaClass metaClass, String property) {
MetaPropertyPath mpp = metaClass.getPropertyPath(property);
if (mpp == null && DynamicAttributesUtils.isDynamicAttribute(property)) {
mpp = dynamicAttributesTools.getMetaPropertyPath(metaClass, property);
}
return mpp;
}
代码示例来源:origin: de.diedavids.cuba.entitysoftreference/entity-soft-reference-web
protected MetaPropertyPath resolveMetaPropertyPath(MetaClass metaClass, String property) {
MetaPropertyPath mpp = metaClass.getPropertyPath(property);
if (mpp == null && DynamicAttributesUtils.isDynamicAttribute(property)) {
mpp = DynamicAttributesUtils.getMetaPropertyPath(metaClass, property);
}
return mpp;
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
@Deprecated
public Column(Class<T> entityClass, String propertyPath) {
MetaClass metaClass = AppBeans.get(Metadata.class).getClassNN(entityClass);
MetaPropertyPath mpp = metaClass.getPropertyPath(propertyPath);
if (mpp == null) {
throw new IllegalArgumentException(String.format("Unable to find %s in %s", propertyPath, entityClass));
}
this.id = mpp;
this.caption = AppBeans.get(MessageTools.class).getPropertyCaption(metaClass, propertyPath);
this.type = mpp.getRangeJavaClass();
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
protected Comparator<Entity> createComparator(Sort sort, MetaClass metaClass) {
if (sort.getOrders().size() > 1) {
throw new UnsupportedOperationException("Sort by multiple properties is not supported");
}
MetaPropertyPath propertyPath = metaClass.getPropertyPath(sort.getOrders().get(0).getProperty());
if (propertyPath == null) {
throw new IllegalArgumentException("Property " + sort.getOrders().get(0).getProperty() + " is invalid");
}
boolean asc = sort.getOrders().get(0).getDirection() == Sort.Direction.ASC;
return new EntityComparator<>(propertyPath, asc);
}
}
代码示例来源:origin: com.haulmont.cuba/cuba-web
@Override
public void removeGeneratedColumn(String columnId) {
EntityTableItems<E> entityTableSource = (EntityTableItems<E>) getItems();
MetaPropertyPath targetCol = entityTableSource != null ?
entityTableSource.getEntityMetaClass().getPropertyPath(columnId) : null;
removeGeneratedColumnInternal(targetCol == null ? columnId : targetCol);
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
protected MetaProperty getInverseProperty() {
MetaPropertyPath mpp = getEntityMetaClass().getPropertyPath(metaPropertyPath.toPathString());
if (mpp == null) {
return null;
}
return mpp.getMetaProperty().getInverse();
}
代码示例来源:origin: com.haulmont.cuba/cuba-core
protected List<Integer> getNotPermittedSelectIndexes(QueryParser queryParser) {
List<Integer> indexes = new ArrayList<>();
int index = 0;
for (QueryParser.QueryPath path : queryParser.getQueryPaths()) {
if (path.isSelectedPath()) {
MetaClass metaClass = metadata.getClassNN(path.getEntityName());
if (!Objects.equals(path.getPropertyPath(), path.getVariableName()) && !isEntityAttrViewPermitted(metaClass.getPropertyPath(path.getPropertyPath()))) {
indexes.add(index);
}
index++;
}
}
return indexes;
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
@Override
public AbstractCondition createCondition() {
OpManager opManager = AppBeans.get(OpManager.class);
MetadataTools metadataTools = AppBeans.get(MetadataTools.class);
PropertyCondition propertyCondition = new PropertyCondition(this, entityAlias);
MetaPropertyPath propertyPath = datasourceMetaClass.getPropertyPath(name);
if (propertyPath == null) {
throw new IllegalStateException(String.format("Unable to find property '%s' in entity %s", name, datasourceMetaClass));
}
MetaClass propertyMetaClass = metadataTools.getPropertyEnclosingMetaClass(propertyPath);
EnumSet<Op> ops = opManager.availableOps(propertyMetaClass, propertyPath.getMetaProperty());
propertyCondition.setOperator(ops.iterator().next());
return propertyCondition;
}
代码示例来源:origin: com.haulmont.bpm/bpm-gui
protected void sortProcActors() {
CollectionDatasource.Sortable.SortInfo procRoleOrderSortInfo = new CollectionDatasource.Sortable.SortInfo();
procRoleOrderSortInfo.setOrder(CollectionDatasource.Sortable.Order.ASC);
procRoleOrderSortInfo.setPropertyPath(procActorsDs.getMetaClass().getPropertyPath("procRole.order"));
CollectionDatasource.Sortable.SortInfo procActorOrderSortInfo = new CollectionDatasource.Sortable.SortInfo();
procActorOrderSortInfo.setOrder(CollectionDatasource.Sortable.Order.ASC);
procActorOrderSortInfo.setPropertyPath(procActorsDs.getMetaClass().getPropertyPath("order"));
((CollectionDatasource.Sortable) procActorsDs).sort(new CollectionDatasource.Sortable.SortInfo[]{procRoleOrderSortInfo, procActorOrderSortInfo});
}
}
代码示例来源:origin: com.haulmont.fts/fts-core
public void addProperty(String name) {
MetaPropertyPath propertyPath = metaClass.getPropertyPath(name);
if (propertyPath == null)
throw new RuntimeException("Property " + name + " doesn't exist for entity " + metaClass.getName());
if (propertyPath.getMetaProperties().length > 1
&& !propertyPath.getRange().isClass()
&& !AppBeans.get(MetadataTools.class).isEmbedded(propertyPath.getMetaProperties()[0]))
throw new RuntimeException("Property " + name + " must be an entity (" + metaClass.getName() + ")");
properties.put(name, propertyPath.getRange().isClass());
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
protected MetaProperty getInverseProperty() {
MetaPropertyPath mpp = getMaster().getMetaClass().getPropertyPath(metaPropertyPath.toPathString());
if (mpp == null) {
return null;
}
return mpp.getMetaProperty().getInverse();
}
代码示例来源:origin: com.haulmont.reports/reports-gui
protected void sortSeriesByOrder() {
CollectionDatasource.Sortable.SortInfo<MetaPropertyPath> sortInfo = new CollectionDatasource.Sortable.SortInfo<>();
sortInfo.setOrder(CollectionDatasource.Sortable.Order.ASC);
sortInfo.setPropertyPath(seriesDs.getMetaClass().getPropertyPath("order"));
seriesDs.sort(new CollectionDatasource.Sortable.SortInfo[]{sortInfo});
}
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
protected void loadValidators(FieldGroup fieldGroup, FieldGroup.FieldConfig field) {
MetaPropertyPath metaPropertyPath = rds.getMetaClass().getPropertyPath(field.getProperty());
if (metaPropertyPath != null) {
MetaProperty metaProperty = metaPropertyPath.getMetaProperty();
Consumer validator = getValidator(metaProperty);
if (validator != null) {
field.addValidator(validator);
}
}
}
代码示例来源:origin: com.haulmont.reports/reports-gui
protected void sortTableDsByItemsOrderNum() {
if (listComponent.getDatasource() instanceof CollectionDatasource.Sortable) {
CollectionDatasource.Sortable.SortInfo sortInfo = new CollectionDatasource.Sortable.SortInfo();
sortInfo.setOrder(CollectionDatasource.Sortable.Order.ASC);
sortInfo.setPropertyPath(listComponent.getSingleSelected().getMetaClass().getPropertyPath("orderNum"));
((CollectionDatasource.Sortable) listComponent.getDatasource()).sort(new CollectionDatasource.Sortable.SortInfo[]{sortInfo});
}
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
protected boolean canUpdateMasterRefs() {
MetaPropertyPath mpp = getEntityMetaClass().getPropertyPath(metaPropertyPath.toPathString());
if (mpp == null) {
return false;
}
if (!mpp.getMetaProperty().getRange().getCardinality().isMany()) {
return false;
}
MetaProperty inverseProperty = mpp.getMetaProperty().getInverse();
return inverseProperty != null
&& inverseProperty.getType() == MetaProperty.Type.ASSOCIATION
&& !inverseProperty.getRange().getCardinality().isMany();
}
内容来源于网络,如有侵权,请联系作者删除!