@@ -12,7 +12,6 @@
import com.moorkensam.xlra.service.RateFileService;
import com.moorkensam.xlra.service.UserSessionService;
import com.moorkensam.xlra.service.util.ConditionFactory;
import com.moorkensam.xlra.service.util.RateUtil;
import com.moorkensam.xlra.service.util.TranslationUtil;
import com.moorkensam.xlra.service.util.ZoneUtil;

@@ -158,7 +157,8 @@ public void onRateLineCellEdit(CellEditEvent event) {
Object oldValue = event.getOldValue();

if (newValue != null && !newValue.equals(oldValue)) {
messageUtil.addMessage("Rate updated", "Rate value updated to " + newValue);
messageUtil.addMessage("message.ratefile.update.title", "message.ratefile.update.detail",
newValue + "");
}
updateRateFile();
}
@@ -242,11 +242,13 @@ public void saveEditCondition() {
if (selectedCondition.getConditionKey() != null) {
selectedRateFile.addCondition(selectedCondition);
updateRateFile();
messageUtil.addMessage("Condition updated", "Your changes were saved.");
messageUtil.addMessage("message.ratefile.condition.updated.title",
"message.ratefile.condition.updated.detail", selectedCondition.getTranslatedKey());
selectedCondition = null;
} else {
showConditionDetailDialog();
messageUtil.addErrorMessage("Empty condition", "You can not save an empty condition.");
messageUtil.addErrorMessage("message.ratefile.condition.empty",
"message.ratefile.condition.empty.detail");
}
}

@@ -282,7 +284,8 @@ public void saveZone() {
originalSelectedZone.fillInValuesFromZone(selectedZone);
updateRateFile();
resetZoneEdit();
messageUtil.addMessage("Zone update", selectedZone.getName() + " successfully updated.");
messageUtil.addMessage("message.ratefile.zone.updated",
"message.ratefile.zone.updated.detail", selectedZone.getName());
} else {
showZoneDetailDialog();
}
@@ -298,8 +301,8 @@ public void deleteZone(Zone zone) {
* @param condition The condition to delete.
*/
public void deleteCondition(Condition condition) {
messageUtil.addMessage("condition removed", condition.getTranslatedKey()
+ " was successfully removed.");
messageUtil.addMessage("message.ratefile.condition.removed",
"message.ratefile.condition.removed.detail", condition.getTranslatedKey());
selectedRateFile.getConditions().remove(condition);
condition.setRateFile(null);
updateRateFile();
@@ -335,7 +338,8 @@ private void refreshPageForRateFile() {
hasRateFileSelected = true;
refreshRateLineColumns();
translationUtil.fillInTranslations(selectedRateFile.getConditions());
messageUtil.addMessage("Loaded rates", "Displaying rates for " + selectedRateFile.getName());
messageUtil.addMessage("message.ratefile.rates.loaded", "message.ratefile.rates.loaded.detail",
selectedRateFile.getName());
}

/**
@@ -356,7 +360,7 @@ public void downloadRateExcel() {
responseOutputStream.close();
} catch (IOException e) {
logger.error(e);
messageUtil.addErrorMessage("Unexpected error", "Could not generate excel");
messageUtil.addErrorMessage("message.unexpected.error", "message.unexpected.excel.error");
}
facesContext.responseComplete();

@@ -463,9 +467,8 @@ private boolean validateNumericalPostalCodes(String numericalPostalCodeString) {
zoneUtil.convertNumericalPostalCodeStringToList(numericalPostalCodeString);
return true;
} catch (Exception e) {
messageUtil.addErrorMessage("Postal codes not valid",
"The given postal codes are not valid, make sure its a ','"
+ " seperated list of numerical postcode intervals START-STOP,START-STOP,...");
messageUtil.addErrorMessage("message.invalid.postal.codes",
"message.invalid.postal.codes.numeric.detail");
}
return false;
}
@@ -475,9 +478,8 @@ private boolean validateAlphanumericalPostalCodes(String alphaNumericalPostalCod
zoneUtil.convertAlphaNumericPostalCodeStringToList(alphaNumericalPostalCodeString);
return true;
} catch (Exception e) {
messageUtil.addErrorMessage("Postal codes not valid",
"The given postal codes are not valid, make sure its a ','"
+ " seperated list of alphanumerical postal codes.");
messageUtil.addErrorMessage("message.invalid.postal.codes",
"message.invalid.postal.codes.alphanumeric.detail");
showZoneDetailDialog();
}
return false;
@@ -615,5 +617,4 @@ public MessageUtil getMessageUtil() {
public void setMessageUtil(MessageUtil messageUtil) {
this.messageUtil = messageUtil;
}

}
@@ -104,12 +104,11 @@ private void refreshUsers() {
*
* @param user The user to delete.
*/
public void deleteUser(User user) {
public void deleteUser(final User user) {
userService.deleteUser(user);
messageUtil.addMessage("User deleted", "The user " + user.getName()
+ " was successfully deleted.");
messageUtil.addMessage("message.user.deleted.title", "message.user.deleted.detail",
user.getName() + "");
refreshUsers();

}

/**
@@ -119,18 +118,16 @@ public void resetUserPassword() {
if (getCanResetPassword()) {
try {
userService.resetUserPassword(selectedUser);
messageUtil.addMessage("Password reset",
"Password reset email was sent to " + selectedUser.getEmail());
messageUtil.addMessage("message.user.password.reset.title",
"message.user.password.reset.detail", selectedUser.getEmail() + "");
refreshUsers();
} catch (MessagingException e) {
messageUtil.addErrorMessage(
"Failed to send email to user",
"There was a problem sending out the password reset email to "
+ selectedUser.getUserName()
+ ". Please try again or of this errors persists contact the system "
+ "administrator.");
messageUtil.addErrorMessage("message.user.password.reset.failed.email.title",
"message.user.password.reset.failed.email.detail", selectedUser.getUserName());
} catch (XlraValidationException e2) {
messageUtil.addErrorMessage("Error resetting user password", e2.getBusinessException());
messageUtil.addErrorMessage("message.user.password.reset.error.title", e2
.getBusinessException(), selectedUser.getUserName(), selectedUser.getUserStatus()
.toString());
}
}
}
@@ -143,10 +140,12 @@ public void resetUserPassword() {
public void enableUser(User user) {
try {
userService.enableUser(user);
messageUtil.addMessage("User enabled", "Enabled user " + user.getUserName());
messageUtil.addMessage("message.user.enabled.title", "message.user.enabled.detail",
user.getUserName());
refreshUsers();
} catch (XlraValidationException e) {
messageUtil.addErrorMessage("Can not enable user", e.getBusinessException());
messageUtil.addErrorMessage("message.user.enabled.failed.title", e.getBusinessException(),
user.getUserName(), user.getUserStatus().toString());
}
}

@@ -158,10 +157,12 @@ public void enableUser(User user) {
public void disableUser(User user) {
try {
userService.disableUser(user);
messageUtil.addMessage("User disabled", "Disabled user " + user.getUserName());
messageUtil.addMessage("message.user.disabled.title", "message.user.disabled.detail",
user.getUserName());
refreshUsers();
} catch (XlraValidationException e) {
messageUtil.addErrorMessage("Can not disable user", e.getBusinessException());
messageUtil.addErrorMessage("message.user.disabled.failed.title", e.getBusinessException(),
user.getUserName(), user.getUserStatus().toString());
}
}

@@ -241,19 +242,20 @@ public void createOrUpdateUser() {
private void createUser() {
try {
userService.createUser(selectedUser);
messageUtil.addMessage("User created", "The user " + selectedUser.getUserName()
+ " was successfully created.");
messageUtil.addMessage("message.user.created.title", "message.user.created.detail",
selectedUser.getUserName());
refreshUsers();
hideAddDialog();
} catch (UserException e) {
showAddDialog();
messageUtil.addErrorMessage("Error creating user", e.getBusinessException());
messageUtil.addErrorMessage("message.user.created.error.title", e.getBusinessException(), e
.getExtraArguments().get(0));
}
}

private void updateUser() {
messageUtil.addMessage("User updated", "The user " + selectedUser.getUserName()
+ " was successfully updated.");
messageUtil.addMessage("message.user.updated.title", "message.user.updated.detail",
selectedUser.getUserName());
userService.updateUser(selectedUser, false);
refreshUsers();
hideAddDialog();
@@ -97,7 +97,8 @@ private void checkAndLoadOfferteIfPresent() {
selectedOfferte = quotationService.getOfferteByOfferteKey(offerteKey);
showDetailDialog();
} catch (UnAuthorizedAccessException e) {
messageUtil.addErrorMessage("Unauthorized offerte access", e.getBusinessException());
messageUtil.addErrorMessage("message.offerte.unauthorized.access.title",
e.getBusinessException(), e.getExtraArguments().get(0));
}
}
}
@@ -112,7 +113,8 @@ public void setupOfferteDetail(QuotationResult quotationResult) {
selectedOfferte = quotationService.getFullOfferteById(quotationResult.getId());
showDetailDialog();
} catch (UnAuthorizedAccessException e) {
messageUtil.addErrorMessage("Unauthorized offerte access", e.getBusinessException());
messageUtil.addErrorMessage("message.offerte.unauthorized.access.title",
e.getBusinessException(), e.getExtraArguments().get(0));
}
}

@@ -159,12 +161,13 @@ public void resendEmail() {
try {
emailService.sendOfferteMail(selectedOfferte);
selectedOfferte = quotationService.getFullOfferteById(selectedOfferte.getId());
messageUtil.addMessage("Email resend", "Successfully sent email");
messageUtil.addMessage("message.email.resend.title", "message.email.resend.detail");
} catch (MessagingException e) {
messageUtil.addErrorMessage("Could not send email",
"Error sending email! Contact the system admin if this error persists.");
messageUtil.addErrorMessage("message.email.resend.failed.title",
"message.email.resend.failed.detail");
} catch (UnAuthorizedAccessException e) {
messageUtil.addErrorMessage("Unauthorized offerte access", e.getBusinessException());
messageUtil.addErrorMessage("message.offerte.unauthorized.access.title",
e.getBusinessException(), e.getExtraArguments().get(0));
}
}

@@ -46,7 +46,8 @@ public void initialize() {
*/
public void onPermissionRowEdit(RowEditEvent event) {
Permission permission = (Permission) event.getObject();
messageUtil.addMessage("Permission updated", "Updated " + permission.getKey() + " to ");
messageUtil.addMessage("message.permission.updated.title", "message.permission.updated.detail",
permission.getKey());
rolePermissionService.updatePermission(permission);
refreshPermissions();
}
@@ -60,7 +61,8 @@ private void refreshPermissions() {
*/
public void saveNewPermission() {
rolePermissionService.createPermission(newPermission);
messageUtil.addMessage("Permission created", "Created permission" + newPermission.getKey());
messageUtil.addMessage("message.permission.created.title", "message.permission.created.detail",
newPermission.getKey());
newPermission = new Permission();
refreshPermissions();
}
@@ -93,7 +93,7 @@ public void raiseRates() {
if (validRaise()) {
raiseRatesService.raiseRateFileRateLinesWithPercentage(rateFiles.getTarget(), percentage);
hideAddDialog();
messageUtil.addMessage("Rates raised", "Succesfully raised rates for");
messageUtil.addMessage("message.rates.raise.title", "message.rates.raise.detail");
resetState();
} else {
showAddDialog();
@@ -102,12 +102,13 @@ public void raiseRates() {

private boolean validRaise() {
if (rateFiles.getTarget() == null || rateFiles.getTarget().size() == 0) {
messageUtil.addErrorMessage("No rates selected", "Please select ratefiles to raise.");
messageUtil.addErrorMessage("message.rates.raise.no.rates.selected.title",
"message.rates.raise.no.rates.selected.detail");
return false;
}
if (percentage == 0.00d) {
messageUtil.addErrorMessage("0.00 is an invalid percentage",
"A raise of 0.00 doesnt do anything.");
messageUtil.addErrorMessage("message.rates.raise.nul.percentage",
"message.rates.raise.nul.percentage.detail");
return false;
}
return true;
@@ -119,7 +120,7 @@ private boolean validRaise() {
public void undoLatestRaiseRates() {
raiseRatesService.undoLatestRatesRaise();
refreshLogs();
messageUtil.addMessage("Rates raised", "Succesfully undid latest rates raise.");
messageUtil.addMessage("message.rates.raise.title", "message.rates.raise.undo.latest.detail");
}

public List<RateFile> getAllRateFiles() {
@@ -65,12 +65,12 @@ public void createOrUpdateRole() {
selectedRole.setPermissions(permissions.getTarget());
if (selectedRole.getId() == 0) {
roleService.createRole(selectedRole);
messageUtil.addMessage("Role created", "The role " + selectedRole.getName()
+ " was successfully created.");
messageUtil.addMessage("message.role.created.title", "message.role.created.detail",
selectedRole.getName());
setupNewRole();
} else {
messageUtil.addMessage("Role updated", "The role " + selectedRole.getName()
+ " was successfully updated.");
messageUtil.addMessage("message.role.updated.title", "message.role.updated.detail",
selectedRole.getName());
roleService.updateRole(selectedRole);
}
refreshRoles();
@@ -85,14 +85,15 @@ public void saveUser() {
user.setPassword(newPassword);
} else {
if (!skippws) {
messageUtil.addErrorMessage("Passwords do not match",
"The new password and the retyped new password should be the same!");
messageUtil.addErrorMessage("message.user.profile.password.mismatch",
"message.user.profile.password.mismatch.detail");
return;
}
}
}
user = userService.updateUser(user, !skippws);
messageUtil.addMessage("Profile updated", "Your profile was successfully updated.");
messageUtil.addMessage("message.user.profile.updated.title",
"message.user.profile.updated.detail");
}

public MessageUtil getMessageUtil() {
@@ -1,10 +1,10 @@
package com.moorkensam.xlra.controller.util;

import java.text.MessageFormat;
import java.util.List;
import java.util.ResourceBundle;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.context.FacesContext;

/**
@@ -37,13 +37,40 @@ public static MessageUtil getInstance(ResourceBundle messageBundle) {
return instance;
}

public void addMessage(String summary, String detail) {
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, summary, detail);
/**
* Add a message to the facescontext.
*
* @param summary Summary of the message
* @param detail Detail of the message
* @param arguments The arguments to inject into the message
*/
public void addMessage(final String summary, final String detail, final String... arguments) {
FacesMessage message =
new FacesMessage(FacesMessage.SEVERITY_INFO, lookupI8nStringAndInjectParams(summary,
arguments), lookupI8nStringAndInjectParams(detail, arguments));
FacesContext.getCurrentInstance().addMessage(null, message);
}

public void addErrorMessage(String summary, String detail) {
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, summary, detail);
private String lookupI8nStringAndInjectParams(final String key, final Object... params) {
String unformattedString = messageBundle.getString(key);
if (params != null) {
String formattedResult = MessageFormat.format(unformattedString, params);
return formattedResult;
}
return unformattedString;
}

/**
* Add an error message to the facescontext.
*
* @param summary Summary of the error message
* @param detail Detailed message
* @param arguments The arguments to pass along
*/
public void addErrorMessage(final String summary, final String detail, final String... arguments) {
FacesMessage message =
new FacesMessage(FacesMessage.SEVERITY_ERROR, lookupI8nStringAndInjectParams(summary,
arguments), lookupI8nStringAndInjectParams(detail, arguments));
FacesContext.getCurrentInstance().addMessage(null, message);
}

@@ -1,5 +1,7 @@
package com.moorkensam.xlra.model.error;

import java.util.List;

/**
* Base exception class for application specific exceptiosn.
*
@@ -9,6 +11,8 @@
public abstract class XlraBaseException extends Exception {
private static final long serialVersionUID = -4145698228958030600L;

private List<String> extraArguments;

private String businessException;

public XlraBaseException(String businessException, String msg, Throwable exc) {
@@ -32,4 +36,12 @@ public String getBusinessException() {
public void setBusinessException(String businessException) {
this.businessException = businessException;
}

public List<String> getExtraArguments() {
return extraArguments;
}

public void setExtraArguments(List<String> extraArguments) {
this.extraArguments = extraArguments;
}
}
@@ -6,6 +6,8 @@
import com.moorkensam.xlra.service.AuthorizationService;
import com.moorkensam.xlra.service.UserSessionService;

import java.util.Arrays;

import javax.ejb.Stateless;
import javax.inject.Inject;

@@ -20,8 +22,9 @@ public void authorizeOfferteAccess(QuotationResult offerte) throws UnAuthorizedA
User user = getUserSessionService().getLoggedInUser();
if (!getUserSessionService().doesLoggedInUserHaveAdminRights()) {
if (!user.getUserName().equalsIgnoreCase(offerte.getCreatedUserName())) {
throw new UnAuthorizedAccessException("User " + user.getUserName()
+ " is not authorized to access this offerte.");
UnAuthorizedAccessException exc =
new UnAuthorizedAccessException("message.offerte.unauthorized.access.detail");
exc.setExtraArguments(Arrays.asList(user.getUserName()));
}
}
}
@@ -10,6 +10,7 @@
import org.apache.logging.log4j.Logger;
import org.primefaces.model.SortOrder;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

@@ -43,8 +44,10 @@ private void validateCustomer(Customer customer) throws XlraValidationException
customerDao.getCustomerByName(customer.getName());
logger.info("Validate customer failed, customer with name " + customer.getName()
+ " already exists.");
throw new XlraValidationException("Customer with name " + customer.getName()
+ " already exists.");
XlraValidationException exc =
new XlraValidationException("message.customer.create.name.already.exists");
exc.setExtraArguments(Arrays.asList(customer.getName()));
throw exc;
} catch (NoResultException nre) {
// nothing needed here
}
@@ -176,10 +176,10 @@ public QuotationResult generateEmailAndPdfForOfferte(QuotationResult offerte)
offerte.setQuotationResultStatus(QuotationResultStatus.PROCESSED_OPTIONS);
} catch (TemplatingException e) {
logger.error("Failed to parse Template" + e.getMessage());
throw new RateFileException("Failed to parse email template.");
throw new RateFileException("message.email.template.parse");
} catch (FileNotFoundException | DocumentException e) {
logger.error("Failed to create PDF." + e.getMessage());
throw new RateFileException("Failed to generate pdf");
throw new RateFileException("message.pdf.generate.failed");
}
return offerte;
}
@@ -222,7 +222,7 @@ public void submitQuotationResult(QuotationResult result) throws RateFileExcepti
getEmailService().sendOfferteMail(result);
} catch (MessagingException e) {
logger.error("Failed to send offerte email");
throw new RateFileException("Failed to send email");
throw new RateFileException("message.email.sent.failed");
} catch (PdfException e) {
throw new RateFileException(e.getBusinessException());
}
@@ -160,9 +160,8 @@ public RateFile generateCustomerRateFileForFilterAndCustomer(RateFileSearchFilte
throws RateFileException {
try {
rateFileDao.getFullRateFileForFilter(filter);
String businessException = "A ratefile already exists for this customer and these options.";
logger.error(businessException);
throw new RateFileException(businessException);
logger.error("A ratefile already exists for this customer and these options.");
throw new RateFileException("message.ratefile.create.failed.ratefile.exists");
} catch (NoResultException e) {
try {
Customer customer = filter.getCustomer();
@@ -173,9 +172,8 @@ public RateFile generateCustomerRateFileForFilterAndCustomer(RateFileSearchFilte
filter.setCustomer(customer);
return copy;
} catch (NoResultException nre2) {
String businessException = "Could not find a ratefile to copy from for this filter.";
logger.error(businessException);
throw new RateFileException(businessException);
logger.error("Could not find a ratefile to copy from for this filter.");
throw new RateFileException("message.ratefile.create.failed.base.file.not.exists");
}
}
}
@@ -105,19 +105,19 @@ public String parseOfferteEmailTemplate(String templateFromDb, QuotationResult o
template.process(dataModel, writer);
} catch (TemplateNotFoundException e) {
logger.error(e);
throw new TemplatingException("Template not found internaly", e);
throw new TemplatingException("message.template.not.found", e);
} catch (MalformedTemplateNameException e) {
logger.error(e);
throw new TemplatingException("Template malformated", e);
throw new TemplatingException("message.template.malformed", e);
} catch (ParseException e) {
logger.error(e);
throw new TemplatingException("Failed to parse template", e);
throw new TemplatingException("message.template.parse.failed", e);
} catch (IOException e) {
logger.error(e);
throw new TemplatingException("Could not write template", e);
throw new TemplatingException("message.template.write.failed", e);
} catch (TemplateException e) {
logger.error(e);
throw new TemplatingException("General templating exception", e);
throw new TemplatingException("message.template.general.exception", e);
}
return writer.toString();
}
@@ -140,10 +140,10 @@ public String parseOffertePdf(QuotationResult offerte, Language language)
template.process(parameters, writer);
} catch (IOException e) {
logger.error(e);
throw new TemplatingException("Could not write template", e);
throw new TemplatingException("message.template.write.failed", e);
} catch (TemplateException e) {
logger.error(e);
throw new TemplatingException("General templating exception", e);
throw new TemplatingException("message.template.general.exception", e);
}
return writer.toString();
}
@@ -166,10 +166,10 @@ public String parseUserCreatedTemplate(User user) throws TemplatingException {
template.process(dataModel, writer);
} catch (IOException e) {
logger.error(e);
throw new TemplatingException("Could not write template", e);
throw new TemplatingException("message.template.write.failed", e);
} catch (TemplateException e) {
logger.error(e);
throw new TemplatingException("General templating exception", e);
throw new TemplatingException("message.template.general.exception", e);
}

return writer.toString();
@@ -220,10 +220,10 @@ public String parseUserResetPasswordEmail(User user) throws TemplatingException
template.process(dataModel, writer);
} catch (IOException e) {
logger.error(e);
throw new TemplatingException("Could not write template", e);
throw new TemplatingException("message.template.write.failed", e);
} catch (TemplateException e) {
logger.error(e);
throw new TemplatingException("General templating exception", e);
throw new TemplatingException("message.template.general.exception", e);
}

return writer.toString();
@@ -235,16 +235,16 @@ private Template loadTemplate(String templateName) throws TemplatingException {
return freemarkerConfiguration.getTemplate(templateName);
} catch (TemplateNotFoundException e) {
logger.error(e);
throw new TemplatingException("Template not found internaly", e);
throw new TemplatingException("message.template.not.found", e);
} catch (MalformedTemplateNameException e) {
logger.error(e);
throw new TemplatingException("Template malformated", e);
throw new TemplatingException("message.template.malformed", e);
} catch (ParseException e) {
logger.error(e);
throw new TemplatingException("Failed to parse template", e);
throw new TemplatingException("message.template.parse.failed", e);
} catch (IOException e) {
logger.error(e);
throw new TemplatingException("Could not write template", e);
throw new TemplatingException("message.template.write.failed", e);
}
}

@@ -19,6 +19,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.Arrays;
import java.util.List;

import javax.annotation.PostConstruct;
@@ -69,25 +70,29 @@ public void createUser(final User user) throws UserException {
}

private void validateUserIsUnique(final User user) throws UserException {
validateUserEmail(user);
validateUserUsername(user);
validateUserEmailUnique(user);
validateUserUsernameUnique(user);
}

private void validateUserUsername(final User user) throws UserException {
private void validateUserUsernameUnique(final User user) throws UserException {
try {
userDao.getUserByUserName(user.getUserName());
throw new UserException("A user with this username already exists");
UserException exc = new UserException("message.user.created.username.exists");
exc.setExtraArguments(Arrays.asList(user.getUserName()));
throw exc;
} catch (NoResultException nre) {
if (logger.isDebugEnabled()) {
logger.debug("User with username " + user.getUserName() + " was not found");
}
}
}

private void validateUserEmail(final User user) throws UserException {
private void validateUserEmailUnique(final User user) throws UserException {
try {
userDao.getUserByEmail(user.getEmail());
throw new UserException("A user with this email adres already exists");
UserException exc = new UserException("message.user.created.email.exists");
exc.setExtraArguments(Arrays.asList(user.getEmail()));
throw exc;
} catch (NoResultException nre) {
if (logger.isDebugEnabled()) {
logger.debug("User with username " + user.getUserName() + " was not found");
@@ -144,9 +149,7 @@ public void resetUserPassword(final User user) throws MessagingException, XlraVa

private void validateResetRequest(final User user) throws XlraValidationException {
if (!UserStatusUtil.canResetPassword(user)) {
String businessException =
"Can not change the user status to PASSWORD_RESET for user " + user.getUserName()
+ " which has status " + user.getUserStatus();
String businessException = "message.user.status.to.password.reset.invalid";
logger.error(businessException);
throw new XlraValidationException(businessException);
}
@@ -223,8 +226,7 @@ public void disableUser(final User user) throws XlraValidationException {

private void validateDisableRequest(final User user) throws XlraValidationException {
if (!UserStatusUtil.canDisableUser(user)) {
String businessException =
"Can not disable user " + user.getUserName() + " with status " + user.getUserStatus();
String businessException = "message.user.disabled.failed.detail";
logger.error(businessException);
throw new XlraValidationException(businessException);
}
@@ -239,8 +241,7 @@ public void enableUser(final User user) throws XlraValidationException {

private void validateEnableRequest(final User user) throws XlraValidationException {
if (!UserStatusUtil.canEnableUser(user)) {
String businessException =
"Can not enable user " + user.getUserName() + " with status " + user.getUserStatus();
String businessException = "message.user.enabled.failed.detail";
logger.error(businessException);
throw new XlraValidationException(businessException);
}
@@ -45,18 +45,16 @@ public static String generateNameForCustomerRateFile(RateFileSearchFilter filter
public static void validateRateInterval(AbstractRate rate,
List<? extends AbstractRate> existingRates) throws IntervalOverlapException {
if (rate.getInterval().getStart() >= rate.getInterval().getEnd()) {
throw new IntervalOverlapException(
"The start value of the rate should be smaller then the end value.");
throw new IntervalOverlapException("message.invalid.interval.start.smaller.end");
}
for (AbstractRate existing : existingRates) {
if (rate.getInterval().getStart() >= existing.getInterval().getStart()
&& rate.getInterval().getStart() < existing.getInterval().getEnd()) {
throw new IntervalOverlapException(
"The start value of this rate is already in another rate.");
throw new IntervalOverlapException("message.invalid.interval.start.already.in.other");
}
if (rate.getInterval().getEnd() >= existing.getInterval().getStart()
&& rate.getInterval().getEnd() < existing.getInterval().getEnd()) {
throw new IntervalOverlapException("The end value of the rate is already in another rate.");
throw new IntervalOverlapException("message.invalid.interval.end.already.in.other");
}
}
}
@@ -359,11 +359,128 @@ message.user.name.required=Name is required
message.edit.condition.tip=Edit this condition
message.condition.edit.cancel=Undo all changes.
message.raise.rates.tip=Apply the raise for selected rate files
message.chf.currentvalue.null=Please fill in valid price
message.chf.currentvalue.null=Please fill in a valid price
message.empty.value=Empty value
message.current.chf.price=Current swiss franc price
message.price.same.as.old=The new price is the same as the old, not updating.
message.chf.updated.to=Updated current swiss franc price to
message.chf.updated.to=Updated current swiss franc price to {0}
message.chf.rate.created.title=Swiss franc rate created
message.chf.rate.created.detail=Successfully created swiss franc rate for {0} with surcharge percentage {1}
message.chf.rate.updated.title=Swiss franc rate updated
message.chf.rate.updated.detail=Updated swiss franc rate for {0} to surcharge percentage {1}
message.chf.illegal.interval.title=Illegal interval
message.chf.delete.title=Successfully deleted rate
message.chf.delete.detail=Sucessfully deleted Swiss franc rate for {0}
message.invalid.interval.start.smaller.end=The start value of the rate should be smaller then the end value.
message.invalid.interval.start.already.in.other=The start value of this rate is already in another rate.
message.invalid.interval.end.already.in.other=The end value of the rate is already in another rate.
message.diesel.rate.updated.title=Diesel rate updated
message.diesel.rate.updated.detail=Updated diesel rate for {0} to surcharge percentage {1}.
message.diesel.rate.create.title=New diesel rate created
message.diesel.rate.create.detail=Successfully created diesel rate for {0} with surcharge percentage {1}.
message.diesel.delete.title=Successfully deleted rate
message.diesel.delete.detail=Sucessfully deleted diesel rate for {0}
message.current.diesel.price.title=Current diesel price
message.current.diesel.price.detail=Updated current diesel price to {0}
message.email.template.update.title=Successfully updated email template
message.email.template.update.detail=The email template was successfully updated.
message.country.update.title=Country updated
message.country.update.detail=Succesfully updated Country {0}.
message.country.delete.title=Successfully country deleted
message.country.delete.detail=Successfully deleted the country {0}.
message.user.profile.password.mismatch.title=Password mismatch
message.user.profile.password.mismatch.detail=The new password and the retyped new password should be the same.
message.user.profile.updated.title=Profile updated
message.user.profile.updated.detail=Your user profile was successfully updated.
message.user.deleted.title=User successfully deleted
message.user.deleted.detail=The user {0} was successfully deleted.
message.user.password.reset.title=Password reset
message.user.password.reset.detail=Password reset email was sent to {0}.
message.user.password.reset.failed.email.title=Failed to send email to user
message.user.password.reset.failed.email.detail=There was a problem sending out the password reset email to {0}. Please try again or of this errors persists contact the system administrator.
message.user.password.reset.error.title=Error resetting user password
message.user.status.to.password.reset.invalid=Can not change the user status to PASSWORD_RESET for user {0} which has status {1}.
message.user.enabled.title=User enabled
message.user.enabled.detail=User {0} is now enabled.
message.user.enabled.failed.title=Can not enable user
message.user.enabled.failed.detail=Can not enable user {0} with status {1}.
message.user.disabled.title=User disabled
message.user.disabled.detail=User {0} is now disabled.
message.user.disabled.failed.title=Can not disable user
message.user.disabled.failed.detail=Can not disable user {0} with status {1}.
message.user.created.title=User created
message.user.created.detail=The user {0} was successfully created.
message.user.created.error.title=Error creating user
message.user.created.email.exists=A user with email adres {0} already exists.
message.user.created.username.exists=A user with username {0} already exists.
message.user.updated.title=User updated
message.user.updated.detail=The user {0} was successfully updated.
message.role.created.title=Role created
message.role.created.detail=The role {0} was successfully created.
message.role.updated.title=Role updated
message.role.updated.detail=The role {0} was successfully updated.
message.permission.updated.title=Permission updated
message.permission.updated.detail=Permission {0} was successfully updated.
message.permission.created.title=Permission created
message.permission.created.detail=Permission {0} was successfully created.
message.customer.created.title=Customer created
message.customer.created.detail=Customer {0} was successfully created.
message.customer.invalid.data=Invalid customer data
message.customer.create.name.already.exists=The customer with name {0} already exists.
message.customer.updated.title=Customer updated
message.customer.updated.detail=The customer {0} was successfully updated.
message.customer.deleted.title=Customer deleted
message.customer.deleted.detail=The customer {0} was successfully deleted.
message.unknown.exception=Unknown exception
message.unknown.exception.detail=An unexpected exception occurred, please contact the system admin.
message.offerte.sent.title=Offer successfully send
message.offerte.sent.detail=The offerte was successfully send to {0}.
message.processing.unexecptected.error=Unexpected processing error
message.email.template.parse=Failed to parse email template.
message.pdf.generate.failed=Generating the offer email failed.
message.email.sent.failed=Unable to sent out email.
message.template.not.found=The template was not found.
message.template.malformed=The template was malformed and could not be parsed.
message.template.parse.failed=The template could not be parsed.
message.template.write.failed=The template could not be written to the output buffer.
message.template.general.exception=An exception occured whilst processing the template.
message.offerte.unauthorized.access.title=Unauthorized offerte access
message.offerte.unauthorized.access.detail=The user {0} is not authorized to access this offerte.
message.email.resend.title=Email resent
message.email.resend.detail=The offer email was successfully resent.
message.email.resend.failed.title=Could not resend offer email
message.email.resend.failed.detail=Error sending email! Contact the system admin if this error persists.
message.ratefile.create.failed=Failed to create rates
message.ratefile.create.failed.ratefile.exists=A set of rates already exists for this customer and these options.
message.ratefile.create.failed.base.file.not.exists=Could not find a set of rates to copy from for these options.
message.ratefile.update.title=Rate updated
message.ratefile.update.detail=The rate value was updated to {0}.
message.ratefile.condition.removed=Condition deleted
message.ratefile.condition.removed.detail=The condition {0} was successfully deleted.
message.ratefile.created.title=Rates created
message.ratefile.created.detail=The rates {0} were successfully created.
message.ratefile.condition.updated.title=Condition updated
message.ratefile.condition.updated.detail=The condition {0} was successfully updated.
message.ratefile.condition.empty=Empty condition
message.ratefile.condition.empty.detail=The condition you are trying to save is empty, this is not possible.
message.ratefile.condition.added=Condition added
message.ratefile.condition.added.detail=The condition {0} was successfully added to the rates {1}.
message.ratefile.zone.updated=Zone updated
message.ratefile.zone.updated.detail=The zone {0} was successfully updated.
message.ratefile.rates.loaded=Loaded rates
message.ratefile.rates.loaded.detail=The rates for {0} are now displayed in the detail view.
message.unexpected.error=Unexpected error
message.unexpected.excel.error=An unexpected error occured while generating the excel. Please contact the system administrator.
message.invalid.postal.codes=Postal codes not valid
message.invalid.postal.codes.numeric.detail=The given postal codes are not valid, make sure its a ',' seperated list of numerical postcode intervals START-STOP,START-STOP,..
message.invalid.postal.codes.alphanumeric.detail=The given postal codes are not valid, make sure its a ',' seperated list of alphanumerical postal codes.
message.rates.raise.title=Rates raised
message.rates.raise.detail=Succesfully raised rates.
message.rates.raise.no.rates.selected.title=No rates selected
message.rates.raise.no.rates.selected.detail=You didn't select any rates to raise.
message.rates.raise.nul.percentage=0.00 is an invalid percentage
message.rates.raise.nul.percentage.detail=A raise of 0.00 doesn't do anything.
message.rates.raise.undo.latest.detail=Succesfully undid latest rates raise.
dialog.confirm.delete.title=Confirm delete
@@ -361,6 +361,123 @@ message.chf.currentvalue.null=Gelieve een geldige prijs in te vullen
message.empty.value=Lege waarde
message.current.chf.price=Huidige Zwitserse Frank prijs
message.price.same.as.old=De nieuwe prijs is dezelfde als de oude.
message.chf.updated.to=Zwitserse Frank prijs aangepast naar
message.chf.updated.to=Zwitserse Frank prijs aangepast naar {0}
message.chf.rate.created.title=Zwitsers Frank tarief aangemaakt
message.chf.rate.created.detail=Het Zwitserse Frank tarief voor {0} met toeslag percentage {1} werd met succes aangemaakt
message.chf.rate.updated.title=Zwitsers Frank tarief met succes aangepast
message.chf.rate.updated.detail=Het Zwitsers Frank tarief voor {0} werd aangepast naar toeslag percentage {1}
message.chf.illegal.interval.title=Illegaal interval
message.chf.delete.detail=Tarief verwijdered
message.chf.delete.detail=Het Zwitsers Frank tarief voor {0} werd met succes verwijderd.
message.invalid.interval.start.smaller.end=De start waarde van het tarief moet kleiner zijn dan de eind waarde.
message.invalid.interval.start.already.in.other=De start waarde van dit tarief bestaat al in een ander tarief.
message.invalid.interval.end.already.in.other=De eind waarde van dit tarief bestaat al in een ander tarief.
message.diesel.rate.updated.title=Diesel tarief succesvol aangepast
message.diesel.rate.updated.detail=Het diesel tarief voor {0} werd aangepast naar toeslag percentage {1}.
message.diesel.rate.create.title=Nieuw diesel tarief aangemaakt
message.diesel.rate.create.detail=Het diesel tarief voor {0} met toeslag percentage {1} werd met succes aangemaakt.
message.diesel.delete.title=Tarief verwijderd
message.diesel.delete.detail=Het diesel tarief voor {0} werd met succes verwijderd.
message.current.diesel.price.title=Huidige diesel prijs
message.current.diesel.price.detail=De huidige diesel prijs is aangepast naar {0}.
message.email.template.update.title=Email sjabloon succesvol aangepast
message.email.template.update.detail=Het email sjabloon werd met succes aangepast.
message.country.update.title=Land aangepast
message.country.update.detail=Het land {0} werd met succes aangepast.
message.country.delete.title=Land succesvol verwijderd
message.country.delete.detail=Het land {0} werd met succes verwijderd.
message.user.profile.password.mismatch.title=Paswoorden komen niet overeen
message.user.profile.password.mismatch.detail=Het nieuwe paswoord en het hertypte paswoord komen niet overeen.
message.user.profile.updated.title=Profiel aangepast
message.user.profile.updated.detail=Uw gebruikersprofiel werd met succes aangepast.
message.user.deleted.title=Gebruiker succesvol verwijderd
message.user.deleted.detail=De gebruiker {0} werd met succes verwijderd.
message.user.password.reset.title=Wachtwoord reset
message.user.password.reset.detail=Een wachtwoord reset email is verstuurd naar {0}.
message.user.password.reset.failed.email.title=Niet geslaagd in versturen email naar gebruiker
message.user.password.reset.failed.email.detail=Er is een probleem opgetreden bij het versturen van de wachtwoord reset email naar {0}. Gelieve opnieuw te proberen en als dit probleem zich blijft voordoen contacteer dan de systeem administrator.
message.user.password.reset.error.title=Fout bij resetten van wachtwoord
message.user.status.to.password.reset.invalid=Kan de status van de gebruiker niet op PASSWORD_RESET zetten voor gebruiker {0}. De huidige status van de gebruiker is {1}.
message.user.enabled.title=Gebruiker ingeschakeld
message.user.enabled.detail=Gebruiker {0} is nu ingeschakeld.
message.user.enabled.failed.title=Kan gebruiker niet inschakelen
message.user.enabled.failed.detail=Kan gebruiker {0} met status {1} niet inschakelen.
message.user.disabled.title=Gebruiker uitgeschakeld
message.user.disabled.detail=Gebruiker {0} is nu uitgeschakeld.
message.user.disabled.failed.title=Kan gebruiker niet uitschakelen
message.user.disabled.failed.detail=Kan gebruiker {0} met status {1} niet uitschakelen.
message.user.created.title=Gebruiker aangemaakt
message.user.created.detail=De gebruiker {0} is succesvol aangemaakt.
message.user.created.error.title=Fout aanmaken gebruiker
message.user.created.email.exists=Er bestaat al een gebruiker met het email adres {0}.
message.user.created.username.exists=Er bestaat al een gebruiker met gebruikersnaam {0}.
message.user.updated.title=Gebruiker aangepast
message.user.updated.detail=De gebruiker {0} is succesvol aangepast.
message.role.created.title=Rol aangemaakt
message.role.created.detail=De rol {0} is succesvol aangemaakt.
message.role.updated.title=Rol aangepast
message.role.updated.detail=De rol {0} werd succesvol aangepast.
message.permission.updated.title=Permissie aangepast
message.permission.updated.detail=De permissie {0} werd succesvol aangepast.
message.permission.created.title=Permissie aangemaakt
message.permission.created.detail=Permissie {0} werd succesvol aangemaakt.
message.customer.created.title=Klant aangemaakt
message.customer.created.detail=Klant {0} werd succesvol aangemaakt.
message.customer.invalid.data=Ongeldige klant gegevens
message.customer.create.name.already.exists=De klant met naam {0} bestaat al in het systeem.
message.customer.updated.title=Klant aangepast
message.customer.updated.detail=De klant {0} werd succesvol aangepast.
message.customer.deleted.title=Klant verwijderd
message.customer.deleted.detail=De klant {0} werd succesvol verwijderd.
message.unknown.exception=Onbekende fout
message.unknown.exception.detail=Een onbekende fout is opgetreden, gelieve de systeem administrator te contacteren.
message.offerte.sent.title=Offerte succesvol verstuurd
message.offerte.sent.detail=De offerte werd succesvol verstuurd naar {0}.
message.processing.unexecptected.error=Onverwachte fout tijdens processing
message.email.template.parse=Het parsen van het email sjabloon is mislukt.
message.pdf.generate.failed=Het genereren van de offerte PDF is mislukt.
message.email.sent.failed=Het versturen van de email is mislukt.
message.template.not.found=Het sjabloon kon niet worden gevonden.
message.template.malformed=Het sjabloon is slecht gevormd en kon niet geparsed worden.
message.template.parse.failed=Het sjabloon kon niet geparsed worden.
message.template.write.failed=Het sjabloon kon niet geschreven worden naar de uitput buffer.
message.template.general.exception=Er is een fout opgetreden bij het verwerken van het sjabloon.
message.offerte.unauthorized.access.title=Ongeautoriseerde toegang offerte
message.offerte.unauthorized.access.detail=Ge gebruiker {0} is niet geautoriseerd om deze offerte te openen.
message.email.resend=Email opnieuw verzonden
message.email.resend.detail=De email offerte werd succesvol opnieuw verzonden.
message.email.resend.failed.title=Kon offerte mail niet opnieuw versturen
message.email.resend.failed.detail=Er is een fout opgetreden bij het opnieuw versturen de offerte email. Probeer het opnieuw en als deze foutmelding zich blijft voordoen contacteer de systeem administrator.
message.ratefile.create.failed=Aanmeken tarieven mislukt
message.ratefile.create.failed.ratefile.exists=Er bestaan al tarieven voor de combinatie van deze klant en filters.
message.ratefile.create.failed.base.file.not.exists=Er konden geen tarieven gevonden worden voor deze opties om te kopiƫren.
message.ratefile.update.title=Tarief aangepast
message.ratefile.update.detail=De waarde van het tarief werd aangepast naar {0}.
message.ratefile.condition.removed=Voorwaarde verwijderd
message.ratefile.condition.removed.detail=De voorwaarde {0} werd succesvol verwijderd.
message.ratefile.created.title=Tarieven aangemaakt
message.ratefile.created.detail=De tarieven {0} werden succesvol aangemaakt.
message.ratefile.condition.updated.title=Voorwaarde aangepast
message.ratefile.condition.updated.detail=De voorwaarde {0} werd succesvol aangepast.
message.ratefile.condition.empty=Lege voorwaarde
message.ratefile.condition.empty.detail=De voorwaarde die u probeert op te slaan is leeg, dit is niet mogelijk.
message.ratefile.condition.added=Voorwaarde toegevoegd
message.ratefile.condition.added.detail=De voorwaarde {0} werd succesvol toegevoegd aan de tarieven {1}.
message.ratefile.zone.updated=Zone aangepast
message.ratefile.zone.updated.detail=De zone {0} werd succesvol aangepast.
message.ratefile.rates.loaded=Rates ingeladen
message.ratefile.rates.loaded.detail=De tarieven voor {0} worden nu weergegeven in het detail scherm.
message.unexpected.error=Onverwachte fout
message.unexpected.excel.error=Een onverwachte fout is opgetreden bij het genereren van de excel. Gelieve de systeem administrator te contacteren.
message.invalid.postal.codes=Postcodes niet geldig
message.invalid.postal.codes.numeric.detail=De opgegeven postcodes zijn niet geldig, zorg ervoor dat dit een lijst is van door ',' gescheiden intervallen: START-STOP, START-STOP,...
message.invalid.postal.codes.alphanumeric.detail=De opgegeven postcodes zijn niet geldig, zorg ervoor dat dit een door ',' gescheiden lijst is.
message.rates.raise.title=Tarieven verhoogd
message.rates.raise.detail=Tarieven succesvol verhoogd.
message.rates.raise.no.rates.selected.title=Geen tarieven geselecteerd
message.rates.raise.no.rates.selected.detail=U heeft geen tarieven geselecteerd om te verhogen. Selecteer aub tarieven om te verhogen.
message.rates.raise.nul.percentage=0.00 is een ongeldig percentage
message.rates.raise.nul.percentage.detail=Een verhoging van 0.00 percent doet niets.
message.rates.raise.undo.latest.detail=De laatste tarief verhoging werd succesvol ongedaan gemaakt.

dialog.confirm.delete.title=Bevestig verwijderen