• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 
17 package com.android.providers.media.dao;
18 
19 /** DAO object representing database row of Files table of a MediaProvider database. */
20 public class FileRow {
21 
22     private final long mId;
23     private String mPath;
24     private String mOwnerPackageName;
25     private String mVolumeName;
26     private int mMediaType;
27     private boolean mIsDownload;
28     private boolean mIsPending;
29     private boolean mIsTrashed;
30     private boolean mIsFavorite;
31     private int mSpecialFormat;
32 
33     public static class Builder {
34         private final long mId;
35         private String mPath;
36         private String mOwnerPackageName;
37         private String mVolumeName;
38         private int mMediaType;
39         private boolean mIsDownload;
40         private boolean mIsPending;
41         private boolean mIsTrashed;
42         private boolean mIsFavorite;
43         private int mSpecialFormat;
44 
Builder(long id)45         Builder(long id) {
46             this.mId = id;
47         }
48 
setPath(String path)49         public Builder setPath(String path) {
50             this.mPath = path;
51             return this;
52         }
53 
setOwnerPackageName(String ownerPackageName)54         public Builder setOwnerPackageName(String ownerPackageName) {
55             this.mOwnerPackageName = ownerPackageName;
56             return this;
57         }
58 
setVolumeName(String volumeName)59         public Builder setVolumeName(String volumeName) {
60             this.mVolumeName = volumeName;
61             return this;
62         }
63 
setMediaType(int mediaType)64         public Builder setMediaType(int mediaType) {
65             this.mMediaType = mediaType;
66             return this;
67         }
68 
setIsDownload(boolean download)69         public Builder setIsDownload(boolean download) {
70             mIsDownload = download;
71             return this;
72         }
73 
setIsPending(boolean pending)74         public Builder setIsPending(boolean pending) {
75             mIsPending = pending;
76             return this;
77         }
78 
setIsTrashed(boolean trashed)79         public Builder setIsTrashed(boolean trashed) {
80             mIsTrashed = trashed;
81             return this;
82         }
83 
setIsFavorite(boolean favorite)84         public Builder setIsFavorite(boolean favorite) {
85             mIsFavorite = favorite;
86             return this;
87         }
88 
setSpecialFormat(int specialFormat)89         public Builder setSpecialFormat(int specialFormat) {
90             this.mSpecialFormat = specialFormat;
91             return this;
92         }
93 
build()94         public FileRow build() {
95             FileRow fileRow = new FileRow(this.mId);
96             fileRow.mPath = this.mPath;
97             fileRow.mOwnerPackageName = this.mOwnerPackageName;
98             fileRow.mVolumeName = this.mVolumeName;
99             fileRow.mMediaType = this.mMediaType;
100             fileRow.mIsDownload = this.mIsDownload;
101             fileRow.mIsPending = this.mIsPending;
102             fileRow.mIsTrashed = this.mIsTrashed;
103             fileRow.mIsFavorite = this.mIsFavorite;
104             fileRow.mSpecialFormat = this.mSpecialFormat;
105 
106             return fileRow;
107         }
108     }
109 
newBuilder(long id)110     public static Builder newBuilder(long id) {
111         return new Builder(id);
112     }
113 
FileRow(long id)114     private FileRow(long id) {
115         this.mId = id;
116     }
117 
getId()118     public long getId() {
119         return mId;
120     }
121 
getPath()122     public String getPath() {
123         return mPath;
124     }
125 
getOwnerPackageName()126     public String getOwnerPackageName() {
127         return mOwnerPackageName;
128     }
129 
getVolumeName()130     public String getVolumeName() {
131         return mVolumeName;
132     }
133 
getMediaType()134     public int getMediaType() {
135         return mMediaType;
136     }
137 
isDownload()138     public boolean isDownload() {
139         return mIsDownload;
140     }
141 
isPending()142     public boolean isPending() {
143         return mIsPending;
144     }
145 
isTrashed()146     public boolean isTrashed() {
147         return mIsTrashed;
148     }
149 
isFavorite()150     public boolean isFavorite() {
151         return mIsFavorite;
152     }
153 
getSpecialFormat()154     public int getSpecialFormat() {
155         return mSpecialFormat;
156     }
157 }
158