use of org.hisp.dhis.user.User in project dhis2-core by dhis2.
the class MetaDataImportAction method execute.
// -------------------------------------------------------------------------
// Action Implementation
// -------------------------------------------------------------------------
@Override
public String execute() throws Exception {
strategy = strategy != null ? strategy : ImportStrategy.NEW_AND_UPDATES;
User user = currentUserService.getCurrentUser();
TaskId taskId = new TaskId(TaskCategory.METADATA_IMPORT, user);
notifier.clear(taskId);
InputStream in = StreamUtils.wrapAndCheckCompressionFormat(new FileInputStream(upload));
MetadataImportParams importParams = createMetadataImportParams(taskId, strategy, atomicMode, dryRun).setFilename(uploadFileName);
if ("csv".equals(importFormat)) {
if (classKey != null && CSV_SUPPORTED_CLASSES.containsKey(classKey)) {
scheduler.executeTask(new ImportMetaDataCsvTask(importService, csvImportService, schemaService, importParams, in, CSV_SUPPORTED_CLASSES.get(classKey)));
}
} else if ("gml".equals(importFormat)) {
scheduler.executeTask(new ImportMetaDataGmlTask(gmlImportService, importParams, in));
} else if ("json".equals(importFormat) || "xml".equals(importFormat)) {
scheduler.executeTask(new ImportMetaDataTask(importService, schemaService, importParams, in, importFormat));
}
return SUCCESS;
}
use of org.hisp.dhis.user.User in project dhis2-core by dhis2.
the class SendMessagesAction method updateRecipients.
/**
*
* @param recipientCheckBox
*/
private void updateRecipients(String recipientCheckBox) {
recipient = new HashSet<>();
if (recipientCheckBox != null) {
String[] rcbArray = recipientCheckBox.split(",");
for (int i = 0; i < rcbArray.length; i++) {
rcbArray[i] = rcbArray[i].trim();
User u = userService.getUser(Integer.parseInt(rcbArray[i]));
recipient.add(u);
}
}
}
use of org.hisp.dhis.user.User in project dhis2-core by dhis2.
the class GetSettingsAction method execute.
// -------------------------------------------------------------------------
// Action Implementation
// -------------------------------------------------------------------------
@Override
public String execute() throws Exception {
// ---------------------------------------------------------------------
// Get available locales
// ---------------------------------------------------------------------
availableLocales = new ArrayList<>(resourceBundleManager.getAvailableLocales());
Collections.sort(availableLocales, new Comparator<Locale>() {
@Override
public int compare(Locale locale0, Locale locale1) {
return locale0.getDisplayName().compareTo(locale1.getDisplayName());
}
});
currentLocale = localeManager.getCurrentLocale();
// ---------------------------------------------------------------------
// Get settings for current user
// ---------------------------------------------------------------------
User user = currentUserService.getCurrentUser();
Validate.notNull(user);
firstName = user.getFirstName();
surname = user.getSurname();
phoneNumber = user.getPhoneNumber();
email = user.getEmail();
return SUCCESS;
}
use of org.hisp.dhis.user.User in project dhis2-core by dhis2.
the class AddRecipientAction method updateRecipients.
/**
*
* @param recipientCheckBox
*/
private void updateRecipients(String recipientCheckBox) {
recipient = new HashSet<>();
if (recipientCheckBox != null) {
String[] rcbArray = recipientCheckBox.split(",");
for (int i = 0; i < rcbArray.length; i++) {
rcbArray[i] = rcbArray[i].trim();
User u = userService.getUser(Integer.parseInt(rcbArray[i]));
recipient.add(u);
}
}
}
use of org.hisp.dhis.user.User in project dhis2-core by dhis2.
the class FindUserAction method updateRecipients.
/**
*
* @param recipientCheckBox
*/
private void updateRecipients(String recipientCheckBox) {
recipient = new HashSet<>();
if (recipientCheckBox != null) {
String[] rcbArray = recipientCheckBox.split(",");
for (int i = 0; i < rcbArray.length; i++) {
rcbArray[i] = rcbArray[i].trim();
User u = userService.getUser(Integer.parseInt(rcbArray[i]));
recipient.add(u);
}
}
}
Aggregations