use of javax.faces.application.FacesMessage in project dataverse by IQSS.
the class HarvestingClientsPage method init.
public String init() {
if (!isSessionUserAuthenticated()) {
return "/loginpage.xhtml" + navigationWrapper.getRedirectPage();
} else if (!isSuperUser()) {
return navigationWrapper.notAuthorized();
}
if (dataverseId != null) {
setDataverse(dataverseService.find(getDataverseId()));
if (getDataverse() == null) {
return navigationWrapper.notFound();
}
} else {
setDataverse(dataverseService.findRootDataverse());
}
configuredHarvestingClients = harvestingClientService.getAllHarvestingClients();
pageMode = PageMode.VIEW;
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, JH.localize("harvestclients.title"), JH.localize("harvestclients.toptip")));
return null;
}
use of javax.faces.application.FacesMessage in project dataverse by IQSS.
the class EditDatafilesPage method handleLabelsFileUpload.
public void handleLabelsFileUpload(FileUploadEvent event) {
logger.fine("entering handleUpload method.");
UploadedFile file = event.getFile();
if (file != null) {
InputStream uploadStream = null;
try {
uploadStream = file.getInputstream();
} catch (IOException ioex) {
logger.info("the file " + file.getFileName() + " failed to upload!");
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_WARN, "upload failure", "the file " + file.getFileName() + " failed to upload!");
FacesContext.getCurrentInstance().addMessage(null, message);
return;
}
savedLabelsTempFile = saveTempFile(uploadStream);
logger.fine(file.getFileName() + " is successfully uploaded.");
FacesMessage message = new FacesMessage("Succesful", file.getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, message);
}
// process file (i.e., just save it in a temp location; for now):
}
use of javax.faces.application.FacesMessage in project dataverse by IQSS.
the class EditDatafilesPage method handleFileUpload.
/**
* Handle native file replace
* @param event
* @throws java.io.IOException
*/
public void handleFileUpload(FileUploadEvent event) throws IOException {
if (!uploadInProgress) {
uploadInProgress = true;
}
if (event == null) {
throw new NullPointerException("event cannot be null");
}
UploadedFile uFile = event.getFile();
if (uFile == null) {
throw new NullPointerException("uFile cannot be null");
}
/**
* For File Replace, take a different code path
*/
if (isFileReplaceOperation()) {
handleReplaceFileUpload(event, uFile.getInputstream(), uFile.getFileName(), uFile.getContentType(), event, null);
if (fileReplacePageHelper.hasContentTypeWarning()) {
RequestContext context = RequestContext.getCurrentInstance();
RequestContext.getCurrentInstance().update("datasetForm:fileTypeDifferentPopup");
context.execute("PF('fileTypeDifferentPopup').show();");
}
return;
}
List<DataFile> dFileList = null;
try {
// Note: A single uploaded file may produce multiple datafiles -
// for example, multiple files can be extracted from an uncompressed
// zip file.
dFileList = FileUtil.createDataFiles(workingVersion, uFile.getInputstream(), uFile.getFileName(), uFile.getContentType(), systemConfig);
} catch (IOException ioex) {
logger.warning("Failed to process and/or save the file " + uFile.getFileName() + "; " + ioex.getMessage());
return;
}
/*catch (FileExceedsMaxSizeException ex) {
logger.warning("Failed to process and/or save the file " + uFile.getFileName() + "; " + ex.getMessage());
return;
}*/
// -----------------------------------------------------------
// These raw datafiles are then post-processed, in order to drop any files
// already in the dataset/already uploaded, and to correct duplicate file names, etc.
// -----------------------------------------------------------
String warningMessage = processUploadedFileList(dFileList);
if (warningMessage != null) {
uploadWarningMessage = warningMessage;
FacesContext.getCurrentInstance().addMessage(event.getComponent().getClientId(), new FacesMessage(FacesMessage.SEVERITY_ERROR, "upload warning", warningMessage));
// save the component id of the p:upload widget, so that we could
// send an info message there, from elsewhere in the code:
uploadComponentId = event.getComponent().getClientId();
}
}
use of javax.faces.application.FacesMessage in project trainning by fernandotomasio.
the class PessoasBean method atualizar.
public void atualizar() {
System.out.println("Sobre: " + this.sobre);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Perfil atualizado!"));
}
use of javax.faces.application.FacesMessage in project oxAuth by GluuFederation.
the class LogoutAction method logoutFailed.
public void logoutFailed() {
String message = languageBean.getMessage("logout.failedToProceed");
facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message));
facesService.redirect("/error.xhtml");
}
Aggregations