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


Java Form.form方法代码示例

本文整理汇总了Java中play.data.Form.form方法的典型用法代码示例。如果您正苦于以下问题:Java Form.form方法的具体用法?Java Form.form怎么用?Java Form.form使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在play.data.Form的用法示例。


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

示例1: debtTypePresent

import play.data.Form; //导入方法依赖的package包/类
public static F.Promise<Result> debtTypePresent() {
    JsonNode key = keystoreConnector.getKey(session("uuid")).get(SsttpFrontendConfig.timeout);
    Form<EligibilityDebtType> form = Form.form(EligibilityDebtType.class);

    if(Optional.ofNullable(key).isPresent()) {
        if(Optional.ofNullable(key.get("data").get("service-start")).isPresent()) {

            JsonNode debtType = key.get("data").get("eligibility-debt-type-form");

            if(Optional.ofNullable(debtType).isPresent()) {
                return F.Promise.promise(() -> ok(debt_type.render(Form.form(EligibilityDebtType.class)
                            .fill(fromJson(debtType, EligibilityDebtType.class)))));
            } else return F.Promise.promise(() -> ok(debt_type.render(form)));
        } else
            return F.Promise.promise(() -> redirect(routes.SelfServiceTimeToPayController.serviceStart()));
    } else return F.Promise.promise(() -> ok(debt_type.render(form)));
}
 
开发者ID:hmrc,项目名称:self-service-time-to-pay-frontend-java,代码行数:18,代码来源:EligibilityController.java

示例2: existingTtpPresent

import play.data.Form; //导入方法依赖的package包/类
public static F.Promise<Result> existingTtpPresent() {
    JsonNode key = keystoreConnector.getKey(session("uuid")).get(SsttpFrontendConfig.timeout);
    Form<EligibilityExistingTTP> form = Form.form(EligibilityExistingTTP.class);

    if(Optional.ofNullable(key).isPresent()) {
        JsonNode debtType = key.get("data").get("eligibility-debt-type-form");
        JsonNode existingTtp = key.get("data").get("eligibility-existing-ttp-form");
        if(Optional.ofNullable(debtType).isPresent()) {
            if(Optional.ofNullable(existingTtp).isPresent())
                return F.Promise.promise(() ->
                        ok(existing_ttp.render(Form.form(EligibilityExistingTTP.class).fill(fromJson(existingTtp, EligibilityExistingTTP.class)))));
            else return F.Promise.promise(() -> ok(existing_ttp.render(form)));
        } else
            return F.Promise.promise(() -> redirect(routes.EligibilityController.present()));
    } else return F.Promise.promise(() -> ok(existing_ttp.render(form)));

}
 
开发者ID:hmrc,项目名称:self-service-time-to-pay-frontend-java,代码行数:18,代码来源:EligibilityController.java

示例3: validateExistingTTPValue

import play.data.Form; //导入方法依赖的package包/类
@Test
public void validateExistingTTPValue() {
    Map<String, String> formData = Maps.newHashMap();
    formData.put("existingTTP", "false");

    Form<EligibilityExistingTTP> eligibilityForm = Form.form(EligibilityExistingTTP.class);
    eligibilityForm = eligibilityForm.bind(formData);

    assertEquals(eligibilityForm.hasErrors(), false);
}
 
开发者ID:hmrc,项目名称:self-service-time-to-pay-frontend-java,代码行数:11,代码来源:EligibilityExistingTTPTest.java

示例4: errorOnInvalidTtpValue

import play.data.Form; //导入方法依赖的package包/类
@Test
public void errorOnInvalidTtpValue() {
    Map<String, String> formData = Maps.newHashMap();
    formData.put("existingTTP", "I don't know");

    Form<EligibilityExistingTTP> eligibilityForm = Form.form(EligibilityExistingTTP.class);
    eligibilityForm = eligibilityForm.bind(formData);

    assertEquals(eligibilityForm.hasErrors(), true);
}
 
开发者ID:hmrc,项目名称:self-service-time-to-pay-frontend-java,代码行数:11,代码来源:EligibilityExistingTTPTest.java

示例5: errorOnMissingTtpValue

import play.data.Form; //导入方法依赖的package包/类
@Test
public void errorOnMissingTtpValue() {
    Map<String, String> formData = Maps.newHashMap();

    Form<EligibilityExistingTTP> eligibilityForm = Form.form(EligibilityExistingTTP.class);
    eligibilityForm = eligibilityForm.bind(formData);

    assertEquals(eligibilityForm.hasErrors(), true);
}
 
开发者ID:hmrc,项目名称:self-service-time-to-pay-frontend-java,代码行数:10,代码来源:EligibilityExistingTTPTest.java

示例6: validateSelfAssessmentValue

import play.data.Form; //导入方法依赖的package包/类
@Test
public void validateSelfAssessmentValue() {
    Map<String, String> formData = Maps.newHashMap();
    formData.put("selfAssessmentDebt", "true");

    Form<EligibilityDebtType> eligibilityForm = Form.form(EligibilityDebtType.class);
    eligibilityForm = eligibilityForm.bind(formData);

    assertEquals(eligibilityForm.hasErrors(), false);
}
 
开发者ID:hmrc,项目名称:self-service-time-to-pay-frontend-java,代码行数:11,代码来源:EligibilityDebtTypeTest.java

示例7: validateOtherTaxDebtValue

import play.data.Form; //导入方法依赖的package包/类
@Test
public void validateOtherTaxDebtValue() {
    Map<String, String> formData = Maps.newHashMap();
    formData.put("otherTaxDebt", "true");

    Form<EligibilityDebtType> eligibilityForm = Form.form(EligibilityDebtType.class);
    eligibilityForm = eligibilityForm.bind(formData);

    assertEquals(eligibilityForm.hasErrors(), false);
}
 
开发者ID:hmrc,项目名称:self-service-time-to-pay-frontend-java,代码行数:11,代码来源:EligibilityDebtTypeTest.java

示例8: errorOnInvalidData

import play.data.Form; //导入方法依赖的package包/类
@Test
public void errorOnInvalidData() {
    Map<String, String> formData = Maps.newHashMap();

    Form<EligibilityDebtType> eligibilityForm = Form.form(EligibilityDebtType.class);
    eligibilityForm = eligibilityForm.bind(formData);

    assertEquals(eligibilityForm.hasErrors(), true);
}
 
开发者ID:hmrc,项目名称:self-service-time-to-pay-frontend-java,代码行数:10,代码来源:EligibilityDebtTypeTest.java

示例9: succeedWithValidData

import play.data.Form; //导入方法依赖的package包/类
@Test
public void succeedWithValidData() {
    Map<String, String> formData = Maps.newHashMap();
    formData.put("initialPayment", "5000");
    formData.put("paymentFrequency", "MONTHLY");

    Form<CalculatorInput> calculatorForm = Form.form(CalculatorInput.class);
    calculatorForm = calculatorForm.bind(formData);

    assertEquals(calculatorForm.hasErrors(), false);
}
 
开发者ID:hmrc,项目名称:self-service-time-to-pay-frontend-java,代码行数:12,代码来源:CalculatorInputTest.java

示例10: errorOnInvalidData

import play.data.Form; //导入方法依赖的package包/类
@Test
public void errorOnInvalidData() {
    Map<String, String> formData = Maps.newHashMap();

    Form<CalculatorInput> calculatorForm = Form.form(CalculatorInput.class);
    calculatorForm = calculatorForm.bind(formData);

    assertEquals(calculatorForm.hasErrors(), true);

    // add more scenarios here for data type errors
}
 
开发者ID:hmrc,项目名称:self-service-time-to-pay-frontend-java,代码行数:12,代码来源:CalculatorInputTest.java


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