Examples of Recommendation


Examples of org.corrib.s3b.recommendations.impl.Recommendation

       
        if(resultsArray != null) {       
          Set<Recommendation> tmp = new TreeSet<Recommendation>(resultsArray);

          while(tmp.size()> limit) {
            Recommendation toRemove = ((TreeSet<Recommendation>)tmp).first();
            tmp.remove(toRemove);
          }

          limitedResult = tmp;

          if(isOverall) {
            Set<Recommendation> tmp2 = new TreeSet<Recommendation>(resultsArray);
            for(Recommendation r : tmp2) {
              boolean wasFound = false;
              for(Recommendation r2 : overallRecommendation) {
                if(r2.getRecommendedItem().equals(r.getRecommendedItem())) {
                  overallRecommendation.remove(r2);
                  r2.setAccuracy(r2.getAccuracy() + weight*r.getAccuracy());
                  overallRecommendation.add(r2);
                  wasFound = true;
                  break;
                }
              }
              if(!wasFound) {
                overallRecommendation.add(new Recommendation(r.getRecommendedItem(), r.getAccuracy()*weight));
              }   
            }
          }
         
          if(limitedResult.size() > 0)
            prepareResult(limitedResult);
        }
        //-----------TEST--------------------
        for(Recommendation r : limitedResult)
          System.out.println(r);
        //!-----------TEST-------------------
       
        wholeResult[i] = type;
        wholeResult[i].setResultsArray((TreeSet<Recommendation>)limitedResult);
      } else {
        overallLimit = urpTable[i].getLimit();
      }     
    }
   
    if(isOverall && urpTable.length>1) {
     
      while(overallRecommendation.size() > overallLimit) {
        Recommendation toRemove = ((TreeSet<Recommendation>)overallRecommendation).first();
        overallRecommendation.remove(toRemove);
      }
     
      if(overallRecommendation.size() > 0){
        Recommendation highest = ((TreeSet<Recommendation>)overallRecommendation).last();
        float divider = highest.getAccuracy();
     
        for(Recommendation r : overallRecommendation)
          r.setAccuracy(r.getAccuracy() / divider);
      }
     
View Full Code Here

Examples of org.eurekastreams.server.domain.Recommendation

                setupRecommendation(3, "reco3");
            }

            private void setupRecommendation(final long id, final String recoName)
            {
                final Recommendation reco = context.mock(Recommendation.class, recoName);
                list.add(reco);
               
                allowing(reco).getId();
                will(returnValue(id));
View Full Code Here

Examples of org.eurekastreams.server.domain.Recommendation

    @Test
    public void representation() throws ResourceException, IOException
    {
        Variant variant = context.mock(Variant.class);
       
        final Recommendation recommendation =
            new Recommendation(SUBJECT_OPENSOCIAL_ID, AUTHOR_OPENSOCIAL_ID, RECO_TEXT);
        recommendation.setDate(RECO_DATE);
        final Recommendation recoMock = context.mock(Recommendation.class);
        final List<String> openSocialIds = new ArrayList<String>();
        openSocialIds.add(AUTHOR_OPENSOCIAL_ID);
        openSocialIds.add(SUBJECT_OPENSOCIAL_ID);
       
        context.checking(new Expectations()
View Full Code Here

Examples of org.eurekastreams.server.domain.Recommendation

            log.debug("RecommendationsCollectionResource POST" + json);

            JSONObject jsonReco = JSONObject.fromObject(json);
            JSONObject jsonAuthor = jsonReco.getJSONObject(AUTHOR_KEY);
            JSONObject jsonSubject = jsonReco.getJSONObject(SUBJECT_KEY);
            Recommendation recommendation = new Recommendation(jsonSubject.getString(ID_KEY),
                    jsonAuthor.getString(ID_KEY), jsonReco.getString(TEXT_KEY));

            getRecommendationMapper().insert(recommendation);
           
            Map<String, Person> people = getPeopleInfoForRecommendations(recommendation);
           
            JSONObject recoJSON = convertRecoToJSON(recommendation,
                    people.get(recommendation.getAuthorOpenSocialId()),
                    people.get(recommendation.getSubjectOpenSocialId()));
           
            getAdaptedResponse().setEntity(recoJSON.toString(),
                    MediaType.APPLICATION_JSON);
        }
        catch (IOException e)
View Full Code Here

Examples of org.eurekastreams.server.domain.Recommendation

     */
    @Override
    public Representation represent(final Variant variant) throws ResourceException
    {
        log.debug("Attempting to GET recommendation by Id: " + recommendationId);
        Recommendation reco = getRecommendationMapper().findById(recommendationId);
       
        if (null == reco)
        {
            throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND);
        }
       
        Map<String, Person> people = getPeopleInfoForRecommendations(reco);
       
        JSONObject jsonReco = convertRecoToJSON(reco,
                people.get(reco.getAuthorOpenSocialId()),
                people.get(reco.getSubjectOpenSocialId()));
       
        Representation rep = new StringRepresentation(jsonReco.toString(), MediaType.APPLICATION_JSON);
       
        rep.setExpirationDate(new Date(0L));
       
View Full Code Here

Examples of org.glassfish.jersey.examples.rx.domain.Recommendation

        });

        return Observable.zip(recommended, forecasts, calculations, new Func3<Destination, Forecast, Calculation, Recommendation>() {
            @Override
            public Recommendation call(final Destination destination, final Forecast forecast, final Calculation calculation) {
                return new Recommendation(destination.getDestination(), forecast.getForecast(), calculation.getPrice());
            }
        }).toList();
    }
View Full Code Here

Examples of org.glassfish.jersey.examples.rx.domain.Recommendation

        }

        // Recommendations.
        final List<Recommendation> recommendations = new ArrayList<>(recommended.size());
        for (int i = 0; i < recommended.size(); i++) {
            recommendations.add(new Recommendation(recommended.get(i).getDestination(), forecasts.get(i).getForecast(),
                    calculations.get(i).getPrice()));
        }

        response.setRecommended(recommendations);
        response.setProcessingTime((System.nanoTime() - time) / 1000000);
View Full Code Here

Examples of org.glassfish.jersey.examples.rx.domain.Recommendation

                        }

                        // Recommendations.
                        final List<Recommendation> recommendations = new ArrayList<>(recommended.size());
                        for (int i = 0; i < recommended.size(); i++) {
                            recommendations.add(new Recommendation(recommended.get(i).getDestination(),
                                    forecasts.get(i).getForecast(), calculations.get(i).getPrice()));
                        }
                        response.setRecommended(recommendations);

                        outerLatch.countDown();
View Full Code Here

Examples of org.glassfish.jersey.examples.rx.domain.Recommendation

                    public ListenableFuture<List<Recommendation>> apply(final List<Destination> input) throws Exception {
                        final List<Recommendation> recommendations = Lists.newArrayList(Lists.transform(input,
                                new Function<Destination, Recommendation>() {
                                    @Override
                                    public Recommendation apply(final Destination input) {
                                        return new Recommendation(input.getDestination(), null, 0);
                                    }
                                }));
                        return Futures.immediateFuture(recommendations);
                    }
                });
View Full Code Here

Examples of org.itcr.myguru.model.Recommendation

            return;
        }
       
        // Business logic
        //  :: Find Recommendation for id
        Recommendation rec = dao.findRecommendationById(id);
        if(rec == null) {
            out.print(-2);
            out.flush();
            out.close();
            return;
        }
        // :: Check that Recommendation isn't already answered
        if(rec.getStatus() != Recommendation.STATUS_NEW) {
            out.print(-3);
            out.flush();
            out.close();
            return;
        }
        //  :: Set data and save
        rec.setAnswer(answer);
        if(link != null) {
            rec.setLink(link);
        }
        rec.setStatus(Recommendation.STATUS_ANSWERED);
        try {
            dao.persistChanges(rec);
            out.print(0);
        } catch(Exception e) {
            out.print(-4);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.