use of org.openforis.collect.model.proxy.RecordProxy in project collect by openforis.
the class RecordController method toProxy.
private RecordProxy toProxy(CollectRecord record) {
String defaultLanguage = record.getSurvey().getDefaultLanguage();
Locale locale = new Locale(defaultLanguage);
ProxyContext context = new ProxyContext(locale, messageSource, surveyContext);
return new RecordProxy(record, context);
}
use of org.openforis.collect.model.proxy.RecordProxy in project collect by openforis.
the class DataService method createRecord.
@Secured(ENTRY)
public RecordProxy createRecord(String rootEntityName, String versionName, Step recordStep) throws RecordPersistenceException, RecordIndexException {
SessionState sessionState = sessionManager.getSessionState();
if (sessionState.isActiveRecordBeingEdited()) {
throw new MultipleEditException();
}
CollectSurvey activeSurvey = sessionState.getActiveSurvey();
User user = sessionState.getUser();
CollectRecord record = recordManager.instantiateRecord(activeSurvey, rootEntityName, user, versionName, recordStep);
NodeChangeSet changeSet = recordManager.initializeRecord(record);
List<RecordEvent> events = new EventProducer().produceFor(changeSet, user.getUsername());
sessionManager.onEvents(events);
sessionManager.setActiveRecord(record);
prepareRecordIndexing();
RecordProxy recordProxy = new RecordProxy(record, getProxyContext(), true);
return recordProxy;
}
Aggregations