
/*
 * Copyright 2019 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.codeu.data;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.Entity;




/** A tag, which can map to many different places. */
/*
public class Tag {

  private String label;

  /**
   * Constructs a new {@link Tag} posted using only a label
   */

/*
  public Tag(String label) {
    this.label;
  }
   */
  /** Return Tag data using based on entity from search query. */
 /* public Tag(Entity entity) {
    this.label = (String)entity.getProperty("label");
  }

  public String getLabel() {
    return label;
  }

} */

@@ -718,16 +718,441 @@
 Entity;%0A
+import com.google.appengine.api.datastore.DatastoreService;%0Aimport com.google.appengine.api.datastore.PreparedQuery;%0Aimport com.google.appengine.api.datastore.Query;%0Aimport com.google.appengine.api.datastore.Query.Filter;%0Aimport com.google.appengine.api.datastore.Query.FilterOperator;%0Aimport com.google.appengine.api.datastore.Query.FilterPredicate;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.UUID;%0A
 %0A%0A%0A%0A/** 
@@ -1201,19 +1201,16 @@
 ces. */%0A
-/*%0A
 public c
@@ -1221,16 +1221,35 @@
  Tag %7B%0A%0A
+  private UUID id;%0A
   privat
@@ -1264,16 +1264,18 @@
  label;%0A
+  
 %0A  /**%0A 
@@ -1311,43 +1311,42 @@
 ag%7D 
-posted using only a label
+with a label and a random ID
 %0A   */
-%0A%0A/*
 %0A  p
@@ -1383,25 +1383,197 @@
 this
-.
+(UUID.randomUUID(), 
 label
+)
 ;%0A  %7D%0A
-   */
+%0A  /**%0A   * Constructs a new %7B@link Tag%7D posted using only a label%0A   */%0A  public Tag(UUID id, String label) %7B%0A    this.id = id;%0A    this.label = label;%0A  %7D%0A
 %0A  /
@@ -1636,18 +1636,16 @@
 ry. */%0A 
-/*
  public 
@@ -1719,16 +1719,830 @@
 abel%22);%0A
+    this.id = UUID.fromString(entity.getProperty(%22id%22));%0A  %7D  %0A  %0A  public static List%3CTag%3E getAll() %7B%0A    DatastoreService datastore = Datastore.GetSingletonService();%0A    Query query = new Query(%22Tag%22);%0A    PreparedQuery results = datastore.prepare(query);%0A    List%3CTag%3E tags = new ArrayList%3CTag%3E();%0A    for (Entity entity : results.asIterable()) %7B%0A      tags.add(new Tag(entity));%0A    %7D%0A    return tags;%0A  %7D%0A%0A  %0A  public static Tag getByLabel(String label) %7B%0A    DatastoreService datastore = Datastore.GetSingletonService();%0A    Filter tagFilter = new FilterPredicate(%22label%22, FilterOperator.EQUAL, label);%0A    Query query = new Query(%22Tag%22).setFilter(tagFilter);%0A    Entity entity = datastore.prepare(query).asSingleEntity();%0A    %0A    if (entity == null) %7B%0A      return null;%0A    %7D%0A    return new Tag(entity);%0A
   %7D%0A%0A  p
@@ -2593,10 +2593,53 @@
   %7D%0A
-%0A%7D */
+  %0A  public UUID getId() %7B%0A    return id;%0A  %7D%0A%0A%7D
 %0A

Fix tag error - need get/store methods (#52)