src/main/java/org/ednovo/gooru/server/service/PlayerAppServiceImpl.java
/**
	 * Creates a Ratings given by the user by triggering Create Rating API.
	 * 
	 *  @param associateGooruOid {@link String}
	 *  @param starRatingValue {@link Integer}
	 *  
	 *  @return StarRating model object {@link StarRatingsDo} 
	 */
Creates a Ratings given by the user by triggering Create Rating API.




Creates a Ratings given by the user by triggering Create Rating API .
@Override
	public StarRatingsDo createStarRatings(String associateGooruOid,int starRatingValue,String userReview) {
		JsonRepresentation jsonRep=null;
		JSONObject jsonObject=null;
		try {
			 String url = UrlGenerator.generateUrl(getRestEndPoint(), UrlToken.CREATE_STAR_RATINGS, getLoggedInSessionToken());
			 JSONObject createStarRatingsJsonObj = new JSONObject();
			 createStarRatingsJsonObj.put(ASSOCIATE_GOORU_OID, associateGooruOid);
			 createStarRatingsJsonObj.put(SCORE, starRatingValue);
			 if(userReview!=null || !userReview.equals("")){
				 createStarRatingsJsonObj.put(FREE_TEXT, userReview);
			 }
			 createStarRatingsJsonObj.put("target",new JSONObject().put("value","content"));
			 createStarRatingsJsonObj.put("type",new JSONObject().put("value","star"));
			 System.out.println("--- create star -- "+url);
			 System.out.println("--- create str payload -- "+createStarRatingsJsonObj.toString()); 
			 JsonResponseRepresentation jsonResponseRep = ServiceProcessor.post(url,getRestUsername(), getRestPassword(), createStarRatingsJsonObj.toString());
			 jsonRep= jsonResponseRep.getJsonRepresentation();
			 jsonObject= jsonRep.getJsonObject();
		} catch (Exception e) {
		}
		return deserializeResourceStarRatings(jsonObject);
	}
@ Override public StarRatingsDo createStarRatings ( String associateGooruOid , int starRatingValue , String userReview ) { JsonRepresentation jsonRep = null ; JSONObject jsonObject = null ; try { String url = UrlGenerator . generateUrl ( getRestEndPoint ( ) , UrlToken . CREATE_STAR_RATINGS , getLoggedInSessionToken ( ) ) ; JSONObject createStarRatingsJsonObj = new JSONObject ( ) ; createStarRatingsJsonObj . put ( ASSOCIATE_GOORU_OID , associateGooruOid ) ; createStarRatingsJsonObj . put ( SCORE , starRatingValue ) ; if ( userReview != null || ! userReview . equals ( "" ) ) { createStarRatingsJsonObj . put ( FREE_TEXT , userReview ) ; } createStarRatingsJsonObj . put ( "target" , new JSONObject ( ) . put ( "value" , "content" ) ) ; createStarRatingsJsonObj . put ( "type" , new JSONObject ( ) . put ( "value" , "star" ) ) ; System . out . println ( "--- create star -- " + url ) ; System . out . println ( "--- create str payload -- " + createStarRatingsJsonObj . toString ( ) ) ; JsonResponseRepresentation jsonResponseRep = ServiceProcessor . post ( url , getRestUsername ( ) , getRestPassword ( ) , createStarRatingsJsonObj . toString ( ) ) ; jsonRep = jsonResponseRep . getJsonRepresentation ( ) ; jsonObject = jsonRep . getJsonObject ( ) ; } catch ( Exception e ) { } return deserializeResourceStarRatings ( jsonObject ) ; }
Creates a Ratings given by the user by triggering Create Rating API.
Creates a Ratings given by the user by triggering Create Rating API .