@Override protected long countTotalItems() { Integer surveyId = survey.getId(); int count = survey.isWork() ? samplingDesignManager.countBySurveyWork(surveyId) : samplingDesignManager.countBySurvey(surveyId); return count; }
private List<ReferenceDataDefinition.Attribute> getSamplingPointInfoAttributes() { ReferenceDataSchema referenceDataSchema = survey.getReferenceDataSchema(); SamplingPointDefinition samplingPoint = referenceDataSchema == null ? null : referenceDataSchema.getSamplingPointDefinition(); if (samplingPoint == null) { return Collections.emptyList(); } else { List<ReferenceDataDefinition.Attribute> infoAttributes = samplingPoint.getAttributes(false); return infoAttributes; } }
@Test public void roundTripTest() throws Exception { CollectSurvey survey = loadSurvey(); String[] gpsModels = new String[] {"GPS MAP 62 S", "GPS MAP 60CSX", "SXBLUEII-L", "GPS MAP 62S"}; createIndex(survey, gpsModels); NodeDefinition autoCompleteNodeDefn = survey.getSchema().getDefinitionByPath("/cluster/gps_model"); testSingleResultMatching(survey, autoCompleteNodeDefn); testMultipleResultsFoundWithNonCompleteTerm(survey, autoCompleteNodeDefn); testMultipleResultsFound(survey, autoCompleteNodeDefn); // testSingleResultMatchingPhrase(survey, autoCompleteNodeDefn); testLimitedMultipleResultsFound(survey, autoCompleteNodeDefn); testNoResultsFound(survey, autoCompleteNodeDefn); }
@Override protected void execute() throws Throwable { if (getTotalItems() > 0) { Integer surveyId = survey.getId(); boolean work = survey.isWork(); CsvWriter writer = new CsvWriter(outputStream, OpenForisIOUtils.UTF_8, ',', '"'); SamplingDesignSummaries summaries = work ? samplingDesignManager.loadBySurveyWork(surveyId) : samplingDesignManager.loadBySurvey(surveyId); ArrayList<String> colNames = getHeaders(); writer.writeHeaders(colNames.toArray(new String[0])); List<SamplingDesignItem> items = summaries.getRecords(); for (SamplingDesignItem item : items) { writeSummary(writer, item); incrementItemsProcessed(); } writer.flush(); } }