use of org.openforis.collect.model.User in project collect by openforis.
the class DataService method checkoutRecord.
@Secured(ENTRY_LIMITED)
public RecordProxy checkoutRecord(int id, Integer stepNumber, boolean forceUnlock) throws RecordPersistenceException, RecordIndexException {
SessionState sessionState = sessionManager.getSessionState();
if (sessionState.isActiveRecordBeingEdited()) {
throw new MultipleEditException();
}
final CollectSurvey survey = sessionState.getActiveSurvey();
User user = sessionState.getUser();
Step step = stepNumber == null ? null : Step.valueOf(stepNumber);
CollectRecord record = step == null ? recordManager.checkout(survey, user, id, sessionState.getSessionId(), forceUnlock) : recordManager.checkout(survey, user, id, step, sessionState.getSessionId(), forceUnlock);
sessionManager.setActiveRecord(record);
prepareRecordIndexing();
return toProxy(record);
}
use of org.openforis.collect.model.User in project collect by openforis.
the class ModelService method getSurveySummaries.
public List<SurveySummary> getSurveySummaries() {
String lang = getActiveLanguageCode();
User loggedUser = sessionManager.getLoggedUser();
List<SurveySummary> summaries = surveyManager.getSurveySummaries(lang, loggedUser);
return summaries;
}
use of org.openforis.collect.model.User in project collect by openforis.
the class UserService method save.
public UserProxy save(UserProxy user) throws UserPersistenceException {
User u = user.toUser();
userManager.save(u, sessionManager.getLoggedUser());
UserProxy proxy = new UserProxy(u);
return proxy;
}
use of org.openforis.collect.model.User in project collect by openforis.
the class UserProxy method toUser.
public User toUser() {
User user = super.toUser();
user.setPassword(password);
user.setRawPassword(rawPassword);
user.setRoles(getRolesFromCodes(roles));
return user;
}
use of org.openforis.collect.model.User in project collect by openforis.
the class DataHandler method startRecord.
public void startRecord(String localName, Attributes attributes) {
String versionName = extractVersionName(attributes);
record = new CollectRecord(currentSurvey, versionName, localName, validationEnabled);
String stateAttr = attributes.getValue(ATTRIBUTE_STATE);
State state = State.fromCode(stateAttr);
record.setState(state);
Date created = Dates.parseDateTime(attributes.getValue(ATTRIBUTE_DATE_CREATED));
Date modified = Dates.parseDateTime(attributes.getValue(ATTRIBUTE_DATE_MODIFIED));
record.setCreationDate(created);
record.setModifiedDate(modified);
String createdByUserName = attributes.getValue(ATTRIBUTE_CREATED_BY);
User createdBy = fetchUser(createdByUserName);
record.setCreatedBy(createdBy);
String modifiedByUserName = attributes.getValue(ATTRIBUTE_MODIFIED_BY);
User modifiedBy = fetchUser(modifiedByUserName);
record.setModifiedBy(modifiedBy);
node = record.getRootEntity();
}
Aggregations