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


Java With类代码示例

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


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

示例1: updateExam

import play.mvc.With; //导入依赖的package包/类
@With(ExamUpdateSanitizer.class)
@Restrict({@Group("TEACHER"), @Group("ADMIN")})
public Result updateExam(Long id) {
    Exam exam = prototypeQuery().where().idEq(id).findUnique();
    if (exam == null) {
        return notFound();
    }
    User user = getLoggedUser();
    if (exam.isOwnedOrCreatedBy(user) || getLoggedUser().hasRole("ADMIN", getSession())) {
        return updateTemporalFieldsAndValidate(exam, user)
                .orElseGet(() -> updateStateAndValidate(exam)
                        .orElseGet(() -> handleExamUpdate(exam)));
    } else {
        return forbidden("sitnet_error_access_forbidden");
    }
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:17,代码来源:ExamController.java

示例2: updateEnrolment

import play.mvc.With; //导入依赖的package包/类
@JsonValidator(schema = "enrolmentInfo")
@With(EnrolmentInformationSanitizer.class)
@Restrict({@Group("STUDENT")})
public Result updateEnrolment(Long id) {
    String info = request().attrs().getOptional(Attrs.ENROLMENT_INFORMATION).orElse(null);
    ExamEnrolment enrolment = Ebean.find(ExamEnrolment.class).where()
            .idEq(id)
            .eq("user", getLoggedUser())
            .findUnique();
    if (enrolment == null) {
        return notFound("enrolment not found");
    }
    enrolment.setInformation(info);
    enrolment.update();
    return ok();
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:17,代码来源:EnrolmentController.java

示例3: viewAgreementLink

import play.mvc.With; //导入依赖的package包/类
/**
 * Display the details of an agreement link with management capabilities.
 * 
 * @param id
 *            the portfolio entry id
 * @param agreementLinkId
 *            the agreement link id
 */
@With(CheckPortfolioEntryExists.class)
@Dynamic(IMafConstants.PORTFOLIO_ENTRY_EDIT_DYNAMIC_PERMISSION)
public Result viewAgreementLink(Long id, Long agreementLinkId) {

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

    // get the agreement link
    DataSyndicationAgreementLink agreementLink = null;
    try {
        agreementLink = dataSyndicationService.getAgreementLink(agreementLinkId);
        if (agreementLink == null) {
            return notFound(views.html.error.not_found.render(""));
        }
    } catch (Exception e) {
        Logger.error("DataSyndication viewAgreementLink unexpected error", e);
        return ok(views.html.core.portfolioentrydatasyndication.communication_error.render(portfolioEntry));
    }

    // define if the instance is the master or slave of the agreement link
    Boolean isMasterAgreementLink = agreementLink.agreement.masterPartner.domain.equals(dataSyndicationService.getCurrentDomain());

    return ok(views.html.core.portfolioentrydatasyndication.agreement_link_view.render(portfolioEntry, isMasterAgreementLink, agreementLink));

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

示例4: manage

import play.mvc.With; //导入依赖的package包/类
/**
 * Form to create/edit a direct stakeholder of a portfolio entry.
 * 
 * @param id
 *            the portfolio entry id
 * @param stakeholderId
 *            the stakeholder id (set to 0 for create case)
 */
@With(CheckPortfolioEntryExists.class)
@Dynamic(IMafConstants.PORTFOLIO_ENTRY_EDIT_DYNAMIC_PERMISSION)
public Result manage(Long id, Long stakeholderId) {

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

    // initiate the form with the template
    Form<StakeholderFormData> stakeholderForm = formTemplate;

    // edit case: inject values
    if (!stakeholderId.equals(Long.valueOf(0))) {
        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(""));
        }

        stakeholderForm = formTemplate.fill(new StakeholderFormData(stakeholder));
    }

    return ok(views.html.core.portfolioentrystakeholder.stakeholder_manage.render(portfolioEntry, stakeholderForm));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:33,代码来源:PortfolioEntryStakeholderController.java

示例5: delete

import play.mvc.With; //导入依赖的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

示例6: edit

import play.mvc.With; //导入依赖的package包/类
/**
 * Form to edit a budget bucket.
 * 
 * @param id
 *            the budget bucket id
 */
@With(CheckBudgetBucketExists.class)
@Dynamic(IMafConstants.BUDGET_BUCKET_EDIT_DYNAMIC_PERMISSION)
public Result edit(Long id) {

    // get the budget bucket
    BudgetBucket budgetBucket = BudgetBucketDAO.getBudgetBucketById(id);

    // load the form
    Form<BudgetBucketFormData> form = formTemplate.fill(new BudgetBucketFormData(budgetBucket));

    // add the custom attributes values
    this.getCustomAttributeManagerService().fillWithValues(form, BudgetBucket.class, id);

    return ok(views.html.core.budgetbucket.budget_bucket_edit.render(budgetBucket, form));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:22,代码来源:BudgetBucketController.java

示例7: reallocateOrgUnit

import play.mvc.With; //导入依赖的package包/类
/**
 * Display the form to reallocate an org unit to an actor.
 * 
 * @param id
 *            the portfolio entry id
 * @param allocatedOrgUnitId
 *            the allocated org unit
 */
@With(CheckPortfolioEntryExists.class)
@Dynamic(IMafConstants.PORTFOLIO_ENTRY_EDIT_DYNAMIC_PERMISSION)
public Result reallocateOrgUnit(Long id, Long allocatedOrgUnitId) {

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

    // get the allocated org unit
    PortfolioEntryResourcePlanAllocatedOrgUnit allocatedOrgUnit = PortfolioEntryResourcePlanDAO.getPEResourcePlanAllocatedOrgUnitById(allocatedOrgUnitId);

    // get the org unit
    OrgUnit orgUnit = allocatedOrgUnit.orgUnit;

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

    Form<PortfolioEntryResourcePlanAllocatedActorFormData> allocatedActorForm = reallocateOrgUnitFormTemplate
            .fill(new PortfolioEntryResourcePlanAllocatedActorFormData(allocatedOrgUnit));

    return ok(views.html.core.portfolioentryplanning.allocated_org_unit_reallocate.render(portfolioEntry, orgUnit, allocatedActorForm));

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

示例8: manageLine

import play.mvc.With; //导入依赖的package包/类
/**
 * Create or edit a budget bucket line.
 * 
 * @param id
 *            the budget bucket id
 * @param lineId
 *            the budget bucket line id, set to 0 for create case
 */
@With(CheckBudgetBucketExists.class)
@Dynamic(IMafConstants.BUDGET_BUCKET_EDIT_DYNAMIC_PERMISSION)
public Result manageLine(Long id, Long lineId) {

    // get the budget bucket
    BudgetBucket budgetBucket = BudgetBucketDAO.getBudgetBucketById(id);

    // initiate the form with the template
    Form<BudgetBucketLineFormData> lineForm = lineFormTemplate;

    // edit case: inject values
    if (!lineId.equals(Long.valueOf(0))) {

        BudgetBucketLine budgetBucketLine = BudgetBucketDAO.getBudgetBucketLineById(lineId);

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

        lineForm = lineFormTemplate.fill(new BudgetBucketLineFormData(budgetBucketLine));
    }

    return ok(views.html.core.budgetbucket.budget_bucket_line_manage.render(budgetBucket, lineForm));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:34,代码来源:BudgetBucketController.java

示例9: deleteLine

import play.mvc.With; //导入依赖的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

示例10: viewBudgetLine

import play.mvc.With; //导入依赖的package包/类
/**
 * Display the details of a budget line.
 * 
 * @param id
 *            the portfolio entry id
 * @param budgetLineId
 *            the budget line id
 */
@With(CheckPortfolioEntryExists.class)
@Dynamic(IMafConstants.PORTFOLIO_ENTRY_FINANCIAL_VIEW_DYNAMIC_PERMISSION)
public Result viewBudgetLine(Long id, Long budgetLineId) {

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

    // get the budget line
    PortfolioEntryBudgetLine budgetLine = PortfolioEntryBudgetDAO.getPEBudgetLineById(budgetLineId);

    // construct the corresponding form data (for the custom attributes)
    PortfolioEntryBudgetLineFormData portfolioEntryBudgetLineFormData = new PortfolioEntryBudgetLineFormData(budgetLine);

    return ok(
            views.html.core.portfolioentryfinancial.portfolio_entry_budget_line_view.render(portfolioEntry, budgetLine, portfolioEntryBudgetLineFormData));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:25,代码来源:PortfolioEntryFinancialController.java

示例11: viewWorkOrder

import play.mvc.With; //导入依赖的package包/类
/**
 * Display the details of a work order.
 * 
 * @param id
 *            the portfolio entry id
 * @param workOrderId
 *            the work order id
 */
@With(CheckPortfolioEntryExists.class)
@Dynamic(IMafConstants.PORTFOLIO_ENTRY_FINANCIAL_VIEW_DYNAMIC_PERMISSION)
public Result viewWorkOrder(Long id, Long workOrderId) {

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

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

    // construct the corresponding form data (for the custom attributes)
    WorkOrderFormData workOrderFormData = new WorkOrderFormData(workOrder);

    return ok(views.html.core.portfolioentryfinancial.portfolio_entry_work_order_view.render(portfolioEntry, workOrder, workOrderFormData));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:24,代码来源:PortfolioEntryFinancialController.java

示例12: events

import play.mvc.With; //导入依赖的package包/类
/**
 * Display the list of events.
 * 
 * @param id
 *            the portfolio entry id
 */
@With(CheckPortfolioEntryExists.class)
@Dynamic(IMafConstants.PORTFOLIO_ENTRY_DETAILS_DYNAMIC_PERMISSION)
public Result events(Long id) {

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

    try {

        // get the filter config
        String uid = getUserSessionManagerPlugin().getUserSessionId(ctx());
        FilterConfig<PortfolioEntryEventListView> filterConfig = this.getTableProvider().get().portfolioEntryEvent.filterConfig.getCurrent(uid,
                request());

        // get the table
        Pair<Table<PortfolioEntryEventListView>, Pagination<PortfolioEntryEvent>> t = getEventsTable(id, filterConfig);

        return ok(views.html.core.portfolioentrystatusreporting.events.render(portfolioEntry, t.getLeft(), t.getRight(), filterConfig));

    } catch (Exception e) {

        return ControllersUtils.logAndReturnUnexpectedError(e, log, getConfiguration(), getI18nMessagesPlugin());

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

示例13: deleteRisk

import play.mvc.With; //导入依赖的package包/类
/**
 * Delete a risk.
 * 
 * @param id
 *            the portfolio entry id
 * @param reportId
 *            the report id
 */
@With(CheckPortfolioEntryExists.class)
@Dynamic(IMafConstants.PORTFOLIO_ENTRY_EDIT_DYNAMIC_PERMISSION)
public Result deleteRisk(Long id, Long riskId) {

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

    // get the portfolioEntry risk
    PortfolioEntryRisk portfolioEntryRisk = PortfolioEntryRiskDao.getPERiskById(riskId);

    // security: the portfolioEntry must be related to the object
    if (!portfolioEntryRisk.portfolioEntry.id.equals(id)) {
        return forbidden(views.html.error.access_forbidden.render(""));
    }
    
    portfolioEntryRisk.doDelete();
    
    Utilities.sendSuccessFlashMessage(Msg.get("core.portfolio_entry_status_reporting.event.delete.successful"));
    return redirect(controllers.core.routes.PortfolioEntryStatusReportingController.registers(id, 0, 0, 0, false, false));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:29,代码来源:PortfolioEntryStatusReportingController.java

示例14: createReportAttachment

import play.mvc.With; //导入依赖的package包/类
/**
 * Form to add an attachment to a report.
 * 
 * @param id
 *            the portfolio entry id
 * @param reportId
 *            the report id
 */
@With(CheckPortfolioEntryExists.class)
@Dynamic(IMafConstants.PORTFOLIO_ENTRY_EDIT_DYNAMIC_PERMISSION)
public Result createReportAttachment(Long id, Long reportId) {

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

    // get the report
    PortfolioEntryReport report = PortfolioEntryReportDao.getPEReportById(reportId);

    // construct the form
    Form<AttachmentFormData> attachmentForm = attachmentFormTemplate.fill(new AttachmentFormData());

    return ok(views.html.core.portfolioentrystatusreporting.report_attachment_create.render(portfolioEntry, report, attachmentForm));

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

示例15: viewRisk

import play.mvc.With; //导入依赖的package包/类
/**
 * Display the details of a portfolio entry risk/issue.
 * 
 * @param id
 *            the portfolio entry id
 * @param riskId
 *            the risk/issue id
 */
@With(CheckPortfolioEntryExists.class)
@Dynamic(IMafConstants.PORTFOLIO_ENTRY_DETAILS_DYNAMIC_PERMISSION)
public Result viewRisk(Long id, Long riskId) {

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

    // get the portfolioEntry risk
    PortfolioEntryRisk portfolioEntryRisk = PortfolioEntryRiskDao.getPERiskById(riskId);

    // construct the corresponding form data (for the custom attributes)
    PortfolioEntryRiskFormData portfolioEntryRiskFormData = new PortfolioEntryRiskFormData(portfolioEntryRisk);

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

    return ok(views.html.core.portfolioentrystatusreporting.risk_view.render(portfolioEntry, portfolioEntryRisk, portfolioEntryRiskFormData));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:29,代码来源:PortfolioEntryStatusReportingController.java


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