Package org.itcr.myguru.model

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


        // :: Find Recommendation
        int id = -1;
        try {
            id = Integer.parseInt(id_raw);
        } catch(Exception e) {}
        Recommendation recm = dao.findRecommendationById(id);
        if(recm == null) {
            result.setMessage("Recommendation not found");
            result.setStatus(-3);
            out.print(result);
            out.flush();
            out.close();
            return;
        }
        //  :: Check ownership
        if(recm.getAssignedTo().getId() != user.getId()) {
            result.setMessage("You are not owner");
            result.setStatus(-4);
        } else {
            // Return object
            result.setMessage("Success");
            result.setStatus(recm.getStatus());
           
            String answer = recm.getAnswer();
            if(answer == null) {
                answer = "";
            }
            result.setAnswer(answer);
           
            String link = recm.getLink();
            if(link == null) {
                link = "";
            }
            result.setLink(link);
        }
View Full Code Here

TOP

Related Classes of org.itcr.myguru.model.Recommendation

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.