package de.metalmatze.krautreporter.services;

import android.app.Service;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.IBinder;

import com.activeandroid.query.Select;
import com.activeandroid.query.Sqlable;

import java.util.List;

import de.metalmatze.krautreporter.models.ArticleModel;

public class ArticleService extends Service {

    public List<ArticleModel> all()
    {
        new SqlExecuter().execute(new Select().from(ArticleModel.class));

        return null;
    }

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    public static class SqlExecuter extends AsyncTask<Sqlable, Void, Void> {

        @Override
        protected Void doInBackground(Sqlable... params) {
            return null;
        }
    }

}

@@ -44,36 +44,8 @@
 s;%0A%0A
-import android.app.Service;%0A
 impo
@@ -67,72 +67,57 @@
 ent.
-Inten
+Contex
 t;%0A
+%0A
 import 
-android.os.AsyncTask;%0Aimport android.os.IBinder;%0A
+com.activeandroid.ActiveAndroid;
 %0Aimp
@@ -156,175 +156,494 @@
 ct;%0A
+%0A
 import 
-com.activeandroid.query.Sqlable;%0A%0Aimport java.util.List;%0A%0Aimport de.metalmatze.krautreporter.models.ArticleModel;%0A%0Apublic class ArticleService extends Service %7B
+java.io.BufferedInputStream;%0Aimport java.io.IOException;%0Aimport java.util.List;%0Aimport java.util.concurrent.ExecutionException;%0A%0Aimport de.metalmatze.krautreporter.KrautreporterRssParser;%0Aimport de.metalmatze.krautreporter.models.ArticleModel;%0A%0Apublic class ArticleService %7B%0A%0A    private static final String RSS_FILE = %22krautreporter.rss%22;%0A%0A    protected Context context;%0A%0A    public ArticleService(Context applicationContext) %7B%0A%0A        this.context = applicationContext;%0A    %7D
 %0A%0A  
@@ -694,34 +694,15 @@
     
-new SqlExecuter().execute(
+return 
 new 
@@ -738,26 +738,99 @@
 ass)
-);%0A%0A        return
+.execute();%0A    %7D%0A%0A    public void update()%0A    %7B%0A        BufferedInputStream inputStream =
  nul
@@ -840,274 +840,825 @@
     
-%7D%0A%0A    @Override%0A    public IBinder onBind(Intent intent) %7B%0A        return null;%0A    %7D%0A%0A    public static class SqlExecuter extends AsyncTask%3CSqlable, Void, Void%3E %7B%0A%0A        @Override%0A        protected Void doInBackground(Sqlable... params) %7B%0A            return null
+    try %7B%0A            inputStream = new BufferedInputStream(this.context.getAssets().open(RSS_FILE));%0A            List%3CArticleModel%3E articleModelList = new KrautreporterRssParser.KrautreporterRssParserTask().execute(inputStream).get();%0A%0A            ActiveAndroid.beginTransaction();%0A            try %7B%0A                for (ArticleModel articleModel : articleModelList)%0A                %7B%0A                    articleModel.save();%0A                %7D%0A                ActiveAndroid.setTransactionSuccessful();%0A            %7D%0A            finally %7B%0A                ActiveAndroid.endTransaction();%0A            %7D%0A%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A        %7D catch (InterruptedException e) %7B%0A            e.printStackTrace();%0A        %7D catch (ExecutionException e) %7B%0A            e.printStackTrace()
 ;%0A  

Create List<ArticleModel> all() and void update() in ArticleService