Home | History | Annotate | Download | only in data
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package com.android.gallery3d.data;
     17 
     18 import com.android.gallery3d.common.Entry;
     19 import com.android.gallery3d.common.EntrySchema;
     20 
     21 
     22 @Entry.Table("download")
     23 public class DownloadEntry extends Entry {
     24     public static final EntrySchema SCHEMA = new EntrySchema(DownloadEntry.class);
     25 
     26     public static interface Columns extends Entry.Columns {
     27         public static final String HASH_CODE = "hash_code";
     28         public static final String CONTENT_URL = "content_url";
     29         public static final String CONTENT_SIZE = "_size";
     30         public static final String ETAG = "etag";
     31         public static final String LAST_ACCESS = "last_access";
     32         public static final String LAST_UPDATED = "last_updated";
     33         public static final String DATA = "_data";
     34     }
     35 
     36     @Column(value = "hash_code", indexed = true)
     37     public long hashCode;
     38 
     39     @Column("content_url")
     40     public String contentUrl;
     41 
     42     @Column("_size")
     43     public long contentSize;
     44 
     45     @Column("etag")
     46     public String eTag;
     47 
     48     @Column(value = "last_access", indexed = true)
     49     public long lastAccessTime;
     50 
     51     @Column(value = "last_updated")
     52     public long lastUpdatedTime;
     53 
     54     @Column("_data")
     55     public String path;
     56 
     57     @Override
     58     public String toString() {
     59         // Note: THIS IS REQUIRED. We used all the fields here. Otherwise,
     60         //       ProGuard will remove these UNUSED fields. However, these
     61         //       fields are needed to generate database.
     62         return new StringBuilder()
     63                 .append("hash_code: ").append(hashCode).append(", ")
     64                 .append("content_url").append(contentUrl).append(", ")
     65                 .append("_size").append(contentSize).append(", ")
     66                 .append("etag").append(eTag).append(", ")
     67                 .append("last_access").append(lastAccessTime).append(", ")
     68                 .append("last_updated").append(lastUpdatedTime).append(",")
     69                 .append("_data").append(path)
     70                 .toString();
     71     }
     72 }
     73