当前位置: 首页>>代码示例>>Java>>正文


Java Utilities类代码示例

本文整理汇总了Java中framework.utils.Utilities的典型用法代码示例。如果您正苦于以下问题:Java Utilities类的具体用法?Java Utilities怎么用?Java Utilities使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Utilities类属于framework.utils包,在下文中一共展示了Utilities类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteNotification

import framework.utils.Utilities; //导入依赖的package包/类
/**
 * Delete a notification (if this one belongs to the current user).
 * 
 * @param id
 *            the id of a {@link Notification}
 * @return
 */
@SubjectPresent
public Result deleteNotification(Long id) {
    String loggedUser = getUserSessionManagerPlugin().getUserSessionId(ctx());
    Notification notification = Notification.find.where().eq("deleted", false).eq("id", id).findUnique();
    if (getNotificationManagerPlugin().deleteNotificationsForUid(loggedUser, id)) {
        if (notification.isMessage) {
            Utilities.sendSuccessFlashMessage(Msg.get("messaging.list.success.deleted"));
            return redirect(routes.MessagingController.index());
        } else {
            Utilities.sendSuccessFlashMessage(Msg.get("notifications.list.success.deleted"));
            return redirect(routes.Application.displayNotifications());
        }
    }
    return badRequest();
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:23,代码来源:Application.java

示例2: deleteLine

import framework.utils.Utilities; //导入依赖的package包/类
/**
 * Delete a budget bucket line.
 * 
 * @param id
 *            the budget bucket id
 * @param lineId
 *            the budget bucket line id
 */
@With(CheckBudgetBucketExists.class)
@Dynamic(IMafConstants.BUDGET_BUCKET_EDIT_DYNAMIC_PERMISSION)
public Result deleteLine(Long id, Long lineId) {

    // get the budget bucket line
    BudgetBucketLine line = BudgetBucketDAO.getBudgetBucketLineById(lineId);

    // security: the budget bucket must be related to the object
    if (!line.budgetBucket.id.equals(id)) {
        return forbidden(views.html.error.access_forbidden.render(""));
    }

    // set the delete flag to true
    line.doDelete();

    Utilities.sendSuccessFlashMessage(Msg.get("core.budget_bucket.line.delete.successful"));

    return redirect(controllers.core.routes.BudgetBucketController.view(id, 0, 0));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:28,代码来源:BudgetBucketController.java

示例3: call

import framework.utils.Utilities; //导入依赖的package包/类
@Override
public Promise<Result> call(final Http.Context ctx) throws Throwable {

    Long id = Utilities.getId(ctx);
    if (id != null) {
        Reporting reporting = ReportingDao.getReportingById(id);
        if (reporting != null) {
            return delegate.call(ctx);
        }
    }

    return Promise.promise(new Function0<Result>() {

        public Result apply() throws Throwable {
            return play.mvc.Results.notFound(views.html.error.not_found.render(ctx.request().uri()));
        }

    });

}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:21,代码来源:CheckReportingExists.java

示例4: startPlugin

import framework.utils.Utilities; //导入依赖的package包/类
@Restrict({ @Group(IMafConstants.ADMIN_PLUGIN_MANAGER_PERMISSION) })
public Result startPlugin(Long pluginConfigurationId) {
    IPluginInfo pluginInfo = getPluginManagerService().getRegisteredPluginDescriptors().get(pluginConfigurationId);
    if (pluginInfo == null) {
        return badRequest();
    }
    if (!pluginInfo.getDescriptor().autoRegister()) {
        String pluginConfigurationName = pluginInfo.getPluginConfigurationName();
        try {
            getPluginManagerService().startPlugin(pluginConfigurationId);
            Utilities.sendSuccessFlashMessage(
                    Msg.get("admin.plugin_manager.configuration.view.panel.admin.start.success", Msg.get(pluginConfigurationName)));
        } catch (PluginException e) {
            log.error("Exception while attempting to start the plugin " + pluginConfigurationId, e);
            Utilities.sendErrorFlashMessage(Msg.get("admin.plugin_manager.configuration.view.panel.admin.start.error", Msg.get(pluginConfigurationName)));
        }
    }
    return redirect(routes.PluginManagerController.pluginConfigurationDetails(pluginConfigurationId));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:20,代码来源:PluginManagerController.java

示例5: PortfolioEntryPlanningPackageFormData

import framework.utils.Utilities; //导入依赖的package包/类
/**
 * Construct the form data with a DB entry.
 * 
 * @param portfolioEntryPlanningPackage
 *            the portfolio entry planning package in the DB
 */
public PortfolioEntryPlanningPackageFormData(PortfolioEntryPlanningPackage portfolioEntryPlanningPackage) {

    this.id = portfolioEntryPlanningPackage.portfolioEntry.id;
    this.planningPackageId = portfolioEntryPlanningPackage.id;

    this.refId=portfolioEntryPlanningPackage.refId;
    this.name = portfolioEntryPlanningPackage.name;
    this.isOpex = portfolioEntryPlanningPackage.isOpex;
    this.description = portfolioEntryPlanningPackage.description;
    this.startDate = portfolioEntryPlanningPackage.startDate != null ? Utilities.getDateFormat(null).format(portfolioEntryPlanningPackage.startDate)
            : null;
    this.endDate = portfolioEntryPlanningPackage.endDate != null ? Utilities.getDateFormat(null).format(portfolioEntryPlanningPackage.endDate) : null;
    this.portfolioEntryPlanningPackageType = portfolioEntryPlanningPackage.portfolioEntryPlanningPackageType.id;
    this.portfolioEntryPlanningPackageGroup = portfolioEntryPlanningPackage.portfolioEntryPlanningPackageGroup != null
            ? portfolioEntryPlanningPackage.portfolioEntryPlanningPackageGroup.id : null;
    this.status = portfolioEntryPlanningPackage.status.name();

}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:25,代码来源:PortfolioEntryPlanningPackageFormData.java

示例6: validate

import framework.utils.Utilities; //导入依赖的package包/类
/**
 * Validate the dates.
 */
public List<ValidationError> validate() {

    List<ValidationError> errors = new ArrayList<>();

    try {

        if (Utilities.getDateFormat(null).parse(this.startDate).after(Utilities.getDateFormat(null).parse(this.endDate))) {
            // the end date should be after the start date
            errors.add(new ValidationError("endDate", Messages.get("object.data_syndication_agreement.end_date.invalid")));
        }

    } catch (Exception e) {
        Logger.warn("impossible to validate the dates");
    }

    return errors.isEmpty() ? null : errors;
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:21,代码来源:DataSyndicationAgreementNoSlaveSubmitFormData.java

示例7: save

import framework.utils.Utilities; //导入依赖的package包/类
/**
 * Process the edit form of a KPI definition.
 * 
 * @return
 */
public Result save() {

    // bind the form
    Form<KpiDefinitionFormData> boundForm = kpiDefinitionFormTemplate.bindFromRequest();

    // get the KPI
    Long kpiDefinitionId = Long.valueOf(boundForm.data().get("id"));
    KpiDefinition kpiDefinition = KpiDefinition.getById(kpiDefinitionId);
    Kpi kpi = new Kpi(kpiDefinition, getKpiService());

    if (boundForm.hasErrors()) {
        return ok(views.html.admin.kpi.edit.render(kpiDefinition, kpi, boundForm));
    }

    KpiDefinitionFormData kpiDefinitionFormData = boundForm.get();

    kpiDefinitionFormData.fill(kpiDefinition);
    kpiDefinition.update();

    reloadKpiDefinition(kpiDefinition.uid);

    Utilities.sendSuccessFlashMessage(Msg.get("admin.kpi.edit.successful"));

    return redirect(controllers.admin.routes.KpiManagerController.view(kpiDefinition.id));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:31,代码来源:KpiManagerController.java

示例8: validate

import framework.utils.Utilities; //导入依赖的package包/类
/**
 * Validate the dates.
 */
public List<ValidationError> validate() {

    List<ValidationError> errors = new ArrayList<>();

    if (this.startDate != null && this.dueDate != null) {

        try {

            if (!this.startDate.equals("") && !this.dueDate.equals("")
                    && Utilities.getDateFormat(null).parse(this.startDate).after(Utilities.getDateFormat(null).parse(this.dueDate))) {
                // the due date should be after the start date
                errors.add(new ValidationError("dueDate", Messages.get("object.work_order.due_date.invalid")));
            }

        } catch (Exception e) {
            Logger.warn("impossible to parse the dates when testing the formats");
        }
    }

    return errors.isEmpty() ? null : errors;
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:25,代码来源:WorkOrderFormData.java

示例9: scheduleRecurring

import framework.utils.Utilities; //导入依赖的package包/类
@Override
public Cancellable scheduleRecurring(final boolean exclusive, final String scheduledActionUuid, FiniteDuration initialDelay, FiniteDuration interval,
        final Runnable runnable, final boolean logInDebug) {
    if (log.isDebugEnabled()) {
        log.debug("Request " + (exclusive ? "EXCLUSIVE" : "STANDARD") + " " + scheduledActionUuid);
    }
    return getActorSystem().scheduler().schedule(initialDelay, interval, new Runnable() {
        @Override
        public void run() {
            String transactionId = Utilities.getRandomID();
            dumpSystemStatus(
                    "SCHEDULER START for " + scheduledActionUuid + " [" + (exclusive ? "EXCLUSIVE" : "STANDARD") + "] and transaction " + transactionId,
                    logInDebug);
            markAsStarted(transactionId, scheduledActionUuid);
            try {
                runnable.run();
            } catch (Exception e) {
                log.error("The job " + scheduledActionUuid + " raised an exception within the transaction " + transactionId, e);
            }
            markAsCompleted(transactionId, scheduledActionUuid);
            dumpSystemStatus("SCHEDULER STOP for " + scheduledActionUuid + " and transaction " + transactionId, logInDebug);
        }
    }, getActorSystem().dispatcher());
}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:25,代码来源:SysAdminUtilsImpl.java

示例10: delete

import framework.utils.Utilities; //导入依赖的package包/类
/**
 * Delete a portfolio entry.
 * 
 * @param id
 *            the portfolio entry id
 */
@With(CheckPortfolioEntryExists.class)
@Dynamic(IMafConstants.PORTFOLIO_ENTRY_DELETE_DYNAMIC_PERMISSION)
public Result delete(Long id) {

    // get the portfolioEntry
    PortfolioEntry portfolioEntry = PortfolioEntryDao.getPEById(id);

    // set the delete flag to true
    portfolioEntry.doDelete();

    Utilities.sendSuccessFlashMessage(Msg.get("core.portfolio_entry.delete.successful", portfolioEntry.portfolioEntryType.getName().toLowerCase()));

    // update the licenses number
    getLicensesManagementService().updateConsumedPortfolioEntries();

    return redirect(controllers.core.routes.RoadmapController.index());
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:24,代码来源:PortfolioEntryController.java

示例11: delete

import framework.utils.Utilities; //导入依赖的package包/类
/**
 * Delete a direct stakeholder of a portfolio entry.
 * 
 * @param id
 *            the portfolio entry id
 * @param stakeholderId
 *            the stakeholder id
 */
@With(CheckPortfolioEntryExists.class)
@Dynamic(IMafConstants.PORTFOLIO_ENTRY_EDIT_DYNAMIC_PERMISSION)
public Result delete(Long id, Long stakeholderId) {

    // get the stakeholder
    Stakeholder stakeholder = StakeholderDao.getStakeholderById(stakeholderId);

    // security: the portfolioEntry must be related to the object
    if (!stakeholder.portfolioEntry.id.equals(id)) {
        return forbidden(views.html.error.access_forbidden.render(""));
    }

    // set the delete flag to true
    stakeholder.doDelete();

    Utilities.sendSuccessFlashMessage(Msg.get("core.portfolio_entry_stakeholder.delete"));

    return redirect(controllers.core.routes.PortfolioEntryStakeholderController.index(id));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:28,代码来源:PortfolioEntryStakeholderController.java

示例12: RequestMilestoneFormData

import framework.utils.Utilities; //导入依赖的package包/类
/**
 * Construct the form data with a DB entry.
 * 
 * @param portfolioEntryId
 *            the portfolio entry id
 * @param milestoneId
 *            the milestone id
 */
public RequestMilestoneFormData(Long portfolioEntryId, Long milestoneId) {
    this.id = portfolioEntryId;
    this.milestoneId = milestoneId;
    LifeCycleInstancePlanning planning = LifeCyclePlanningDao.getLCInstancePlanningAsLastByPE(id);
    PlannedLifeCycleMilestoneInstance  plannedLifeCycleMilestoneInstance = LifeCyclePlanningDao.getPlannedLCMilestoneInstanceByLCInstancePlanningAndLCMilestone(planning.id,
            milestoneId);
    if (Strings.isNullOrEmpty(this.passedDate))
    {
    	try
    	{
    		this.passedDate = Utilities.getDateFormat(null).format(plannedLifeCycleMilestoneInstance.plannedDate);
    	}
    	catch (Exception e) {
            this.passedDate = null;
        }
    }
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:26,代码来源:RequestMilestoneFormData.java

示例13: sendReminderTimesheet

import framework.utils.Utilities; //导入依赖的package包/类
/**
 * Send a reminder for a timesheet.
 * 
 * @param id
 *            the timesheet report id
 */
@With(CheckTimesheetReportExists.class)
@Dynamic(IMafConstants.TIMESHEET_APPROVAL_DYNAMIC_PERMISSION)
public Result sendReminderTimesheet(Long id) {

    // get the report
    TimesheetReport report = TimesheetDao.getTimesheetReportById(id);
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    String startDate = Utilities.getDateFormat(null).format(report.startDate);
    String endDate = Utilities.getDateFormat(null).format(report.getEndDate());

    // send the notification
    ActorDao.sendNotification(this.getNotificationManagerService(), this.getI18nMessagesPlugin(), report.actor,
            NotificationCategory.getByCode(Code.TIMESHEET), controllers.core.routes.TimesheetController.weeklyFill(sdf.format(report.startDate)).url(),
            "core.timesheet.send_reminder.notification.title", "core.timesheet.send_reminder.notification.message", startDate, endDate);

    Utilities.sendSuccessFlashMessage(Msg.get("core.timesheet.send_reminder.successful"));

    return redirect(request().getHeader("referer"));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:26,代码来源:TimesheetController.java

示例14: defineToolsMenu

import framework.utils.Utilities; //导入依赖的package包/类
/**
 * Define the tools menu.
 * 
 * @param perspectiveKey
 *            the perspective key, let null for the main
 */
private void defineToolsMenu(String perspectiveKey) {
    toolsMenuItem = new HeaderMenuItem(TopMenus.TOOLS.name(), "topmenubar.tools.menu.label", "fa fa-wrench", false);
    toolsMenuItem.setAuthorizedPermissions(Utilities.getListOfArray(IMafConstants.TIMESHEET_ENTRY_PERMISSION, IMafConstants.REPORTING_VIEW_ALL_PERMISSION,
            IMafConstants.REPORTING_VIEW_AS_VIEWER_PERMISSION));
    if (perspectiveKey == null) {
        addMenuItemToMainPerspective(toolsMenuItem);
    } else {
        getPerspective(perspectiveKey).addMenuItem(toolsMenuItem);
    }

    ClickableMenuItem timesheetMenuItem = new ClickableMenuItem(TopMenus.TOOLS.name(1), "topmenubar.tools.timesheet.menu.label",
            controllers.core.routes.TimesheetController.weeklyFill(""), "fa fa-clock-o", false);
    timesheetMenuItem.setAuthorizedPermissions(Utilities.getListOfArray(IMafConstants.TIMESHEET_ENTRY_PERMISSION));
    toolsMenuItem.addSubMenuItem(timesheetMenuItem);

    ClickableMenuItem viewReportingMenuItem = new ClickableMenuItem(TopMenus.TOOLS.name(2), "topmenubar.tools.reporting.menu.label",
            controllers.core.routes.ReportingController.index(), "fa fa-pie-chart", false);
    viewReportingMenuItem.setAuthorizedPermissions(
            Utilities.getListOfArray(IMafConstants.REPORTING_VIEW_ALL_PERMISSION, IMafConstants.REPORTING_VIEW_AS_VIEWER_PERMISSION));
    toolsMenuItem.addSubMenuItem(viewReportingMenuItem);
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:28,代码来源:TopMenuBarService.java

示例15: deleteWorkOrder

import framework.utils.Utilities; //导入依赖的package包/类
/**
 * Delete a work order.
 * 
 * @param id
 *            the portfolio entry id
 * @param workOrderId
 *            the work order id
 */
@With(CheckPortfolioEntryExists.class)
@Dynamic(IMafConstants.PORTFOLIO_ENTRY_FINANCIAL_EDIT_DYNAMIC_PERMISSION)
public Result deleteWorkOrder(Long id, Long workOrderId) {

    // get the work order
    WorkOrder workOrder = WorkOrderDAO.getWorkOrderById(workOrderId);

    // security: the portfolioEntry must be related to the object
    if (!workOrder.portfolioEntry.id.equals(id)) {
        return forbidden(views.html.error.access_forbidden.render(""));
    }

    // set the delete flag to true
    workOrder.doDelete();

    Utilities.sendSuccessFlashMessage(Msg.get("core.portfolio_entry_financial.work_order.deleted.successful"));

    return redirect(controllers.core.routes.PortfolioEntryFinancialController.details(id));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:28,代码来源:PortfolioEntryFinancialController.java


注:本文中的framework.utils.Utilities类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。