use of org.openforis.idm.metamodel.Schema in project collect by openforis.
the class RecordIndexManager method search.
public List<String> search(SearchType searchType, Survey survey, int attributeDefnId, int fieldIndex, String queryText, int maxResults) throws RecordIndexException {
Schema schema = survey.getSchema();
AttributeDefinition defn = (AttributeDefinition) schema.getDefinitionById(attributeDefnId);
String indexName = defn.getAnnotation(Annotation.AUTOCOMPLETE.getQName());
if (StringUtils.isNotBlank(indexName)) {
IndexSearcher indexSearcher = null;
try {
indexSearcher = createIndexSearcher();
Set<String> result = search(indexName, indexSearcher, searchType, queryText, fieldIndex, maxResults);
List<String> sortedList = getSortedList(result);
return sortedList;
} catch (Exception e) {
throw new RecordIndexException(e);
} finally {
close(indexSearcher);
}
} else {
throw new RecordIndexException("Index name is not defined for attribute with id: " + attributeDefnId);
}
}
use of org.openforis.idm.metamodel.Schema in project collect by openforis.
the class NodeDefinitionPR method onEndTag.
@Override
protected final void onEndTag() throws XmlParseException {
EntityDefinition parentDefinition = getParentDefinition();
NodeDefinition definition = getDefinition();
if (parentDefinition == null) {
// System.out.println("Adding "+definition);
Schema schema = getSchema();
schema.addRootEntityDefinition((EntityDefinition) definition);
} else {
// System.out.println("Adding "+definition+" to "+parentDefinition);
parentDefinition.addChildDefinition(definition);
}
}
use of org.openforis.idm.metamodel.Schema in project collect by openforis.
the class DataQueryResultItem method getAttributeDefinition.
public AttributeDefinition getAttributeDefinition() {
Schema schema = query.getSchema();
AttributeDefinition def = (AttributeDefinition) schema.getDefinitionById(query.getAttributeDefinitionId());
return def;
}
use of org.openforis.idm.metamodel.Schema in project collect by openforis.
the class ModelService method getRootEntitiesSummaries.
public List<NodeDefinitionSummary> getRootEntitiesSummaries(String surveyName) {
String lang = getActiveLanguageCode();
List<NodeDefinitionSummary> result = new ArrayList<NodeDefinitionSummary>();
CollectSurvey survey = surveyManager.get(surveyName);
Schema schema = survey.getSchema();
List<EntityDefinition> rootEntityDefinitions = schema.getRootEntityDefinitions();
for (EntityDefinition entityDefinition : rootEntityDefinitions) {
Integer id = entityDefinition.getId();
String name = entityDefinition.getName();
String label = entityDefinition.getLabel(Type.HEADING, lang);
NodeDefinitionSummary summary = new NodeDefinitionSummary(id, name, label);
result.add(summary);
}
return result;
}
use of org.openforis.idm.metamodel.Schema in project collect by openforis.
the class SpeciesService method getTaxonAttributeDefinitionsForDesignerSurvey.
protected List<TaxonAttributeDefinition> getTaxonAttributeDefinitionsForDesignerSurvey(String oldName) {
CollectSurvey survey = sessionManager.getActiveDesignerSurvey();
Schema schema = survey.getSchema();
List<TaxonAttributeDefinition> defns = schema.getTaxonAttributeDefinitions(oldName);
return defns;
}
Aggregations