use of org.alfresco.web.ui.common.ReportedException in project acs-community-packaging by Alfresco.
the class UsersBeanProperties method setPerson.
/**
* @param p The person context to set.
*/
public void setPerson(final Node p) {
// perform the set in a txn as certain bean calls require it
FacesContext context = FacesContext.getCurrentInstance();
RetryingTransactionHelper txnHelper = Repository.getRetryingTransactionHelper(context);
RetryingTransactionCallback callback = new RetryingTransactionCallback() {
public Object execute() throws Throwable {
person = p;
userName = (String) person.getProperties().get(ContentModel.PROP_USERNAME);
// rebuild the property immutability map helper object
immutabilty = new PropertyImmutabilityMap(getUserRegistrySynchronizer().getPersonMappedProperties(userName));
return null;
}
};
try {
txnHelper.doInTransaction(callback, false);
} catch (Throwable e) {
// reset the flag so we can re-attempt the operation
if (e instanceof ReportedException == false) {
Utils.addErrorMessage(e.getMessage(), e);
}
ReportedException.throwIfNecessary(e);
}
}
use of org.alfresco.web.ui.common.ReportedException in project acs-community-packaging by Alfresco.
the class BaseDialogBean method finish.
public String finish() {
final FacesContext context = FacesContext.getCurrentInstance();
final String defaultOutcome = getDefaultFinishOutcome();
String outcome = null;
// being pressed multiple times
if (this.isFinished == false) {
this.isFinished = true;
RetryingTransactionHelper txnHelper = Repository.getRetryingTransactionHelper(context);
RetryingTransactionCallback<String> callback = new RetryingTransactionCallback<String>() {
public String execute() throws Throwable {
// call the actual implementation
return finishImpl(context, defaultOutcome);
}
};
try {
// Execute
outcome = txnHelper.doInTransaction(callback, false, true);
// allow any subclasses to perform post commit processing
// i.e. resetting state or setting status messages
outcome = doPostCommitProcessing(context, outcome);
// remove container variable
context.getExternalContext().getSessionMap().remove(AlfrescoNavigationHandler.EXTERNAL_CONTAINER_SESSION);
} catch (Throwable e) {
// reset the flag so we can re-attempt the operation
isFinished = false;
outcome = getErrorOutcome(e);
if (e instanceof ReportedException == false) {
Utils.addErrorMessage(formatErrorMessage(e), e);
}
ReportedException.throwIfNecessary(e);
}
} else {
Utils.addErrorMessage(Application.getMessage(context, "error_wizard_completed_already"));
}
return outcome;
}
Aggregations