2017-08-12 04:50:25 +00:00
|
|
|
package org.schabi.newpipe.database.history.model;
|
|
|
|
|
|
|
|
import android.arch.persistence.room.ColumnInfo;
|
|
|
|
import android.arch.persistence.room.Entity;
|
|
|
|
import android.arch.persistence.room.Ignore;
|
2018-01-27 05:34:17 +00:00
|
|
|
import android.arch.persistence.room.Index;
|
2018-01-29 02:26:19 +00:00
|
|
|
import android.arch.persistence.room.PrimaryKey;
|
2017-08-12 04:50:25 +00:00
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
2018-01-27 05:34:17 +00:00
|
|
|
import static org.schabi.newpipe.database.history.model.SearchHistoryEntry.SEARCH;
|
|
|
|
|
|
|
|
@Entity(tableName = SearchHistoryEntry.TABLE_NAME,
|
|
|
|
indices = {@Index(value = SEARCH)})
|
2018-01-29 02:26:19 +00:00
|
|
|
public class SearchHistoryEntry {
|
2017-08-12 04:50:25 +00:00
|
|
|
|
2018-01-29 02:26:19 +00:00
|
|
|
public static final String ID = "id";
|
2017-08-12 04:50:25 +00:00
|
|
|
public static final String TABLE_NAME = "search_history";
|
2018-01-29 02:26:19 +00:00
|
|
|
public static final String SERVICE_ID = "service_id";
|
|
|
|
public static final String CREATION_DATE = "creation_date";
|
2017-08-12 04:50:25 +00:00
|
|
|
public static final String SEARCH = "search";
|
|
|
|
|
2018-01-29 02:26:19 +00:00
|
|
|
@ColumnInfo(name = ID)
|
|
|
|
@PrimaryKey(autoGenerate = true)
|
|
|
|
private long id;
|
|
|
|
|
|
|
|
@ColumnInfo(name = CREATION_DATE)
|
|
|
|
private Date creationDate;
|
|
|
|
|
|
|
|
@ColumnInfo(name = SERVICE_ID)
|
|
|
|
private int serviceId;
|
|
|
|
|
2017-08-12 04:50:25 +00:00
|
|
|
@ColumnInfo(name = SEARCH)
|
|
|
|
private String search;
|
|
|
|
|
|
|
|
public SearchHistoryEntry(Date creationDate, int serviceId, String search) {
|
2018-01-29 02:26:19 +00:00
|
|
|
this.serviceId = serviceId;
|
|
|
|
this.creationDate = creationDate;
|
2017-08-12 04:50:25 +00:00
|
|
|
this.search = search;
|
|
|
|
}
|
|
|
|
|
2018-01-29 02:26:19 +00:00
|
|
|
public long getId() {
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setId(long id) {
|
|
|
|
this.id = id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Date getCreationDate() {
|
|
|
|
return creationDate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setCreationDate(Date creationDate) {
|
|
|
|
this.creationDate = creationDate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getServiceId() {
|
|
|
|
return serviceId;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setServiceId(int serviceId) {
|
|
|
|
this.serviceId = serviceId;
|
|
|
|
}
|
|
|
|
|
2017-08-12 04:50:25 +00:00
|
|
|
public String getSearch() {
|
|
|
|
return search;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSearch(String search) {
|
|
|
|
this.search = search;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Ignore
|
2018-01-29 02:26:19 +00:00
|
|
|
public boolean hasEqualValues(SearchHistoryEntry otherEntry) {
|
|
|
|
return getServiceId() == otherEntry.getServiceId() &&
|
|
|
|
getSearch().equals(otherEntry.getSearch());
|
2017-08-12 04:50:25 +00:00
|
|
|
}
|
|
|
|
}
|