use of org.openforis.idm.metamodel.NodeDefinition in project collect by openforis.
the class UniquenessCheckFormValidator method validateExpression.
private boolean validateExpression(ValidationContext ctx) {
if (validateRequired(ctx, EXPRESSION_FIELD)) {
ExpressionValidator expressionValidator = getExpressionValidator(ctx);
NodeDefinition contextNode = getContextNode(ctx);
String expression = getValue(ctx, EXPRESSION_FIELD);
ExpressionValidationResult result = expressionValidator.validateUniquenessExpression(contextNode.getParentDefinition(), contextNode, expression);
if (result.isError()) {
String message = Strings.firstNotBlank(result.getDetailedMessage(), result.getMessage());
addInvalidMessage(ctx, EXPRESSION_FIELD, getMessage(INVALID_EXPRESSION_MESSAGE_KEY, message));
return false;
}
}
return true;
}
use of org.openforis.idm.metamodel.NodeDefinition in project collect by openforis.
the class GeoDataController method processNodes.
private void processNodes(CollectSurvey survey, Integer recordOffset, Integer maxNumberOfRecords, int attributeId, NodeProcessor nodeProcessor) throws Exception {
NodeDefinition nodeDef = survey.getSchema().getDefinitionById(attributeId);
RecordFilter filter = new RecordFilter(survey);
filter.setOffset(recordOffset);
filter.setMaxNumberOfRecords(maxNumberOfRecords);
List<CollectRecordSummary> summaries = recordManager.loadSummaries(filter);
for (CollectRecordSummary summary : summaries) {
CollectRecord record = recordManager.load(survey, summary.getId(), summary.getStep(), false);
List<Node<?>> nodes = record.findNodesByPath(nodeDef.getPath());
for (Node<?> node : nodes) {
nodeProcessor.process(node);
}
}
}
use of org.openforis.idm.metamodel.NodeDefinition in project collect by openforis.
the class SchemaLayoutVM method getRootTabSet.
protected UITabSet getRootTabSet(Treeitem treeItem) {
if (treeItem != null) {
TreeNode<NodeDefinition> treeNode = treeItem.getValue();
NodeDefinition nodeDefn = treeNode.getData();
UIOptions uiOptions = survey.getUIOptions();
EntityDefinition rootEntity = nodeDefn.getRootEntity();
return uiOptions.getAssignedRootTabSet(rootEntity);
} else {
return null;
}
}
use of org.openforis.idm.metamodel.NodeDefinition in project collect by openforis.
the class SchemaLayoutVM method listOfNodesDropHandler.
@Listen("onDrop = tree#nodesTree")
public void listOfNodesDropHandler(DropEvent evt) {
Component dragged = evt.getDragged();
if (dragged instanceof Listitem) {
NodeDefinition node = ((Listitem) dragged).getValue();
CollectSurvey survey = getSurvey();
UIOptions uiOpts = survey.getUIOptions();
UITab oldTab = uiOpts.getAssignedTab(node, false);
uiOpts.removeTabAssociation(node);
if (oldTab != null) {
postNodePerTabChangedCommand(oldTab);
}
}
}
use of org.openforis.idm.metamodel.NodeDefinition in project collect by openforis.
the class CalculatedAttributeFormulaFormValidator method validateCondition.
private void validateCondition(ValidationContext ctx) {
NodeDefinition contextNode = getAttributeDefinition(ctx);
validateBooleanExpression(ctx, contextNode, CONDITION_FIELD);
}
Aggregations