HTML and CSS Reference
In-Depth Information
bookRequest.setBookId(book);
bookRequest.setRequestTime((Long) result[3]);
bookRequest.setResponseTime((Long) result[4]);
bookRequest.setUserId(new MegaUser((String) result[5]));
bookRequests.add(bookRequest);
}
return bookRequests;
}
private UserGroup getUserGroup(String userID) {
Query query = em.createQuery("Select userGroup from UserGroup userGroup where userGroup.
userId.id=:userID", UserGroup.class);
query.setParameter("userID", userID);
UserGroup group;
try {
group = (UserGroup) query.getSingleResult();
} catch (NoResultException exception) {
throw new IllegalStateException(userID + " state is invalid as user does not belong to
any group!!!");
}
return group;
}
}
viewRequest method is used in order to view the topic requests for both the normal and administrator users. It
takes two parameters:
user ID: Represents the user ID that requests to view the topic requests.
status: Represents the status of the topic requests that will be retrieved. It can be one of
three values (1 for pending, 2 for rejected, and 3 for approved; these values are coded in the
Constants interface that is shown in Listing 13-14).
Listing 13-14. Constants Interface
package com.jsfprohtml5.megaapp.model;
public interface Constants {
public static int USER_GROUP = 1;
public static int ADMIN_GROUP = 2;
public static int PENDING_REQUEST = 1;
public static int REJECTED_REQUEST = 2;
public static int APPROVED_REQUEST = 3;
public static String APP_PDF_TYPE = "application/pdf";
}
Search WWH ::




Custom Search