Package org.fluxtream.core.domain

Examples of org.fluxtream.core.domain.CoachingBuddy


    @ApiOperation(value = "Retrieve information on the currently logged in's guest", response = GuestModel.class)
  public Response getCurrentGuest(@ApiParam(value="Include the guest's avatar?") @QueryParam("includeAvatar") final boolean includeAvatar,
                                    @ApiParam(value="Buddy to access username parameter (" + BuddiesService.BUDDY_TO_ACCESS_PARAM + ")", required=false) @QueryParam(BuddiesService.BUDDY_TO_ACCESS_PARAM) String buddyToAccessParameter) throws InstantiationException,
      IllegalAccessException, ClassNotFoundException {
        try{
            CoachingBuddy coachee;
            try { coachee = AuthHelper.getCoachee(buddyToAccessParameter, buddiesService);
            } catch (CoachRevokedException e) {return Response.status(403).entity("Sorry, permission to access this data has been revoked. Please reload your browser window").build();}
            Guest guest = ApiHelper.getBuddyToAccess(guestService, coachee);
            if (guest==null)
                return Response.status(401).entity("You are no longer logged in").build();
View Full Code Here


    private AvatarImageModel getAvatarImageModel(String buddyToAccessParameter, Guest guest) {
        AvatarImageModel avatarImage = new AvatarImageModel();
        String type = "none";
        String url;
        try {
            final CoachingBuddy coachee = AuthHelper.getCoachee(buddyToAccessParameter, buddiesService);
            if (coachee!=null)
                guest = guestService.getGuestById(coachee.guestId);
        }
        catch (CoachRevokedException e) {}
        if (guest.registrationMethod == Guest.RegistrationMethod.REGISTRATION_METHOD_FACEBOOK||
View Full Code Here

        Guest guest = AuthHelper.getGuest();
        JSONObject json = new JSONObject();
        String type = "none";
        String url;
        try {
            final CoachingBuddy coachee = AuthHelper.getCoachee();
            if (coachee!=null)
                guest = guestService.getGuestById(coachee.guestId);
        }
        catch (CoachRevokedException e) {
            // TODO: do something about this
View Full Code Here

     */
    public static void revokeCoach(final Long id, final CoachingBuddy coachee) {
        final Set<CoachingBuddy> buddies = viewees.get(id);
        if (buddies==null)
            return;
        CoachingBuddy toRemove = null;
        for (CoachingBuddy buddy : buddies) {
            if (buddy==null) continue;
            if (buddy.getId()==coachee.getId()) {
                toRemove = buddy;
                break;
View Full Code Here

    public static CoachingBuddy getCoachee(String buddyToAccessParameter, BuddiesService buddiesService) throws CoachRevokedException {
        if (buddyToAccessParameter==null || buddyToAccessParameter!=null&&buddyToAccessParameter.equals("self")) {
            as(null);
            return null;
        } else if (buddyToAccessParameter !=null&&!buddyToAccessParameter.equals("self")) {
            CoachingBuddy coachee;
            if (StringUtils.isNumeric(buddyToAccessParameter)) {
                final Long coacheeId = Long.valueOf(buddyToAccessParameter, 10);
                if (coacheeId==AuthHelper.getGuestId())
                    return null;
                coachee = buddiesService.getTrustingBuddy(getGuestId(), coacheeId);
View Full Code Here

    @Path("/all")
    @Produces({MediaType.APPLICATION_JSON})
    public Response getDataUpdates(@QueryParam("since") String since,
                                   @ApiParam(value="Buddy to access username parameter (" + BuddiesService.BUDDY_TO_ACCESS_PARAM + ")", required=false) @QueryParam(BuddiesService.BUDDY_TO_ACCESS_PARAM) String buddyToAccessParameter){
        try{
            CoachingBuddy coachee;
            try { coachee = AuthHelper.getCoachee(buddyToAccessParameter, buddiesService);
            } catch (CoachRevokedException e) {return Response.status(403).entity("Sorry, permission to access this data has been revoked. Please reload your browser window").build();}
            Guest guest = ApiHelper.getBuddyToAccess(guestService, coachee);
            if (guest==null)
                return Response.status(401).entity("You are no longer logged in").build();
View Full Code Here

    @ApiOperation(value = "Retrieve information about data shared with a given buddy",
            response = CoachModel.class, responseContainer = "Array")
    @Produces({MediaType.APPLICATION_JSON})
    public CoachModel getConnectorSharingInfo(@ApiParam(value="The buddy's username", required=true) @PathParam("username") String username) {
        final long guestId = AuthHelper.getGuestId();
        final CoachingBuddy coachingBuddy = buddiesService.getTrustedBuddy(guestId, username);
        final Set<SharedConnector> sharedConnectors = coachingBuddy.sharedConnectors;
        final List<ApiKey> apiKeys = guestService.getApiKeys(guestId);
        CoachModel coach = new CoachModel();
        List<SharedConnectorModel> connectors = new ArrayList<SharedConnectorModel>();
        for (ApiKey apiKey : apiKeys) {
View Full Code Here

TOP

Related Classes of org.fluxtream.core.domain.CoachingBuddy

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.