/** * Returns attributes persisted by PostgreSQL (e.g. no compound attributes and attributes with an * expression) * * @return stream of persisted attributes */ static Stream<Attribute> getPersistedAttributes(EntityType entityType) { return StreamSupport.stream(entityType.getAtomicAttributes().spliterator(), false) .filter(atomicAttr -> atomicAttr.getExpression() == null); }
@Override public EntityTypeSearchResults findAttributes( EntityType sourceEntityType, EntityType targetEntityType, Set<String> searchTerms) { List<AttributeSearchResults> attributeSearchResults = stream(targetEntityType.getAtomicAttributes().spliterator(), false) .filter(targetAttribute -> targetAttribute.getExpression() == null) .map( targetAttribute -> findAttributes( sourceEntityType, targetEntityType, targetAttribute, searchTerms)) .collect(toList()); return EntityTypeSearchResults.create(targetEntityType, attributeSearchResults); }
private void initRequiredValueValidation(ValidationResource validationResource) { if (!getCapabilities().contains(VALIDATE_NOTNULL_CONSTRAINT)) { List<Attribute> requiredValueAttrs = stream(getEntityType().getAtomicAttributes().spliterator(), false) .filter(attr -> !attr.isNillable() && attr.getExpression() == null) .collect(toList()); validationResource.setRequiredValueAttrs(requiredValueAttrs); } }
private void initReadonlyValidation(ValidationResource validationResource) { if (!getCapabilities().contains(VALIDATE_READONLY_CONSTRAINT)) { String idAttrName = getEntityType().getIdAttribute().getName(); List<Attribute> readonlyAttrs = stream(getEntityType().getAtomicAttributes().spliterator(), false) .filter( attr -> attr.isReadOnly() && attr.getExpression() == null && !attr.isMappedBy() && !attr.getName().equals(idAttrName)) .collect(toList()); validationResource.setReadonlyAttrs(readonlyAttrs); } }
LOG.debug("Select ID values for a batch of MREF attributes..."); for (Attribute mrefAttr : entityType.getAtomicAttributes()) { if (mrefAttr.getExpression() == null && isMultipleReferenceType(mrefAttr) && !(mrefAttr.getDataType() == ONE_TO_MANY && mrefAttr.isMappedBy())) {
this.expression = attr.getExpression(); } else this.expression = null;
/** * Creates a new entity based from a HttpServletRequest. For file attributes persists the file in * the file store and persist a file meta data entity. * * @param meta entity meta data * @param request HTTP request parameters * @return entity created from HTTP request parameters */ public Entity toEntity(final EntityType meta, final Map<String, Object> request) { final Entity entity = entityManager.create(meta, POPULATE); for (Attribute attr : meta.getAtomicAttributes()) { if (attr.getExpression() == null) { String paramName = attr.getName(); if (request.containsKey(paramName)) { final Object paramValue = request.get(paramName); Attribute idAttribute = meta.getIdAttribute(); Object idValue = request.get(idAttribute.getName()); final Object value = this.toEntityValue(attr, paramValue, idValue); entity.set(attr.getName(), value); } } } return entity; }
.filter(attr -> isReferenceType(attr) && attr.getExpression() == null) .collect(toList()); } else { attr -> isReferenceType(attr) && attr.getExpression() == null && isDifferentBackend(backend, attr)) .collect(toList());
.filter(attr -> attr.isUnique() && attr.getExpression() == null) .collect(toList());
@Override public Entity mapRow(ResultSet resultSet, int i) throws SQLException { Entity e = entityManager.createFetch(entityType, fetch); // TODO performance, iterate over fetch if available for (Attribute attr : entityType.getAtomicAttributes()) { if (fetch == null || fetch.hasField(attr.getName())) { if (attr.getExpression() != null) { continue; } e.set(attr.getName(), mapValue(resultSet, attr)); } } return e; }
if (attribute.getExpression() == null) { String name = attribute.getName(); Object value = dehydratedEntity.get(name);
if (attr.getExpression() != null) { throw new MolgenisDataException( "Computed attribute " + attr.getName() + " cannot have default value");
this.enumOptions = attr.getDataType() == AttributeType.ENUM ? attr.getEnumOptions() : null; this.maxLength = attr.getDataType().getMaxLength(); this.expression = attr.getExpression();
attributeReferenceMapper.toEditorAttributeIdentifier(attribute.getMappedBy()); EditorSort orderBy = sortMapper.toEditorSort(attribute.getOrderBy()); String expression = attribute.getExpression(); boolean nullable = attribute.isNillable(); boolean auto = attribute.isAuto();