com.haulmont.cuba.core.entity.Entity.getValue()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中com.haulmont.cuba.core.entity.Entity.getValue()方法的一些代码示例,展示了Entity.getValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getValue()方法的具体详情如下:
包路径:com.haulmont.cuba.core.entity.Entity
类名称:Entity
方法名:getValue

Entity.getValue介绍

暂无

代码示例

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Nullable
  @Override
  public E getParent(E item) {
    Preconditions.checkNotNullArgument(item);
    return item.getValue(hierarchyProperty);
  }
}

代码示例来源: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-gui

@Override
public boolean hasChildren(E item) {
  return container.getItems().stream().anyMatch(it -> {
    E parentItem = it.getValue(hierarchyProperty);
    return parentItem != null && parentItem.equals(item);
  });
}

代码示例来源:origin: com.haulmont.cuba/cuba-core

protected Object getPropertyValue(Entity entity, MetaPropertyPath propertyPath) {
    return entity.getValue(propertyPath.toString());
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
public boolean hasChildren(E item) {
  return container.getItems().stream().anyMatch(it -> {
    E parentItem = it.getValue(hierarchyProperty);
    return parentItem != null && parentItem.equals(item);
  });
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Nullable
@Override
public E getParent(E item) {
  Preconditions.checkNotNullArgument(item, "item is null");
  return item.getValue(hierarchyProperty);
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
public boolean hasChildren(K itemId) {
  final Entity item = getItem(itemId);
  if (item == null) return false;
  if (hierarchyPropertyName != null) {
    for (T currentItem : getItems()) {
      Object parentItem = currentItem.getValue(hierarchyPropertyName);
      if (parentItem != null && parentItem.equals(item))
        return true;
    }
  }
  return false;
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
public Date getStart() {
  if (provider.getStartDateProperty() != null) {
    return entity.getValue(provider.getStartDateProperty());
  } else {
    return null;
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
public String getCaption() {
  if (provider.getCaptionProperty() != null) {
    return entity.getValue(provider.getCaptionProperty());
  } else {
    return null;
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
public String getStyleName() {
  if (provider.getStyleNameProperty() != null) {
    return entity.getValue(provider.getStyleNameProperty());
  } else {
    return null;
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
public Date getEnd() {
  if (provider.getEndDateProperty() != null) {
    return entity.getValue(provider.getEndDateProperty());
  } else {
    return null;
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
public String getDescription() {
  if (provider.getDescriptionProperty() != null) {
    return entity.getValue(provider.getDescriptionProperty());
  } else {
    return null;
  }
}

代码示例来源:origin: com.haulmont.reports/reports-core

protected void writeSimpleProperty(JsonWriter out, Entity entity, MetaProperty property) throws IOException {
  Object value = entity.getValue(property.getName());
  if (value != null) {
    out.name(property.getName());
    Datatype datatype = Datatypes.get(property.getJavaType());
    if (datatype != null) {
      out.value(datatype.format(value));
    } else {
      out.value(String.valueOf(value));
    }
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
public boolean isAllDay() {
  if (provider.getIsAllDayProperty() != null) {
    return BooleanUtils.isTrue(entity.getValue(provider.getIsAllDayProperty()));
  } else {
    return false;
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-core

protected boolean checkIfEntityBelongsToMaster(MetaProperty property, Entity entityToRemove) {
  MetaProperty inverseProperty = property.getInverse();
  if (inverseProperty != null && !inverseProperty.getRange().getCardinality().isMany()) {
    Entity master = entityToRemove.getValue(inverseProperty.getName());
    return entity.equals(master);
  } else {
    return true;
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

protected void updateMaster() {
  MetaProperty masterProperty = getMasterProperty();
  Collection masterCollection = master.getItem().getValue(masterProperty.getName());
  updateMasterCollection(masterProperty, masterCollection, this.collection);
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

protected String getFieldValue(String name) {
  if (datasource != null) {
    return datasource.getItem().getValue(name);
  } else if (window != null) {
    Field field = (Field) window.getComponentNN(name);
    return (String) field.getValue();
  } else {
    return (String) fieldGroup.getFieldValue(name);
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-core

protected void checkRequiredAttributes(Entity entity) {
  SecurityState securityState = getSecurityState(entity);
  if (securityState != null && !securityState.getRequiredAttributes().isEmpty()) {
    for (MetaProperty metaProperty : entity.getMetaClass().getProperties()) {
      String propertyName = metaProperty.getName();
      if (BaseEntityInternalAccess.isRequired(securityState, propertyName) && entity.getValue(propertyName) == null) {
        throw new RowLevelSecurityException(format("Attribute [%s] is required for entity %s", propertyName, entity),
            entity.getMetaClass().getName());
      }
    }
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-core

protected Entity getReference(Entity entity, MetaProperty property) {
  if (PersistenceHelper.isLoaded(entity, property.getName()))
    return entity.getValue(property.getName());
  else {
    Query query = entityManager.createQuery(
        "select e." + property.getName() + " from " + entity.getMetaClass().getName() + " e where e." + primaryKeyName + " = ?1");
    query.setParameter(1, entity.getId());
    Object refEntity = query.getFirstResult();
    return (Entity) refEntity;
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-core

private void loadOne(EntityCrossDataStoreProperty entityCrossDataStoreProperty) {
  Entity entity = entityCrossDataStoreProperty.entity;
  CrossDataStoreProperty aProp = entityCrossDataStoreProperty.crossProp;
  Object id = entity.getValue(aProp.relatedPropertyName);
  LoadContext<Entity> loadContext = new LoadContext<>(aProp.property.getRange().asClass());
  loadContext.setId(id);
  if (aProp.viewProperty.getView() != null)
    loadContext.setView(aProp.viewProperty.getView());
  loadContext.setJoinTransaction(joinTransaction);
  Entity relatedEntity = dataManager.load(loadContext);
  entity.setValue(aProp.property.getName(), relatedEntity);
}

相关文章