本文整理汇总了Java中framework.utils.Msg类的典型用法代码示例。如果您正苦于以下问题:Java Msg类的具体用法?Java Msg怎么用?Java Msg使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Msg类属于framework.utils包,在下文中一共展示了Msg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: delete
import framework.utils.Msg; //导入依赖的package包/类
/**
* Delete the file associated with the specified id.
*
* @param id
* the entry id to delete
*/
public Promise<Result> delete(final String id) {
return Promise.promise(new Function0<Result>() {
@Override
public Result apply() throws Throwable {
try {
String fileName = new String(Base64.decodeBase64(id));
getSharedStorageService().deleteFile(fileName);
Utilities.sendSuccessFlashMessage(Msg.get("admin.shared_storage.delete.success"));
return redirect(routes.SharedStorageManagerController.index());
} catch (Exception e) {
return ControllersUtils.logAndReturnUnexpectedError(e, log, getConfiguration(), getI18nMessagesPlugin());
}
}
});
}
示例2: validate
import framework.utils.Msg; //导入依赖的package包/类
/**
* Form validation.
*/
public List<ValidationError> validate() {
List<ValidationError> errors = new ArrayList<>();
// check the code is not already used
Currency currency = CurrencyDAO.getCurrencyByCode(this.code);
if (currency != null) {
if (this.id != null) { // edit case
if (!currency.id.equals(this.id)) {
errors.add(new ValidationError("code", Msg.get("object.currency.code.error.already_used")));
}
} else { // new case
errors.add(new ValidationError("code", Msg.get("object.currency.code.error.already_used")));
}
}
return errors.isEmpty() ? null : errors;
}
示例3: getPEDependencyTypeActiveWithContraryAsVH
import framework.utils.Msg; //导入依赖的package包/类
/**
* Get all active portfolio entry dependency types, including the contrary,
* as value holder collection.
*/
public static ISelectableValueHolderCollection<String> getPEDependencyTypeActiveWithContraryAsVH() {
ISelectableValueHolderCollection<String> types = new DefaultSelectableValueHolderCollection<String>();
int i = 0;
for (PortfolioEntryDependencyType type : getPEDependencyTypeActiveAsList()) {
DefaultSelectableValueHolder<String> vh1 = new DefaultSelectableValueHolder<String>(type.id + "#false", Msg.get(type.getNameKey()));
vh1.setOrder(i);
i++;
types.add(vh1);
DefaultSelectableValueHolder<String> vh2 = new DefaultSelectableValueHolder<String>(type.id + "#true", Msg.get(type.contrary));
vh2.setOrder(i);
i++;
types.add(vh2);
}
return types;
}
示例4: acceptAgreement
import framework.utils.Msg; //导入依赖的package包/类
@Override
public void acceptAgreement(DataSyndicationAgreement agreement) throws ApiSignatureException, EchannelException {
// create an application API key
IApiApplicationConfiguration applicationConfiguration = apiSignatureService.setApplicationConfiguration(UUID.randomUUID().toString(),
"Data syndication key for the instance " + agreement.masterPartner.domain, false, false, "GET (.*)\nPOST (.*)\nPUT (.*)\nDELETE (.*)");
// Assign the key
DataSyndicationApiKey apiKey = new DataSyndicationApiKey();
apiKey.name = applicationConfiguration.getApplicationName();
apiKey.secretKey = applicationConfiguration.getSignatureGenerator().getSharedSecret();
apiKey.applicationKey = applicationConfiguration.getSignatureGenerator().getApplicationKey();
echannelService.acceptAgreement(agreement.id, apiKey);
try {
String actionLink = agreement.masterPartner.baseUrl + controllers.admin.routes.DataSyndicationController.viewAgreement(agreement.id, false).url();
String title = Msg.get(this.lang, "data_syndication.accept_agreement.notification.title");
String message = Msg.get(this.lang, "data_syndication.accept_agreement.notification.message", actionLink);
echannelService.createNotificationEvent(agreement.masterPartner.domain, getRecipientsDescriptorAsPartnerAdmin(), title, message, actionLink);
} catch (Exception e) {
Logger.error("Error when creating notification event for acceptAgreement action", e);
}
}
示例5: delete
import framework.utils.Msg; //导入依赖的package包/类
/**
* Delete an actor.
*
* @param id
* the actor id
*/
@With(CheckActorExists.class)
@Dynamic(IMafConstants.ACTOR_DELETE_DYNAMIC_PERMISSION)
public Result delete(Long id) {
// get the actor
Actor actor = ActorDao.getActorById(id);
// delete the actor
actor.doDelete();
// success message
Utilities.sendSuccessFlashMessage(Msg.get("core.actor.delete.successful"));
return redirect(controllers.core.routes.SearchController.index());
}
示例6: rejectAgreementLink
import framework.utils.Msg; //导入依赖的package包/类
@Override
public void rejectAgreementLink(DataSyndicationAgreementLink agreementLink) throws EchannelException {
echannelService.rejectAgreementLink(agreementLink.id);
try {
String actionLink = null;
if (agreementLink.dataType.equals(PortfolioEntry.class.getName())) {
actionLink = agreementLink.agreement.masterPartner.baseUrl + controllers.core.routes.PortfolioEntryDataSyndicationController
.viewAgreementLink(agreementLink.masterObjectId, agreementLink.id).url();
}
String title = Msg.get(this.lang, "data_syndication.reject_agreement_link.notification.title");
String message = Msg.get(this.lang, "data_syndication.reject_agreement_link.notification.message", actionLink);
echannelService.createNotificationEvent(agreementLink.agreement.masterPartner.domain,
getRecipientsDescriptorAsPrincipal(agreementLink.masterPrincipalUid), title, message, actionLink);
} catch (Exception e) {
Logger.error("Error when creating notification event for rejectAgreementLink action", e);
}
}
示例7: deleteAgreementLink
import framework.utils.Msg; //导入依赖的package包/类
@Override
public void deleteAgreementLink(DataSyndicationAgreementLink agreementLink) throws EchannelException {
echannelService.deleteAgreementLink(agreementLink.id);
try {
String title = Msg.get(this.lang, "data_syndication.delete_agreement_link.notification.title");
String message = Msg.get(this.lang, "data_syndication.delete_agreement_link.notification.message", agreementLink.agreement.name);
String masterActionLink = agreementLink.agreement.masterPartner.baseUrl
+ controllers.admin.routes.DataSyndicationController.viewMasterAgreements().url();
echannelService.createNotificationEvent(agreementLink.agreement.masterPartner.domain, getRecipientsDescriptorAsPartnerAdmin(), title, message,
masterActionLink);
String slaveActionLink = agreementLink.agreement.slavePartner.baseUrl
+ controllers.admin.routes.DataSyndicationController.viewMasterAgreements().url();
echannelService.createNotificationEvent(agreementLink.agreement.slavePartner.domain, getRecipientsDescriptorAsPartnerAdmin(), title, message,
slaveActionLink);
} catch (Exception e) {
Logger.error("Error when creating notification event for deleteAgreementLink action", e);
}
}
示例8: deleteStatusType
import framework.utils.Msg; //导入依赖的package包/类
/**
* Delete a life cycle milestone instance status type.
*
* @param statusTypeId
* the status type id
*/
public Result deleteStatusType(Long statusTypeId) {
LifeCycleMilestoneInstanceStatusType statusType = LifeCycleMilestoneDao.getLCMilestoneInstanceStatusTypeById(statusTypeId);
if ((statusType.lifeCycleMilestoneInstances != null && statusType.lifeCycleMilestoneInstances.size() > 0)
|| (statusType.lifeCycleMilestones != null && statusType.lifeCycleMilestones.size() > 0)) {
Utilities.sendErrorFlashMessage(Msg.get("admin.configuration.reference_data.life_cycle_milestone_instance_status_type.delete.error"));
} else {
statusType.doDelete();
Utilities.sendSuccessFlashMessage(Msg.get("admin.configuration.reference_data.life_cycle_milestone_instance_status_type.delete.successful"));
this.getTableProvider().flushFilterConfig();
}
return redirect(controllers.admin.routes.ConfigurationGovernanceController.list());
}
示例9: deleteMilestone
import framework.utils.Msg; //导入依赖的package包/类
/**
* Delete a life cycle milestone.
*
* @param milestoneId
* the milestone id (set 0 for create case)
*/
public Result deleteMilestone(Long milestoneId) {
LifeCycleMilestone milestone = LifeCycleMilestoneDao.getLCMilestoneById(milestoneId);
if ((milestone.lifeCycleMilestoneInstances != null && milestone.lifeCycleMilestoneInstances.size() > 0)
|| (milestone.startLifeCyclePhases != null && milestone.startLifeCyclePhases.size() > 0)
|| (milestone.endLifeCyclePhases != null && milestone.endLifeCyclePhases.size() > 0)) {
Utilities.sendErrorFlashMessage(Msg.get("admin.configuration.reference_data.life_cycle_milestone.delete.error"));
} else {
milestone.doDelete();
// remove the planned date
LifeCyclePlanningDao.getPlannedLCMilestoneInstanceAsListByLCMilestone(milestone.id).forEach(PlannedLifeCycleMilestoneInstance::doDelete);
Utilities.sendSuccessFlashMessage(Msg.get("admin.configuration.reference_data.life_cycle_milestone.delete.successful"));
this.getTableProvider().flushFilterConfig();
}
return redirect(controllers.admin.routes.ConfigurationGovernanceController.viewLifeCycleProcess(milestone.lifeCycleProcess.id));
}
示例10: deleteRole
import framework.utils.Msg; //导入依赖的package包/类
@Restrict({ @Group(IMafConstants.ADMIN_CONFIGURATION_PERMISSION) })
public Result deleteRole(Long roleTypeId) {
SystemLevelRoleType role = SystemLevelRoleType.getActiveRoleFromId(roleTypeId);
role.doDelete();
Utilities.sendSuccessFlashMessage(Msg.get("admin.configuration.roles.delete.successful"));
// clean the cache
try {
getAccountManagerPlugin().invalidateAllUserAccountsCache();
} catch (AccountManagementException e) {
log.error("Unable to flush the user cache after roles modifications", e);
}
return redirect(controllers.admin.routes.ConfigurationController.roles());
}
示例11: resetUserPassword
import framework.utils.Msg; //导入依赖的package包/类
/**
* Reset the user password of the user associated with the specified
* account.
*
* @param userAccount
* the user account
* @param eraseCurrentPassword
* true if the current user password is cleared before sending
* the password reset message
*/
private void resetUserPassword(IUserAccount userAccount, boolean eraseCurrentPassword) throws AccountManagementException {
// Generate a random password
String validationData = RandomStringUtils.randomAlphanumeric(12);
String validationKey = accountManagerPlugin.getValidationKey(userAccount.getUid(), validationData);
if (eraseCurrentPassword) {
getAccountManagerPlugin().updatePassword(userAccount.getUid(), validationData);
}
// Send an e-mail for reseting password
String resetPasswordUrl = getPreferenceManagerPlugin().getPreferenceElseConfigurationValue(IFrameworkConstants.PUBLIC_URL_PREFERENCE,
"maf.public.url") + controllers.admin.routes.PasswordReset.displayPasswordResetForm(userAccount.getUid(), validationKey).url();
emailService.sendEmail(Msg.get("admin.user_manager.reset_password.mail.subject"), play.Configuration.root().getString("maf.email.from"),
this.getI18nMessagesPlugin()
.renderViewI18n("views.html.mail.account_password_reset_html", play.Configuration.root().getString("maf.platformName"),
userAccount.getFirstName() + " " + userAccount.getLastName(), resetPasswordUrl)
.body(),
userAccount.getMail());
}
示例12: saveRoles
import framework.utils.Msg; //导入依赖的package包/类
/**
* Update the user account with the roles specified by the administrator.
*/
public Result saveRoles() {
try {
Form<UserAccountFormData> boundForm = rolesUpdateForm.bindFromRequest();
if (boundForm.hasErrors()) {
return badRequest(views.html.admin.usermanager.usermanager_editmail.render(boundForm));
}
UserAccountFormData accountDataForm = boundForm.get();
// Remove the null values which may be present in the list (see the
// view to understand)
accountDataForm.systemLevelRoleTypes.removeAll(Collections.singleton(null));
getAccountManagerPlugin().overwriteSystemLevelRoleTypes(accountDataForm.uid, accountDataForm.systemLevelRoleTypes);
Utilities.sendSuccessFlashMessage(Msg.get("admin.user_manager.update.success"));
return redirect(controllers.admin.routes.UserManager.displayUser(accountDataForm.uid));
} catch (Exception e) {
return ControllersUtils.logAndReturnUnexpectedError(e, log, getConfiguration(), getI18nMessagesPlugin());
}
}
示例13: create
import framework.utils.Msg; //导入依赖的package包/类
@Restrict({ @Group(IMafConstants.PORTFOLIO_ENTRY_SUBMISSION_PERMISSION), @Group(IMafConstants.RELEASE_SUBMISSION_PERMISSION) })
public Result create(boolean isRelease) {
try {
if (isRelease && !securityService.restrict(IMafConstants.RELEASE_SUBMISSION_PERMISSION)) {
return forbidden(views.html.error.access_forbidden.render(""));
}
if (!isRelease && !securityService.restrict(IMafConstants.PORTFOLIO_ENTRY_SUBMISSION_PERMISSION)) {
return forbidden(views.html.error.access_forbidden.render(""));
}
} catch (Exception e) {
return ControllersUtils.logAndReturnUnexpectedError(e, log, getConfiguration(), getMessagesPlugin());
}
if (!getLicensesManagementService().canCreatePortfolioEntry()) {
Utilities.sendErrorFlashMessage(Msg.get("licenses_management.cannot_create_portfolio_entry"));
}
Actor actor = ActorDao.getActorByUidOrCreateDefaultActor(this.getAccountManagerPlugin(), getUserSessionManagerPlugin().getUserSessionId(ctx()));
Form<PortfolioEntryCreateFormData> filledForm = portfolioEntryCreateFormTemplate.fill(new PortfolioEntryCreateFormData(isRelease, actor.id));
return ok(views.html.core.portfolioentry.portfolio_entry_create.render(filledForm, isRelease));
}
示例14: registerPlugin
import framework.utils.Msg; //导入依赖的package包/类
@Restrict({ @Group(IMafConstants.ADMIN_PLUGIN_MANAGER_PERMISSION) })
public Result registerPlugin() {
Form<PluginRegistrationFormObject> boundForm = registrationFormTemplate.bindFromRequest();
if (boundForm.hasErrors()) {
return ok(views.html.admin.plugin.pluginmanager_registration_form.render(boundForm));
}
// Create the configuration record
PluginRegistrationFormObject pluginRegistrationFormObject = boundForm.get();
try {
getPluginManagerService().registerPlugin(pluginRegistrationFormObject.name, pluginRegistrationFormObject.identifier);
Utilities.sendSuccessFlashMessage(Msg.get("admin.plugin_manager.configuration.new.success", pluginRegistrationFormObject.name));
} catch (PluginException e) {
Utilities.sendErrorFlashMessage(Msg.get("admin.plugin_manager.configuration.new.error", pluginRegistrationFormObject.name));
log.error("Failed to register manually the plugin in the manager controller", e);
}
return redirect(routes.PluginManagerController.index());
}
示例15: unregisterPlugin
import framework.utils.Msg; //导入依赖的package包/类
@Restrict({ @Group(IMafConstants.ADMIN_PLUGIN_MANAGER_PERMISSION) })
public Result unregisterPlugin(Long pluginConfigurationId) {
IPluginInfo pluginInfo = getPluginManagerService().getRegisteredPluginDescriptors().get(pluginConfigurationId);
if (pluginInfo == null) {
Utilities.sendErrorFlashMessage(Msg.get("admin.plugin_manager.configuration.view.not_exists", pluginConfigurationId));
return redirect(routes.PluginManagerController.index());
}
if (!pluginInfo.getDescriptor().autoRegister()) {
String pluginConfigurationName = pluginInfo.getPluginConfigurationName();
try {
getPluginManagerService().unregisterPlugin(pluginConfigurationId);
Utilities.sendSuccessFlashMessage(Msg.get("admin.plugin_manager.configuration.delete.success", pluginConfigurationName));
} catch (Exception e) {
Utilities.sendErrorFlashMessage(Msg.get("admin.plugin_manager.configuration.delete.error", pluginConfigurationName));
log.error("Fail to unregister a plugin configuration manually", e);
}
}
return redirect(routes.PluginManagerController.index());
}