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


Java Ebean.deleteAll方法代码示例

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


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

示例1: setUp

import io.ebean.Ebean; //导入方法依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    Ebean.deleteAll(Ebean.find(ExamEnrolment.class).findList());
    exam = Ebean.find(Exam.class).where().eq("state", Exam.State.PUBLISHED).findList().get(0);
    user = Ebean.find(User.class, userId);
    user.setLanguage(Ebean.find(Language.class, "en"));
    user.update();
    room = Ebean.find(ExamRoom.class, 1L);
    room.setRoomInstructionEN("information in English here");
    room.update();
    enrolment = new ExamEnrolment();
    enrolment.setExam(exam);
    enrolment.setUser(user);
    enrolment.save();

    reservation = new Reservation();
    reservation.setUser(user);
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:21,代码来源:CalendarControllerTest.java

示例2: setUp

import io.ebean.Ebean; //导入方法依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    Ebean.deleteAll(Ebean.find(ExamEnrolment.class).findList());
    exam = Ebean.find(Exam.class).fetch("examSections").fetch("examSections.sectionQuestions").where().idEq(1L).findUnique();
    initExamSectionQuestions(exam);
    exam.setExamActiveStartDate(DateTime.now().minusDays(1));
    exam.setExamActiveEndDate(DateTime.now().plusDays(1));
    exam.setHash(HASH);
    exam.update();
    User user = Ebean.find(User.class, 1L);
    user.setLanguage(Ebean.find(Language.class, "en"));
    user.update();
    ExamRoom room = Ebean.find(ExamRoom.class, 1L);
    room.setExternalRef(ROOM_REF);
    room.getExamMachines().get(0).setIpAddress("127.0.0.1");
    room.getExamMachines().get(0).update();
    room.update();

    enrolment = new ExamEnrolment();
    enrolment.setExam(exam);
    enrolment.setUser(user);
    enrolment.save();
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:26,代码来源:ExternalExamControllerTest.java

示例3: setUp

import io.ebean.Ebean; //导入方法依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    Ebean.deleteAll(Ebean.find(ExamEnrolment.class).findList());
    exam = Ebean.find(Exam.class).fetch("examSections").fetch("examSections.sectionQuestions").where().idEq(1L).findUnique();
    initExamSectionQuestions(exam);

    user = Ebean.find(User.class, userId);
    ExamRoom room = Ebean.find(ExamRoom.class, 1L);
    machine = room.getExamMachines().get(0);
    machine.setIpAddress("127.0.0.1"); // so that the IP check won't fail
    machine.update();
    reservation.setMachine(machine);
    reservation.setUser(user);
    reservation.setStartAt(DateTime.now().minusMinutes(10));
    reservation.setEndAt(DateTime.now().plusMinutes(70));
    reservation.save();
    enrolment.setExam(exam);
    enrolment.setUser(user);
    enrolment.setReservation(reservation);
    enrolment.save();
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:24,代码来源:StudentExamControllerTest.java

示例4: updateExamRoomWorkingHours

import io.ebean.Ebean; //导入方法依赖的package包/类
@Restrict(@Group({"ADMIN"}))
public Result updateExamRoomWorkingHours() {
    JsonNode root = request().body().asJson();
    List<Long> roomIds = new ArrayList<>();
    for (JsonNode roomId : root.get("roomIds")) {
        roomIds.add(roomId.asLong());
    }
    List<ExamRoom> rooms = Ebean.find(ExamRoom.class).where().idIn(roomIds).findList();
    List<DefaultWorkingHours> blueprints = parseWorkingHours(root);
    for (ExamRoom examRoom : rooms) {
        List<DefaultWorkingHours> previous = examRoom.getDefaultWorkingHours();
        Ebean.deleteAll(previous);
        previous.clear();
        for (DefaultWorkingHours blueprint : blueprints) {
            DefaultWorkingHours copy = new DefaultWorkingHours();
            BeanUtils.copyProperties(blueprint, copy, "id", "room");
            copy.setRoom(examRoom);
            DateTime end = new DateTime(blueprint.getEndTime());
            int offset = DateTimeZone.forID(examRoom.getLocalTimezone()).getOffset(end);
            int endMillisOfDay = DateTimeUtils.resolveEndWorkingHourMillis(end, offset) - offset;
            copy.setEndTime(end.withMillisOfDay(endMillisOfDay));
            copy.setTimezoneOffset(offset);
            copy.save();
            previous.add(copy);
        }
        asyncUpdateRemote(examRoom);
    }
    return ok();
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:30,代码来源:RoomController.java

示例5: updateExamStartingHours

import io.ebean.Ebean; //导入方法依赖的package包/类
@Restrict(@Group({"ADMIN"}))
public Result updateExamStartingHours() {

    JsonNode root = request().body().asJson();
    List<Long> roomIds = new ArrayList<>();
    for (JsonNode roomId : root.get("roomIds")) {
        roomIds.add(roomId.asLong());
    }

    List<ExamRoom> rooms = Ebean.find(ExamRoom.class).where().idIn(roomIds).findList();

    for (ExamRoom examRoom : rooms) {

        if (examRoom == null) {
            return notFound();
        }
        List<ExamStartingHour> previous = Ebean.find(ExamStartingHour.class)
                .where().eq("room.id", examRoom.getId()).findList();
        Ebean.deleteAll(previous);

        JsonNode node = request().body().asJson();
        DateTimeFormatter formatter = DateTimeFormat.forPattern("dd.MM.yyyy HH:mmZZ");
        for (JsonNode hours : node.get("hours")) {
            ExamStartingHour esh = new ExamStartingHour();
            esh.setRoom(examRoom);
            // Deliberately use first/second of Jan to have no DST in effect
            DateTime startTime = DateTime.parse(hours.asText(), formatter).withDayOfYear(1);
            esh.setStartingHour(startTime.toDate());
            esh.setTimezoneOffset(DateTimeZone.forID(examRoom.getLocalTimezone()).getOffset(startTime));

            esh.save();
        }
        asyncUpdateRemote(examRoom);
    }
    return ok();
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:37,代码来源:RoomController.java

示例6: setUp

import io.ebean.Ebean; //导入方法依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    Ebean.deleteAll(Ebean.find(ExamEnrolment.class).findList());
    exam = Ebean.find(Exam.class, 1);
    user = Ebean.find(User.class, userId);
    enrolment = new ExamEnrolment();
    enrolment.setExam(exam);
    enrolment.setUser(user);
    reservation = new Reservation();
    reservation.setUser(user);
    room = Ebean.find(ExamRoom.class, 1L);
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:15,代码来源:EnrolmentControllerTest.java

示例7: onBeforeLogin

import io.ebean.Ebean; //导入方法依赖的package包/类
@Override
protected void onBeforeLogin() throws IOException {
    Ebean.deleteAll(Ebean.find(ExamEnrolment.class).findList());

    User user = Ebean.find(User.class, userId == null ? 3L : userId);
    ee = new ExternalExam();
    ee.setExternalRef(UUID.randomUUID().toString());
    ee.setHash(UUID.randomUUID().toString());
    ee.setCreated(DateTime.now());
    ee.setCreator(user);
    ee.setContent(EJson.parseObject(
            Files.asCharSource(new File("test/resources/enrolment.json"), Charset.forName("UTF-8")).read())
    );
    ExamRoom room = Ebean.find(ExamRoom.class, 1L);
    machine = room.getExamMachines().get(0);
    machine.setIpAddress("127.0.0.1"); // so that the IP check won't fail
    machine.update();
    reservation.setMachine(machine);
    reservation.setUser(user);
    reservation.setStartAt(DateTime.now().minusMinutes(10));
    reservation.setEndAt(DateTime.now().plusMinutes(70));
    reservation.setExternalUserRef(user.getEppn());
    reservation.setExternalRef("foobar");
    reservation.save();

    enrolment.setExternalExam(ee);
    enrolment.setUser(user);
    enrolment.setReservation(reservation);
    enrolment.save();

    ObjectMapper mapper = new ObjectMapper();
    String json = mapper.writeValueAsString(ee.getContent());
    JsonNode node = mapper.readTree(json);
    exam = JsonDeserializer.deserialize(Exam.class, node);
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:36,代码来源:ExternalStudentExamControllerTest.java

示例8: initialize

import io.ebean.Ebean; //导入方法依赖的package包/类
private void initialize(User other) throws Exception {
    Ebean.deleteAll(Ebean.find(ExamEnrolment.class).findList());
    exam = Ebean.find(Exam.class).fetch("examSections").fetch("examSections.sectionQuestions").where().idEq(1L).findUnique();
    initExamSectionQuestions(exam);
    exam.setExamActiveStartDate(DateTime.now().minusDays(1));
    exam.setExamActiveEndDate(DateTime.now().plusDays(1));
    exam.update();

    Long id = other == null ? userId : other.getId();

    if (id != null) {
        user = Ebean.find(User.class, id);
        user.setLanguage(Ebean.find(Language.class, "en"));
        user.update();
    }

    room = Ebean.find(ExamRoom.class, 1L);
    room.setExternalRef(ROOM_REF);
    room.getExamMachines().get(0).setIpAddress("127.0.0.1");
    room.getExamMachines().get(0).update();
    room.update();

    enrolment = new ExamEnrolment();
    enrolment.setExam(exam);
    enrolment.setUser(user);
    enrolment.save();
    GeneralSettings gs = new GeneralSettings();
    gs.setName("reservation_window_size");
    gs.setValue("60");
    gs.setId(3l);
    gs.save();
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:33,代码来源:ExternalCalendarInterfaceTest.java

示例9: setUp

import io.ebean.Ebean; //导入方法依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    Ebean.deleteAll(Ebean.find(ExamEnrolment.class).findList());
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:7,代码来源:StudentActionControllerTest.java


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