Examples of Guest


Examples of org.drools.planner.examples.manners2009.domain.Guest

            List<HobbyPractician> hobbyPracticianList = new ArrayList<HobbyPractician>(guestSize * 3);
            Map<String, Job> jobMap = new HashMap<String, Job>(JobType.values().length * 5);
            int jobNextId = 0;
            int hobbyPracticianJobId = 0;
            for (int i = 0; i < guestSize; i++) {
                Guest guest = new Guest();
                guest.setId((long) i);
                String line = bufferedReader.readLine();
                String[] lineTokens = line.split("\\,");
                if (lineTokens.length < 5) {
                    throw new IllegalArgumentException("Read line (" + line
                            + ") is expected to contain at least 5 tokens.");
                }
                guest.setCode(lineTokens[0].trim());
                JobType jobType = JobType.valueOfCode(lineTokens[1].trim());
                String jobName = lineTokens[2].trim();
                String jobMapKey = jobType + "/" + jobName;
                Job job = jobMap.get(jobMapKey);
                if (job == null) {
                    job = new Job();
                    job.setId((long) jobNextId);
                    jobNextId++;
                    job.setJobType(jobType);
                    job.setName(jobName);
                    jobMap.put(jobMapKey, job);
                }
                guest.setJob(job);
                guest.setGender(Gender.valueOfCode(lineTokens[3].trim()));
                List<HobbyPractician> hobbyPracticianOfGuestList = new ArrayList<HobbyPractician>(lineTokens.length - 4);
                for (int j = 4; j < lineTokens.length; j++) {
                    HobbyPractician hobbyPractician = new HobbyPractician();
                    hobbyPractician.setId((long) hobbyPracticianJobId);
                    hobbyPracticianJobId++;
                    hobbyPractician.setGuest(guest);
                    hobbyPractician.setHobby(Hobby.valueOfCode(lineTokens[j].trim()));
                    hobbyPracticianOfGuestList.add(hobbyPractician);
                    hobbyPracticianList.add(hobbyPractician);
                }
                guest.setHobbyPracticianList(hobbyPracticianOfGuestList);
                guestList.add(guest);
            }
            manners2009.setJobList(new ArrayList<Job>(jobMap.values()));
            manners2009.setGuestList(guestList);
            manners2009.setHobbyPracticianList(hobbyPracticianList);
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

  @PersistenceContext
  EntityManager em;
 
  public UserDetails loadUserByUsername(String username)
      throws UsernameNotFoundException {
    final Guest guest = JPAUtils.findUnique(em, Guest.class,
        "guest.byUsername", username);
    if (guest == null)
      throw new UsernameNotFoundException(username + " Not Found");
    FlxUserDetails user = new FlxUserDetails(guest);
    return user;
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

    @Produces({MediaType.APPLICATION_JSON})
    @ApiOperation(value = "Get the user's photos for a specific date", responseContainer = "Array", response = PhotoModel.class)
    public Response getPhotosForDate(@ApiParam(value="Username (must be currently logged in user's username)", required=true) @PathParam("username") String username,
                                     @ApiParam(value="Date (yyyy-mm-dd)", required=true) @PathParam("date") String date){
        try{
            Guest guest = guestService.getGuest(username);
            if (AuthHelper.getGuest().getId()!=guest.getId())
                throw new RuntimeException("Attempt to access another user's photos");
            DayMetadata dayMeta = metadataService.getDayMetadata(guest.getId(), date);
            return Response.ok(gson.toJson(getPhotos(guest, dayMeta.getTimeInterval()))).build();
        } catch (Exception e){
            return Response.serverError().entity("Could not get guest addresses: " + e.getMessage()).build();
        }
    }
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

        try{
            Calendar c = Calendar.getInstance();
            c.set(Calendar.YEAR,year);
            c.set(Calendar.WEEK_OF_YEAR,week);
            c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
            Guest guest = guestService.getGuest(username);
            if (AuthHelper.getGuest().getId()!=guest.getId())
                throw new RuntimeException("Attempt to access another user's photos");
            DecimalFormat datePartFormat = new DecimalFormat("00");
            DayMetadata dayMetaStart = metadataService.getDayMetadata(guest.getId(), year + "-" + datePartFormat.format(c.get(Calendar.MONTH) + 1) +
                                                                                          "-" + datePartFormat.format(c.get(Calendar.DAY_OF_MONTH)));
            int newDay = c.get(Calendar.DAY_OF_YEAR) + 6;
            if (newDay > (isLeapYear(year) ? 366 : 365)){
                newDay -= isLeapYear(year) ? 366 : 365;
                year += 1;
                c.set(Calendar.YEAR,year);
            }
            c.set(Calendar.DAY_OF_YEAR,newDay);
            DayMetadata dayMetaEnd = metadataService.getDayMetadata(guest.getId(), year + "-" + datePartFormat.format(c.get(Calendar.MONTH) + 1) +
                                                                                          "-" + datePartFormat.format(c.get(Calendar.DAY_OF_MONTH)));
            return Response.ok(gson.toJson(getPhotos(guest, new SimpleTimeInterval(dayMetaStart.start,dayMetaEnd.end,TimeUnit.WEEK,dayMetaStart.getTimeInterval().getMainTimeZone())))).build();
        } catch (Exception e){
            return Response.serverError().entity("Could not get photos: " + e.getMessage()).build();
        }
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

    @ApiOperation(value = "Get the user's photos for an entire year", responseContainer = "Array", response = PhotoModel.class)
    public Response getPhotosForYear(@ApiParam(value="Username (must be currently logged in user's username)", required=true) @PathParam("username") String username,
                                   @ApiParam(value="Year", required=true) @PathParam("year") int year){
        try{

            Guest guest = guestService.getGuest(username);
            if (AuthHelper.getGuest().getId()!=guest.getId())
                throw new RuntimeException("Attempt to access another user's photos");
            DayMetadata dayMetaStart = metadataService.getDayMetadata(guest.getId(), year + "-01-01");

            DayMetadata dayMetaEnd = metadataService.getDayMetadata(guest.getId(), year + "-12-31");
            return Response.ok(gson.toJson(getPhotos(guest, new SimpleTimeInterval(dayMetaStart.start,dayMetaEnd.end,TimeUnit.YEAR,dayMetaStart.getTimeInterval().getMainTimeZone())))).build();
        } catch (Exception e){
            return Response.serverError().entity("Could not get photos: " + e.getMessage()).build();
        }
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

        if (!parse.isInParseGuestList(event.updateInfo.getGuestId()))
            return;
        final StringBuilder msgAtts = new StringBuilder("module=events component=DataReceivedEventListener action=handleEvent");
        final Connector connector = event.updateInfo.apiKey.getConnector();
        final String connectorName = connector.getName();
        final Guest guest = guestService.getGuestById(event.updateInfo.getGuestId());
        final StringBuilder sb = new StringBuilder(msgAtts)
                .append(" connector=").append(connectorName)
                .append(" eventType=").append(event.objectTypes)
                .append(" date=").append(event.date)
                .append(" guestId=").append(event.updateInfo.getGuestId());
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

      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();
            GuestModel guestModel = new GuestModel(guest, coachee!=null);
            if (includeAvatar)
                guestModel.avatar = getAvatarImageModel(buddyToAccessParameter, guest);
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

  public Object getCurrentGuest() throws InstantiationException,
      IllegalAccessException, ClassNotFoundException {
        try{
            long guestId = AuthHelper.getGuestId();

            Guest guest = guestService.getGuestById(guestId);
            GuestModel guestModel = new GuestModel(guest, false);

            return guestModel;
        }
        catch (Exception e){
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

    @Path("/avatarImage")
    @Produces({MediaType.APPLICATION_JSON})
    @ApiOperation(value = "Retrieve the avatar (gravatar) of the currently logged in's guest", response = String.class)
    @Deprecated
    public String getAvatarImage() {
        Guest guest = AuthHelper.getGuest();
        JSONObject json = new JSONObject();
        String type = "none";
        String url;
        try {
            final CoachingBuddy coachee = AuthHelper.getCoachee();
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

    @Produces({MediaType.APPLICATION_JSON})
    @ApiOperation(value = "Retrieve the currently logged in guest's list of coachees", responseContainer = "Array",
            response = GuestModel.class)
    @Deprecated
    public List<GuestModel> getCoachees() {
        Guest guest = AuthHelper.getGuest();
        final List<Guest> coachees = buddiesService.getTrustedBuddies(guest.getId());
        final List<GuestModel> coacheeModels = new ArrayList<GuestModel>();
        for (Guest coachee : coachees)
            coacheeModels.add(new GuestModel(coachee, true));
        return coacheeModels;
    }
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.