Search in sources :

Example 11 with Quiz

use of com.remswork.project.alice.model.Quiz in project classify-system by anverliedoit.

the class QuizAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(QuizViewHolder holder, int position) {
    Quiz quiz = quizList.get(position);
    holder.setView(quiz, position);
}
Also used : Quiz(com.remswork.project.alice.model.Quiz)

Example 12 with Quiz

use of com.remswork.project.alice.model.Quiz in project classify-system by anverliedoit.

the class QuizAdapterF method onBindViewHolder.

@Override
public void onBindViewHolder(QuizViewHolder holder, int position) {
    Quiz quiz = quizList.get(position);
    holder.setView(quiz, position);
}
Also used : Quiz(com.remswork.project.alice.model.Quiz)

Example 13 with Quiz

use of com.remswork.project.alice.model.Quiz in project classify-system by anverliedoit.

the class QuizResource method getQuizList.

@GET
public Response getQuizList() {
    try {
        List<Quiz> quizList;
        QuizResourceLinks resourceLinks = new QuizResourceLinks(uriInfo);
        ClassResourceLinks classResourceLinks = new ClassResourceLinks(uriInfo);
        if (classId != 0 && termId != 0)
            quizList = quizService.getQuizListByClassId(classId, termId);
        else if (classId != 0)
            quizList = quizService.getQuizListByClassId(classId);
        else if (studentId != 0 && termId != 0)
            quizList = quizService.getQuizListByStudentId(studentId, termId);
        else if (studentId != 0)
            quizList = quizService.getQuizListByStudentId(studentId);
        else
            quizList = quizService.getQuizList();
        for (Quiz quiz : quizList) {
            quiz.addLink(resourceLinks.self(quiz.getId()));
            if (quiz.get_class() != null)
                quiz.get_class().addLink(classResourceLinks.self(quiz.get_class().getId()));
        }
        GenericEntity<List<Quiz>> entity = new GenericEntity<List<Quiz>>(quizList) {
        };
        return Response.status(Response.Status.OK).entity(entity).build();
    } catch (GradingFactorException e) {
        e.printStackTrace();
        Message message = new Message(404, "Not Found", e.getMessage());
        return Response.status(Response.Status.NOT_FOUND).entity(message).build();
    }
}
Also used : ClassResourceLinks(com.remswork.project.alice.resource.links.ClassResourceLinks) Quiz(com.remswork.project.alice.model.Quiz) Message(com.remswork.project.alice.model.support.Message) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) QuizResourceLinks(com.remswork.project.alice.resource.links.QuizResourceLinks) List(java.util.List)

Aggregations

Quiz (com.remswork.project.alice.model.Quiz)13 GradingFactorException (com.remswork.project.alice.exception.GradingFactorException)11 Message (com.remswork.project.alice.model.support.Message)8 ArrayList (java.util.ArrayList)6 AsyncTask (android.os.AsyncTask)4 Gson (com.google.gson.Gson)4 ClassResourceLinks (com.remswork.project.alice.resource.links.ClassResourceLinks)4 QuizResourceLinks (com.remswork.project.alice.resource.links.QuizResourceLinks)4 IOException (java.io.IOException)4 InputStream (java.io.InputStream)4 HttpURLConnection (java.net.HttpURLConnection)4 URL (java.net.URL)4 ExecutionException (java.util.concurrent.ExecutionException)4 JSONArray (org.json.JSONArray)4 JSONException (org.json.JSONException)4 Student (com.remswork.project.alice.model.Student)3 List (java.util.List)3 CardView (android.support.v7.widget.CardView)2 RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2