Package com.bugyal.imentor.server.data

Examples of com.bugyal.imentor.server.data.Participant


  public void testRankedCorrectly() {

    Ranker disSubRanker = new Ranker().addScorer(new DistanceScorer())
        .addScorer(new SubjectCorrelationScorer());

    Participant p = Participant.createParticipantForTest("abc",
        new Location(17.0, 75.12, "some-location", 40), "abc@ui.com", "100002992300278");
    disSubRanker.rank(sr1, p) ;
   
    assertEquals("name2",sr1.getAllResults().get(0).getP().getName());
    assertEquals("name3",sr1.getAllResults().get(1).getP().getName());
View Full Code Here


  }

  @Test
  public void testDistanceScorer() {
    Ranker subOnlyRanker = new Ranker().addScorer(new DistanceScorer());
    Participant p = Participant.createParticipantForTest("abc",
        new Location(17.0, 75.12, "some-location", 40), "abc@ui.com","100002992300278");
    subOnlyRanker.rank(sr1, p);

    assertEquals("name2", sr1.getAllResults().get(0).getP().getName());
    assertEquals("name3", sr1.getAllResults().get(1).getP().getName());
View Full Code Here

  @Test
  public void testSubjectScorer() {
    Ranker subOnlyRanker = new Ranker()
        .addScorer(new SubjectCorrelationScorer());
    Participant p = Participant.createParticipantForTest("abc",
        new Location(17.0, 75.0, "some-location", 40), "abc@ui.com", "100002992300278");
    subOnlyRanker.rank(sr1, p);

    assertEquals("name1", sr1.getAllResults().get(0).getP().getName());
    assertEquals("name3", sr1.getAllResults().get(1).getP().getName());
View Full Code Here

    subjects.add("CS");
   
    List<String> ss = new ArrayList<String>();
    ss.add("CS");
   
    Participant p = pmi.createParticipant("raman","male", TestLocations.GACHIBOWLI, "raman@bugyal.com", "100002992300278");
    List<Participant> plist = new ArrayList<Participant>();
    plist.add(p);
   
    Participant seaker = pmi.createParticipant("kumar", "male", TestLocations.BODUPPAL_10, "kumar@bugyal.com", "100002992300278");
    pmi.addHasKnowledge(seaker, Arrays.asList(new String[]{"CS"}), 6, seaker);
   
    Participant seaker2 = pmi.createParticipant("krk", "female", TestLocations.KONDAPUR, "krk@bugyal.com", "100002992300278");
    pmi.addHasKnowledge(seaker2, Arrays.asList(new String[]{"Math"}), 4, seaker2);
   
    Opportunity o1 = omi.createOpportunity(TestLocations.KPHB, subjects, 2, plist, 7, "", p);
    Opportunity o2 = omi.createOpportunity(TestLocations.KONDAPUR, ss, 4, plist, 6, "", p);
    Opportunity o3 = omi.createOpportunity(TestLocations.YUKSOM, subjects, 4, plist, 6, "", p);
View Full Code Here

    long start = qs.getCpuTimeInMegaCycles();
    long t = System.currentTimeMillis();
    SearchResponse response = null;
    try {
      long temp = t;
      Participant pi = pm.findParticipantByEmail(getUserId());
      long endtime = System.currentTimeMillis();
      LOG.info("For TOME findParticipantByEmail(getUserId()) "
          + (endtime - temp));
      if (pi == null) {
        return new SearchResponse();
      }
      response = filterList(pi.getLocation().getLat(), pi.getLocation()
          .getLon(), pi.getLoc().getLocationString(), pi.getLoc()
          .getActiveRadius(), pi.getHasSubjects(), pi
          .getNeedSubjects());

      response = filterMe(pi, response);

      feedRanker.rank(response, pi);
View Full Code Here

    return response;
  }

  public ParticipantVO getParticipantVOByEmailId() throws MeException {
    try {
      Participant participant = pm.findParticipantByEmail(getUserId());
      return ValueObjectGenerator.create(participant);
    } catch (MentorException e) {
      e.printStackTrace();
    }
    return null;
View Full Code Here

    try {
      List<SearchResult> has = new ArrayList<SearchResult>();
      List<SearchResult> need = new ArrayList<SearchResult>();

      long temp = System.currentTimeMillis();
      Participant pi = pm.findParticipantByEmail(getUserId());
      LOG.info("For Local Activity findParticipantByEmail(getUserId()) "
          + (System.currentTimeMillis() - temp));

      if (pi == null) {
        return response;
      }
      Location location = new Location(pi.getLocation().getLat(), pi
          .getLocation().getLon(), pi.getLoc().getLocationString(),
          pi.getLoc().getActiveRadius());

      temp = System.currentTimeMillis();
      List<Participant> participants = pm
          .searchParticipantsByLocation(location);
      LOG.info("For Local Activity searchParticipantsByLocation(location) "
              + (System.currentTimeMillis() - temp));
      for (Participant p : participants) {
        double distance = GeocellUtils.distance(pi.getLocation(), p
            .getLocation());
        has.add(new SearchResult(ValueObjectGenerator.create(p), true,
            p.getHasSubjects(), distance));
        need.add(new SearchResult(ValueObjectGenerator.create(p),
            false, p.getNeedSubjects(), distance));
      }

      temp = System.currentTimeMillis();
      List<Opportunity> opportunities = om.allOpportunites(location);
      LOG.info("For Local Activity allOpportunites(location) "
          + (System.currentTimeMillis() - temp));
      for (Opportunity o : opportunities) {
        need.add(new SearchResult(ValueObjectGenerator.create(o), o
            .getSubjects(), GeocellUtils.distance(pi.getLocation(),
            o.getLocation())));
      }
      response.setHas(has);
      response.setNeed(need);
      response = filterMe(pi, response);
View Full Code Here

    return result;
  }

  @Override
  public List<OpportunityVO> getOpportunitiesById() {
    Participant p = null;
    try {
      p = pm.findParticipantByEmail(getUserId());
      if (p == null) {
        return new ArrayList<OpportunityVO>();
      }
      List<Opportunity> opportunities = om.searchOpportunitiesByKey(p
          .getKey());
      return ValueObjectGenerator.createOpportunityVOs(opportunities);
    } catch (MentorException e) {
      e.printStackTrace();
    }
View Full Code Here

  }

  @Override
  public boolean addMentorAndMentee(Boolean isHas, String mentorMailId) {
    try {
      Participant mentor = pm.findParticipantByEmail(mentorMailId);
      Participant mentee = pm.findParticipantByEmail(getUserId());
      if (isHas) {
        PulseVO p = new PulseVO(mentee.getEmail(), mentee.getName(), mentee.getFacebookId(), mentee.getLoc().getLongitude(), mentee.getLoc().getLatitude(), mentee.getLoc().getLocationString(), State.mentee, mentor.getFacebookId());
        boolean pulsestatus = createParticipantPulse(p);
        boolean mentorstatus = pm.addMentorToMentee(mentor, mentee);
        if(pulsestatus && mentorstatus) {
          return true;
        }
        else {
          return false;
        }
      } else {
        PulseVO p = new PulseVO(mentee.getEmail(), mentee.getName(), mentee.getFacebookId(), mentee.getLoc().getLongitude(), mentee.getLoc().getLatitude(), mentee.getLoc().getLocationString(), State.mentor, mentor.getFacebookId());
        boolean pulsestatus = createParticipantPulse(p);
        boolean mentorstatus = pm.addMentorToMentee(mentee, mentor);
        if(pulsestatus && mentorstatus) {
          return true;
        }
View Full Code Here

  }

  @Override
  public boolean deleteMentorOrMentee(Boolean isHas, String mentorMailId) {
    try {
      Participant mentor = pm.findParticipantByEmail(mentorMailId);
      Participant mentee = pm.findParticipantByEmail(getUserId());
      if (isHas) {
        return pm.deleteMentorFromMentee(mentor, mentee);
      } else {
        return pm.deleteMentorFromMentee(mentee, mentor);
      }
View Full Code Here

TOP

Related Classes of com.bugyal.imentor.server.data.Participant

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.