package net.qiujuer.powerback.ankey.model.db;

import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
import com.activeandroid.query.Select;

import java.util.List;
import java.util.UUID;

/**
 * Created by wugian
 * on 15/10/24.
 */
@Table(name = "Site")
public class SiteModel extends Model{
    @Column(name = "SiteId")
    private String SiteId;
    @Column(name = "Name")
    private String Name;
    @Column(name = "MD5")
    private String MD5;
    @Column(name = "Url")
    private String Url;
    @Column(name="Icon")
    private SiteModel siteModel;
    @Column(name = "CreateDate")
    private String CreateDate;
    @Column(name = "UpdateDate")
    private String UpdateDate;

    public String getSiteId() {
        return SiteId;
    }

    public void setSiteId(String siteId) {
        SiteId = siteId;
    }

    public String getName() {
        return Name;
    }

    public void setName(String name) {
        Name = name;
    }

    public String getMD5() {
        return MD5;
    }

    public void setMD5(String MD5) {
        this.MD5 = MD5;
    }

    public String getUrl() {
        return Url;
    }

    public void setUrl(String url) {
        Url = url;
    }


    public SiteModel getSiteModel() {
        return siteModel;
    }

    public void setSiteModel(SiteModel siteModel) {
        this.siteModel = siteModel;
    }

    public String getCreateDate() {
        return CreateDate;
    }

    public void setCreateDate(String createDate) {
        CreateDate = createDate;
    }

    public String getUpdateDate() {
        return UpdateDate;
    }

    public void setUpdateDate(String updateDate) {
        UpdateDate = updateDate;
    }

    public static SiteModel getSiteModel(UUID uuid) {
        return new Select()
                .from(SiteModel.class)
                .where("SiteId = ?",uuid.toString())
                .executeSingle();
    }

    public static SiteModel get(long id) {
        return new Select()
                .from(SiteModel.class)
                .where("id = ?", id)
                .executeSingle();
    }

    public static List<SiteModel> getAll(){
        return new Select()
                .from(SiteModel.class)
                .execute();
    }
}

@@ -596,35 +596,30 @@
 private 
-Site
+Icon
 Model 
-siteModel
+Icon
 ;%0A    @C
@@ -1246,17 +1246,16 @@
 %0A    %7D%0A%0A
-%0A
     publ
@@ -1257,20 +1257,20 @@
  public 
-Site
+Icon
 Model ge
@@ -1270,25 +1270,20 @@
 odel get
-SiteModel
+Icon
 () %7B%0A   
@@ -1294,25 +1294,20 @@
  return 
-siteModel
+Icon
 ;%0A    %7D%0A
@@ -1330,75 +1330,50 @@
  set
-SiteModel(SiteModel siteModel) %7B%0A        this.siteModel = siteModel
+Icon(IconModel icon) %7B%0A        Icon = icon
 ;%0A  
@@ -2247,10 +2247,11 @@
 ;%0A    %7D%0A
+%0A
 %7D%0A

fix wrong ralationship in SiteModel