Пример #1
0
 public static IUser GetUser(int userid) {
   IUser result = null;
   List<IUser> users = StatementFactory.getQuery().getUser(User.USER_ID, userid, 1);
   if (users != null && !users.isEmpty()) {
     result = users.get(0);
   }
   return result;
 }
Пример #2
0
 public static IGroup getGroup(int groupid) {
   List<IGroup> groups = StatementFactory.getQuery().getGroup(Group.GROUP_ID, groupid, 1);
   IGroup result = null;
   if (groups != null && !groups.isEmpty()) {
     result = groups.get(0);
   }
   return result;
 }
Пример #3
0
 /**
  * This function has two pharse. a. parse the url and turned it into a video object b. query to
  * see if we already have it
  *
  * @param url
  * @return <status, IVideo> For error code, 1. Constant.SUBMIT_URL_ERROR, null 2.
  *     Constant.SUBMIT_UNKNOWN_ERROR, parsed video object 3. Constant.SUBMIT_BEFORE, original
  *     video object 4. Constant.SUBMIT_SUCCESS, parsed video object
  */
 public static Pair<Integer, IVideo> getVideo(String url) {
   IVideoParser parser = GenericVideoParser.getGenericVideoParser();
   IVideo v = parser.parse(url);
   if (v != null) {
     ArrayList<String> conditions = new ArrayList<String>();
     ArrayList<Object> values = new ArrayList<Object>();
     conditions.add(DatabaseFieldName.VIDEO_RESIDENT_SITE);
     values.add(v.getResidentSite());
     conditions.add(DatabaseFieldName.VIDEO_SITE_SPECIFIC_ID);
     values.add(v.getSiteSpecificID());
     List<IVideo> videos = database.StatementFactory.getQuery().getVideo(conditions, values, 1);
     if (videos == null) {
       return new Pair<Integer, IVideo>(Constant.SUBMIT_UNKNOWN_ERROR, v);
     } else if (videos.isEmpty()) {
       return new Pair<Integer, IVideo>(Constant.SUBMIT_SUCCESS, v);
     } else if (!videos.isEmpty()) {
       return new Pair<Integer, IVideo>(Constant.SUBMIT_BEFORE, videos.get(0));
     }
   }
   return new Pair<Integer, IVideo>(Constant.SUBMIT_URL_ERROR, null);
 }
Пример #4
0
 public static IVideo getVideo(int id) {
   IVideo result = null;
   List<IVideo> videos = StatementFactory.getQuery().getVideo(Video.VIDEO_ID, id, 1);
   if (videos != null && !videos.isEmpty()) result = videos.get(0);
   return result;
 }