本文整理汇总了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);
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}
示例9: setUp
import io.ebean.Ebean; //导入方法依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
super.setUp();
Ebean.deleteAll(Ebean.find(ExamEnrolment.class).findList());
}