/*
   * (non-Javadoc)
   *
   * @see ca.unb.cs.pcsf.db.DBAccessService#getCreatorById(java.lang.String)
   */
  public Creator getCreatorById(String id) {
    logger.debug(LOGPRE + "getCreatorById() start" + LOGPRE);

    Creator creator = new Creator();
    String selectRequest = "select * from `" + DOMAIN_CREATOR + "`";
    List<Item> items = this.getDataFromDomain(selectRequest);
    Item findItem = new Item();

    if (!items.isEmpty()) {
      for (Item item : items) {
        if (item.getName().equals(id)) {
          findItem = item;
          break;
        }
      }
    }

    if (findItem != null) {
      creator.setId(findItem.getName());
      for (Attribute attribute : findItem.getAttributes()) {
        if (attribute.getName().equals(CREATOR_ATTRIBUTE_NAME))
          creator.setName(attribute.getValue());
        if (attribute.getName().equals(CREATOR_ATTRIBUTE_PASSWORD))
          creator.setPassword(attribute.getValue());
        if (attribute.getName().equals(CREATOR_ATTRIBUTE_EMAIL))
          creator.setEmail(attribute.getValue());
      }
    }

    logger.debug(LOGPRE + "getCreatorById() end" + LOGPRE);
    return creator;
  }
  /*
   * (non-Javadoc)
   *
   * @see ca.unb.cs.pcsf.db.DBAccessService#getParticipantById(java.lang.String)
   */
  public Participant getParticipantById(String participantId) {
    logger.debug(LOGPRE + "getParticipantById() start" + LOGPRE);

    Participant participant = new Participant();
    String selectRequest = "select * from `" + DOMAIN_PARTICIPANT + "`";
    List<Item> items = this.getDataFromDomain(selectRequest);
    Item findItem = new Item();

    if (!items.isEmpty()) {
      for (Item item : items) {
        if (item.getName().equals(participantId)) {
          findItem = item;
          break;
        }
      }
    }

    if (findItem != null) {
      participant.setId(findItem.getName());
      for (Attribute attribute : findItem.getAttributes()) {
        if (attribute.getName().equals(PARTICIPANT_ATTRIBUTE_NAME))
          participant.setName(attribute.getValue());
        if (attribute.getName().equals(PARTICIPANT_ATTRIBUTE_EMAIL))
          participant.setEmail(attribute.getValue());
        if (attribute.getName().equals(PARTICIPANT_ATTRIBUTE_COLLABORATION_ID))
          participant.setCollaborationId(attribute.getValue());
        if (attribute.getName().equals(PARTICIPANT_ATTRIBUTE_IS_REG))
          participant.setIsReg(attribute.getValue());
      }
    }

    logger.debug(LOGPRE + "getParticipantById() end" + LOGPRE);
    return participant;
  }
  private void invalidateCustoms(String dateTime) {
    String invalidsNextToken = null;
    do {
      SelectRequest invalidsRequest =
          new SelectRequest(
              "select `itemName()` from `"
                  + AdWhirlUtil.DOMAIN_CUSTOMS_INVALID
                  + "` where dateTime < '"
                  + dateTime
                  + "'");
      invalidsRequest.setNextToken(invalidsNextToken);
      try {
        SelectResult invalidsResult = sdb.select(invalidsRequest);
        invalidsNextToken = invalidsResult.getNextToken();
        List<Item> invalidsList = invalidsResult.getItems();

        for (Item item : invalidsList) {
          String aid = item.getName();
          deleteInvalid(AdWhirlUtil.DOMAIN_CUSTOMS_INVALID, aid);
        }
      } catch (Exception e) {
        AdWhirlUtil.logException(e, log);

        // Eventually we'll get a 'stale request' error and need to start over.
        invalidsNextToken = null;
      }
    } while (invalidsNextToken != null);
  }
  /*
   * (non-Javadoc)
   *
   * @see ca.unb.cs.pcsf.db.PcsfSimpleDBAccess#isParticipantExist(java.lang.String)
   */
  public boolean isParticipantExist(String participantId) {
    logger.debug(LOGPRE + "isParticipantExist() start" + LOGPRE);
    String selectRequest = "select * from `" + DOMAIN_PARTICIPANT + "`";
    List<Item> items = this.getDataFromDomain(selectRequest);
    Item findItem = null;

    if (!items.isEmpty()) {
      for (Item item : items) {
        if (item.getName().equals(participantId)) {
          findItem = item;
          break;
        }
      }
    }

    if (findItem == null) {
      logger.info("Participant <" + participantId + "> doesn't exist");
      logger.debug(LOGPRE + "isParticipantExist() end" + LOGPRE);
      return false;
    } else {
      logger.info("Participant <" + participantId + "> exists");
      logger.debug(LOGPRE + "isParticipantExist() end" + LOGPRE);
      return true;
    }
  }
  /*
   * (non-Javadoc)
   *
   * @see ca.unb.cs.pcsf.db.DBAccessService#getCreatorByName(java.lang.String)
   */
  public Creator getCreatorByName(String userName) {
    logger.debug(LOGPRE + "getCreatorByName() start" + LOGPRE);

    Creator creator = new Creator();
    String selectRequest =
        "select * from `"
            + DOMAIN_CREATOR
            + "` where "
            + CREATOR_ATTRIBUTE_NAME
            + " = '"
            + userName
            + "'";
    Item item = this.getDataFromDomain(selectRequest).get(0);

    creator.setId(item.getName());
    for (Attribute attribute : item.getAttributes()) {
      if (attribute.getName().equals(CREATOR_ATTRIBUTE_NAME)) creator.setName(attribute.getValue());
      if (attribute.getName().equals(CREATOR_ATTRIBUTE_PASSWORD))
        creator.setPassword(attribute.getValue());
      if (attribute.getName().equals(CREATOR_ATTRIBUTE_EMAIL))
        creator.setEmail(attribute.getValue());
    }

    logger.debug(LOGPRE + "getCreatorByName() end" + LOGPRE);
    return creator;
  }
  private boolean checkRound() {
    System.out.println("Start " + current);

    // Add to SimpleDB
    addMembership();

    // Build list of servers
    SelectRequest selectRequest = new SelectRequest("select * from " + simpleDBDomain);
    List<Server> ss = new ArrayList<Server>();
    for (Item item : sdb.select(selectRequest).getItems()) {
      ss.add(new Server(item.getName()));
    }

    if (ss.size() > 0) {
      // Probe random server and remove if inactive
      int i = r.nextInt(ss.size());
      Server s = ss.get(i);
      System.out.println("Checking " + s);
      // if(!current.equals(s)) {
      if (!probe(s)) {
        ss.remove(i);
      }
      // }
      // Replace servers with new list
      Collections.shuffle(ss, r);
      writelock.lock();
      servers = ss;
      writelock.unlock();
    }

    System.out.println("End");
    return true;
  }
  public Item unmarshall(StaxUnmarshallerContext context) throws Exception {
    Item item = new Item();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument()) targetDepth += 2;

    while (true) {
      XMLEvent xmlEvent = context.nextEvent();
      if (xmlEvent.isEndDocument()) return item;

      if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
        if (context.testExpression("Name", targetDepth)) {
          item.setName(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("Name/@encoding", targetDepth)) {
          item.setAlternateNameEncoding(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("Attribute", targetDepth)) {
          item.getAttributes().add(AttributeStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return item;
        }
      }
    }
  }
    @Override
    protected TreeMap<Float, DropsiteLocation> doInBackground(
        android.location.Location... location) {

      TreeMap<Float, DropsiteLocation> locations = new TreeMap<Float, DropsiteLocation>();

      try {

        if (location[0] != null) {
          android.location.Location currentLocation = location[0];

          SelectResult result =
              SimpleDB.getInstance()
                  .select(new SelectRequest("select * from `Dropsites` limit 25"));
          for (Item dropsite : result.getItems()) {
            android.location.Location dropsiteLocation =
                new android.location.Location(currentLocation.getProvider());

            DropsiteLocation internalDropsiteLocation = new DropsiteLocation();
            internalDropsiteLocation.setId(dropsite.getName());

            // used to temporarily store hours of open and close for each location
            Hashtable<Integer, String> dateOpen = new Hashtable<Integer, String>();
            Hashtable<Integer, String> dateClose = new Hashtable<Integer, String>();

            for (Attribute attribute : dropsite.getAttributes()) {

              if (attribute.getName().equalsIgnoreCase("location"))
                internalDropsiteLocation.setLocation(attribute.getValue());
              if (attribute.getName().equalsIgnoreCase("description"))
                internalDropsiteLocation.setDescription(attribute.getValue());

              if (attribute.getName().equalsIgnoreCase("start_collection"))
                internalDropsiteLocation.setDateOpen(DateTime.parse(attribute.getValue()));
              if (attribute.getName().equalsIgnoreCase("end_collection"))
                internalDropsiteLocation.setDateClose(DateTime.parse(attribute.getValue()));

              if (attribute.getName().equalsIgnoreCase("lat"))
                dropsiteLocation.setLatitude(Double.parseDouble(attribute.getValue()));
              if (attribute.getName().equalsIgnoreCase("lng"))
                dropsiteLocation.setLongitude(Double.parseDouble(attribute.getValue()));

              if (attribute.getName().equalsIgnoreCase("city"))
                internalDropsiteLocation.setCityCode(attribute.getValue());
            }

            // store the location of the lot
            internalDropsiteLocation.setPoint(
                new LatLng(dropsiteLocation.getLatitude(), dropsiteLocation.getLongitude()));

            // save it to our locations listing to return back to the consumer
            locations.put(currentLocation.distanceTo(dropsiteLocation), internalDropsiteLocation);
          }
        }
      } catch (Exception e) {
        Log.e("GetDropsitesTask", "Failure attempting to get locations", e);
      }

      return locations;
    }
  public static List<String> collectItemNames(List<Item> items) {
    if (items.isEmpty()) {
      return Collections.emptyList();
    }

    List<String> ids = new LinkedList<String>();
    for (Item item : items) {
      ids.add(item.getName());
    }
    return ids;
  }
 public TransactionSnapshot(Item item) {
   this.snapshotId = Long.valueOf(item.getName());
   for (Attribute attr : item.getAttributes()) {
     if (attr.getName().equals(TICKER)) {
       this.ticker = attr.getValue();
     } else if (attr.getName().equals(STOCK_PRICE)) {
       this.stockPrice = Double.parseDouble(attr.getValue());
     } else if (attr.getName().equals(NUM_OF_STOCKS)) {
       this.numOfStocks = Integer.parseInt(attr.getValue());
     } else if (attr.getName().equals(SP_500_PRICE)) {
       this.sp500Price = Double.parseDouble(attr.getValue());
     }
   }
 }
  /*
   * (non-Javadoc)
   *
   * @see ca.unb.cs.pcsf.db.DBAccessService#getCollaborationsByCreatorId(java.lang.String)
   */
  public List<Collaboration> getCollaborationsByCreatorId(String creatorId) {
    logger.debug(LOGPRE + "getCollaborationsByCreatorId() start" + LOGPRE);

    List<Collaboration> collaborations = new ArrayList<Collaboration>();
    String selectExpression =
        "select * from `"
            + DOMAIN_COLLABORATION
            + "` where "
            + COLLABORATION_ATTRIBUTE_CREATOR_ID
            + "='"
            + creatorId
            + "'";
    List<Item> items = this.getDataFromDomain(selectExpression);

    if (!items.isEmpty()) {
      for (Item item : items) {
        Collaboration collaboration = new Collaboration();
        List<String> users = new ArrayList<String>();
        List<Participant> participants = new ArrayList<Participant>();
        collaboration.setId(item.getName());
        for (Attribute attribute : item.getAttributes()) {
          if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_NAME))
            collaboration.setName(attribute.getValue());
          if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_CREATOR_ID))
            collaboration.setCreatorId(attribute.getValue());
          if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_CURRENT_STATE))
            collaboration.setCurrentState(attribute.getValue());
          if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_PARTICIPANT))
            users.add(attribute.getValue());
          if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_WORKFLOW_MODEL))
            collaboration.setWorkflowModel(attribute.getValue());
        }

        for (String user : users) {
          Participant p = this.getParticipantByNameAndCollaborationId(user, collaboration.getId());
          participants.add(p);
        }

        collaboration.setParticipants(participants);
        collaborations.add(collaboration);
      }
    }

    logger.debug(LOGPRE + "getCollaborationsByCreatorId() end" + LOGPRE);
    return collaborations;
  }
  /*
   * (non-Javadoc)
   *
   * @see ca.unb.cs.pcsf.db.DBAccessService#getAllParticipantIds()
   */
  public List<String> getAllParticipantIds() {
    logger.debug(LOGPRE + "getAllParticipantIds() start" + LOGPRE);
    logger.debug("Getting all participant ids");

    List<String> participantIds = new ArrayList<String>();

    String selectExpression = "select * from `" + DOMAIN_PARTICIPANT + "`";
    List<Item> items = this.getDataFromDomain(selectExpression);
    if (!items.isEmpty()) {
      for (Item item : items) {
        participantIds.add(item.getName());
      }
    }

    logger.debug(LOGPRE + "getAllParticipantIds() end" + LOGPRE);
    return participantIds;
  }
  /*
   * (non-Javadoc)
   *
   * @see ca.unb.cs.pcsf.db.DBAccessService#getAllCollaborationIds()
   */
  public List<String> getAllCollaborationIds() {
    logger.debug(LOGPRE + "getAllCollaborationIds() start" + LOGPRE);
    logger.debug("Getting all collaboration ids");

    List<String> collaborationIds = new ArrayList<String>();

    String selectExpression = "select * from `" + DOMAIN_COLLABORATION + "`";
    List<Item> items = this.getDataFromDomain(selectExpression);
    if (!items.isEmpty()) {
      for (Item item : items) {
        collaborationIds.add(item.getName());
      }
    }

    logger.debug(LOGPRE + "getAllCollaborationIds() end" + LOGPRE);
    return collaborationIds;
  }
 @Override
 protected List<?> buildRow(Item item) throws TranslatorException {
   Map<String, List<String>> valueMap = createAttributeMap(item.getAttributes());
   List row = new ArrayList();
   Object[] results = new Object[valueMap.size()];
   int i = 0;
   for (String attributeName : valueMap.keySet()) {
     if (SimpleDBMetadataProcessor.isItemName(attributeName)) {
       results[i++] = item.getName();
       continue;
     }
     List<String> value = valueMap.get(attributeName);
     results[i++] = (value.size() == 1) ? value.get(0) : value.toString();
   }
   row.add(results);
   return row;
 }
 public static List<String> collectAttributeValues(Item item, String attributeName) {
   List<String> ids = new LinkedList<String>();
   for (Attribute attribute : item.getAttributes()) {
     if (attributeName.equals(attribute.getName())) {
       ids.add(attribute.getValue());
     }
   }
   return ids;
 }
  /*
   * (non-Javadoc)
   *
   * @see ca.unb.cs.pcsf.db.PcsfSimpleDBAccess#getCollaborationByName(java.lang.String)
   */
  @Override
  public Collaboration getCollaborationByName(String collaborationName) {
    logger.debug(LOGPRE + "getCollaborationByName() start" + LOGPRE);

    Collaboration collaboration = new Collaboration();
    String selectExpression =
        "select * from `"
            + DOMAIN_COLLABORATION
            + "` where "
            + COLLABORATION_ATTRIBUTE_NAME
            + "='"
            + collaborationName
            + "'";
    Item findItem = this.getDataFromDomain(selectExpression).get(0);

    List<String> participantNames = new ArrayList<String>();
    List<Participant> participants = new ArrayList<Participant>();

    collaboration.setId(findItem.getName());
    for (Attribute attribute : findItem.getAttributes()) {
      if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_NAME))
        collaboration.setName(attribute.getValue());
      if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_CREATOR_ID))
        collaboration.setCreatorId(attribute.getValue());
      if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_CURRENT_STATE))
        collaboration.setCurrentState(attribute.getValue());
      if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_PARTICIPANT))
        participantNames.add(attribute.getValue());
      if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_WORKFLOW_MODEL))
        collaboration.setWorkflowModel(attribute.getValue());
    }

    for (String s : participantNames) {
      Participant p = this.getParticipantByNameAndCollaborationId(s, findItem.getName());
      participants.add(p);
    }

    collaboration.setParticipants(participants);

    logger.debug(LOGPRE + "getCollaborationByName() end" + LOGPRE);
    return collaboration;
  }
  /**
   * Get a participant record from the data base by name and collaboration id.
   *
   * @param participantName
   * @param collaborationId
   * @return a participant
   */
  private Participant getParticipantByNameAndCollaborationId(
      String participantName, String collaborationId) {
    logger.debug(LOGPRE + "getParticipantByNameAndCollaborationId() start" + LOGPRE);

    Participant participant = new Participant();
    String selectRequest =
        "select * from `"
            + DOMAIN_PARTICIPANT
            + "` where "
            + PARTICIPANT_ATTRIBUTE_NAME
            + " = '"
            + participantName
            + "' AND "
            + PARTICIPANT_ATTRIBUTE_COLLABORATION_ID
            + "='"
            + collaborationId
            + "'";
    List<Item> items = this.getDataFromDomain(selectRequest);

    if (items != null) {
      Item item = items.get(0);
      participant.setId(item.getName());
      for (Attribute attribute : item.getAttributes()) {
        if (attribute.getName().equals(PARTICIPANT_ATTRIBUTE_NAME))
          participant.setName(attribute.getValue());
        if (attribute.getName().equals(PARTICIPANT_ATTRIBUTE_EMAIL))
          participant.setEmail(attribute.getValue());
        if (attribute.getName().equals(PARTICIPANT_ATTRIBUTE_COLLABORATION_ID))
          participant.setCollaborationId(attribute.getValue());
        if (attribute.getName().equals(PARTICIPANT_ATTRIBUTE_IS_REG))
          participant.setIsReg(attribute.getValue());
      }
    }

    logger.debug(LOGPRE + "getParticipantByNameAndCollaborationId() end" + LOGPRE);
    return participant;
  }
Exemple #18
0
 /**
  * Convert a simpledb item to PriamInstance
  *
  * @param item
  * @return
  */
 public PriamInstance transform(Item item) {
   PriamInstance ins = new PriamInstance();
   Iterator<Attribute> attrs = item.getAttributes().iterator();
   while (attrs.hasNext()) {
     Attribute att = attrs.next();
     if (att.getName().equals(Attributes.INSTANCE_ID)) ins.setInstanceId(att.getValue());
     else if (att.getName().equals(Attributes.TOKEN)) ins.setToken(att.getValue());
     else if (att.getName().equals(Attributes.APP_ID)) ins.setApp(att.getValue());
     else if (att.getName().equals(Attributes.ID)) ins.setId(Integer.parseInt(att.getValue()));
     else if (att.getName().equals(Attributes.AVAILABILITY_ZONE)) ins.setRac(att.getValue());
     else if (att.getName().equals(Attributes.ELASTIC_IP)) ins.setHostIP(att.getValue());
     else if (att.getName().equals(Attributes.HOSTNAME)) ins.setHost(att.getValue());
     else if (att.getName().equals(Attributes.LOCATION)) ins.setDC(att.getValue());
     else if (att.getName().equals(Attributes.UPDATE_TS))
       ins.setUpdatetime(Long.parseLong(att.getValue()));
   }
   return ins;
 }
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof Item == false) return false;
    Item other = (Item) obj;

    if (other.getName() == null ^ this.getName() == null) return false;
    if (other.getName() != null && other.getName().equals(this.getName()) == false) return false;
    if (other.getAlternateNameEncoding() == null ^ this.getAlternateNameEncoding() == null)
      return false;
    if (other.getAlternateNameEncoding() != null
        && other.getAlternateNameEncoding().equals(this.getAlternateNameEncoding()) == false)
      return false;
    if (other.getAttributes() == null ^ this.getAttributes() == null) return false;
    if (other.getAttributes() != null
        && other.getAttributes().equals(this.getAttributes()) == false) return false;
    return true;
  }
  /*
   * (non-Javadoc)
   *
   * @see ca.unb.cs.pcsf.db.DBAccessService#getCollaborationById(java.lang.String)
   */
  public Collaboration getCollaborationById(String collaborationId) {
    logger.debug(LOGPRE + "getCollaborationById() start" + LOGPRE);

    Collaboration collaboration = new Collaboration();
    String selectRequest = "select * from `" + DOMAIN_COLLABORATION + "`";
    List<Item> items = this.getDataFromDomain(selectRequest);
    Item findItem = new Item();

    if (!items.isEmpty()) {
      for (Item item : items) {
        if (item.getName().equals(collaborationId)) {
          findItem = item;
          break;
        }
      }
    }

    if (findItem != null) {
      List<String> participantNames = new ArrayList<String>();
      List<Participant> participants = new ArrayList<Participant>();

      collaboration.setId(findItem.getName());
      for (Attribute attribute : findItem.getAttributes()) {
        if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_NAME))
          collaboration.setName(attribute.getValue());
        if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_CREATOR_ID))
          collaboration.setCreatorId(attribute.getValue());
        if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_CURRENT_STATE))
          collaboration.setCurrentState(attribute.getValue());
        if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_PARTICIPANT))
          participantNames.add(attribute.getValue());
        if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_WORKFLOW_MODEL))
          collaboration.setWorkflowModel(attribute.getValue());
        if (attribute.getName().equals(COLLABORATION_ATTRIBUTE_PROCESS_DEFINITION_ID))
          collaboration.setProcessDefId(attribute.getValue());
      }

      for (String s : participantNames) {
        Participant p = this.getParticipantByNameAndCollaborationId(s, findItem.getName());
        participants.add(p);
      }

      collaboration.setParticipants(participants);
    }

    logger.debug(LOGPRE + "getCollaborationById() end" + LOGPRE);
    return collaboration;
  }
 /*
  * Extracts the 'score' attribute from the SimpleDB Item.
  */
 protected int getScoreForItem(Item item) {
   return this.getIntValueForAttributeFromList(SCORE_ATTRIBUTE, item.getAttributes());
 }
 /*
  * Extracts the 'player' attribute from the SimpleDB Item.
  */
 protected String getPlayerForItem(Item item) {
   return this.getStringValueForAttributeFromList(PLAYER_ATTRIBUTE, item.getAttributes());
 }
Exemple #23
0
    @Override
    protected TreeMap<Float, LotLocation> doInBackground(android.location.Location... location) {

      TreeMap<Float, LotLocation> locations = new TreeMap<Float, LotLocation>();

      try {

        // null checking party ahead, majority stems form no connection, perhaps a connection
        // manager could centralize this
        if (location[0] != null) {
          android.location.Location currentLocation = location[0];

          AmazonSimpleDBClient instance = SimpleDB.getInstance();
          if (instance != null) {

            SelectResult result =
                instance.select(
                    new SelectRequest("select * from `Locations` where active = '1' limit 50"));
            if (result != null) {
              for (Item lot : result.getItems()) {
                android.location.Location lotLocation =
                    new android.location.Location(currentLocation.getProvider());

                LotLocation internalLotLocation = new LotLocation();
                internalLotLocation.setId(lot.getName());

                // used to temporarily store hours of open and close for each location
                Hashtable<Integer, String> hoursOpen = new Hashtable<Integer, String>();
                Hashtable<Integer, String> hoursClose = new Hashtable<Integer, String>();

                for (Attribute attribute : lot.getAttributes()) {

                  if (attribute.getName().equalsIgnoreCase("location"))
                    internalLotLocation.setLocation(attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("rating"))
                    internalLotLocation.setRating(Float.parseFloat(attribute.getValue()));
                  if (attribute.getName().equalsIgnoreCase("business"))
                    internalLotLocation.setBusiness(attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("description"))
                    internalLotLocation.setDescription(attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("amex"))
                    internalLotLocation.setAcceptsAmex(
                        com.experiment.trax.utils.Boolean.valueOf(attribute.getValue()));
                  if (attribute.getName().equalsIgnoreCase("visa"))
                    internalLotLocation.setAcceptsVisa(
                        com.experiment.trax.utils.Boolean.valueOf(attribute.getValue()));
                  if (attribute.getName().equalsIgnoreCase("mastercard"))
                    internalLotLocation.setAcceptsMastercard(
                        com.experiment.trax.utils.Boolean.valueOf(attribute.getValue()));
                  if (attribute.getName().equalsIgnoreCase("discover"))
                    internalLotLocation.setAcceptsDiscover(
                        com.experiment.trax.utils.Boolean.valueOf(attribute.getValue()));
                  if (attribute.getName().equalsIgnoreCase("phone"))
                    internalLotLocation.setPhone(attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("verified"))
                    internalLotLocation.setVerified(
                        com.experiment.trax.utils.Boolean.valueOf(attribute.getValue()));

                  // create a key -> value to day of week and time opened or closed
                  if (attribute.getName().equalsIgnoreCase("1_open"))
                    hoursOpen.put(1, attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("1_close"))
                    hoursClose.put(1, attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("2_open"))
                    hoursOpen.put(2, attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("2_close"))
                    hoursClose.put(2, attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("3_open"))
                    hoursOpen.put(3, attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("3_close"))
                    hoursClose.put(3, attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("4_open"))
                    hoursOpen.put(4, attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("4_close"))
                    hoursClose.put(4, attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("5_open"))
                    hoursOpen.put(5, attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("5_close"))
                    hoursClose.put(5, attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("6_open"))
                    hoursOpen.put(6, attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("6_close"))
                    hoursClose.put(6, attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("7_open"))
                    hoursOpen.put(7, attribute.getValue());
                  if (attribute.getName().equalsIgnoreCase("7_close"))
                    hoursClose.put(7, attribute.getValue());

                  if (attribute.getName().equalsIgnoreCase("lat"))
                    lotLocation.setLatitude(Double.parseDouble(attribute.getValue()));
                  if (attribute.getName().equalsIgnoreCase("lng"))
                    lotLocation.setLongitude(Double.parseDouble(attribute.getValue()));
                }

                // store the times the lot is opened and closed
                internalLotLocation.setHoursOpen(hoursOpen);
                internalLotLocation.setHoursClose(hoursClose);

                // store the location of the lot
                internalLotLocation.setPoint(
                    new LatLng(lotLocation.getLatitude(), lotLocation.getLongitude()));

                // save it to our locations listing to return back to the consumer
                locations.put(currentLocation.distanceTo(lotLocation), internalLotLocation);
              }
            }
          }
        }
      } catch (Exception e) {
        Log.e("GetLocationsTask", "Failure attempting to get locations", e);
      }

      return locations;
    }