Package com.bugyal.imentor.server.data

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


    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);
   
    List<Opportunity> oList = mmi.getAllOppurtunities(seaker2);
    assertEquals(1, oList.size());
    assertEquals(o1, oList.get(0));
   
View Full Code Here


      throw new MeException("Cannot create already created participant");
    }

    Location location = new Location(o.getLatitude(), o.getLongitude(), o
        .getLocString(), o.getRadius());
    Opportunity oi = null;
    List<Participant> contacts = new ArrayList<Participant>();

    Participant participant = null;
    try {
      participant = pm.findParticipantByEmail(getUserId());
      if (participant != null) {
        contacts.add(participant);
      }
    } catch (MentorException e) {
      e.printStackTrace();
    }

    // TODO(raman): Understand why MentorException is not getting thrown.
    oi = om.createOpportunity(location, o.getSubjects(), o
        .getRequiredMentors(), contacts, o.getPriority(), o
        .getMessage(), participant);

    if (oi != null) {
      try {
        participant.addCreatedOpportuny(oi.getKey());
        pm.saveOpportunityToParticipant(participant.getKey(), oi
            .getKey(), false); // here false is to indicate it is
        // new opportunity
      } catch (Exception e) {
        e.printStackTrace();
      }
View Full Code Here

  public OpportunityVO updateOpportunity(OpportunityVO o) throws MeException {
    if (o.getId() == null) {
      throw new MeException("New opportunity, cannot update.");
    }

    Opportunity oi = null;
    Key key = KeyFactory.createKey(Opportunity.class.getSimpleName(), o
        .getId());

    try {
      oi = om.findById(key);
View Full Code Here

    Key opportunityKey = KeyFactory.createKey(Opportunity.class
        .getSimpleName(), id);
    List<MentorsResult> ownersNames = new ArrayList<MentorsResult>();
    MentorsResult tempowner = new MentorsResult();
    try {
      Opportunity opportunity = om.findById(opportunityKey);
      List<Participant> owners = pm.findParticipantsByIds(opportunity
          .getContacts());
      for (Participant p : owners) {
        tempowner.setName(p.getName());
        tempowner.setMentor(false); // No need to consider this value
        ownersNames.add(tempowner);
View Full Code Here

      Key key = KeyFactory.createKey(Opportunity.class.getSimpleName(),
          id);
      MentorsResult mentor = new MentorsResult();

      Participant user = pm.findParticipantByEmail(getUserId());
      Opportunity o = om.findById(key);

      if (o.getMentors().contains(user.getKey())) {
        isExisted = true;
      } else {
        isExisted = false;
      }

      List<Participant> participants = new ArrayList<Participant>();
      if (o.getMentors().size() != 0) {
        try {
          participants = pm.findParticipantsByIds(o.getMentors());
        } catch(Exception e) {}
        for (Participant p : participants) {
          mentor.setName(p.getName());
          mentor.setMentor(isMentor);
          result.add(mentor);
View Full Code Here

                  .getNeedSubjects(), 0));
        }
      }
      if (p.getMentoringOpportunities().size() != 0) {
        for (Key key : p.getMentoringOpportunities()) {
          Opportunity o = om.findById(key);
          result.add(new SearchResult(ValueObjectGenerator.create(o),
              o.getSubjects(), 0));
        }
      }
      return result;
    } catch (MentorException e) {
      e.printStackTrace();
View Full Code Here

          participant);

      if (r.nextFloat() < 0.1) {
        List<Participant> contacts = new ArrayList<Participant>();
        contacts.add(participant);
        Opportunity o = MentorManager.INSTANCE.getOpportunityManager()
            .createOpportunity(getRandomLocation(),
                getRandomList(), r.nextInt(7), contacts,
                r.nextInt(4), rs.nextString(), participant);
        for (int loc = 0; loc < o.getContacts().size(); loc++) {
          Participant p = MentorManager.INSTANCE
              .getParticipantManager().findById(
                  o.getContacts().get(loc));
          p.addCreatedOpportuny(o.getKey());
          MentorManager.INSTANCE.getParticipantManager().save(p);
        }
      }

    }
View Full Code Here

TOP

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

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.