<commit_before>package de.fau.cs.mad.fablab.android.model;

import javax.inject.Inject;

import de.fau.cs.mad.fablab.android.model.events.InventoryDeletedEvent;
import de.fau.cs.mad.fablab.android.model.events.InventoryNotDeletedEvent;
import de.fau.cs.mad.fablab.rest.core.InventoryItem;
import de.fau.cs.mad.fablab.rest.myapi.InventoryApi;
import de.greenrobot.event.EventBus;
import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;

public class InventoryModel {

    private InventoryApi mInventoryApi;
    private EventBus mEventBus = EventBus.getDefault();

    private Callback<InventoryItem> mAddCallback = new Callback<InventoryItem>() {
        @Override
        public void success(InventoryItem item, Response response) {
        }

        @Override
        public void failure(RetrofitError error) {

        }
    };

    private Callback<Boolean> mDeleteCallback = new Callback<Boolean>() {

        @Override
        public void success(Boolean success, Response response) {
            mEventBus.post(new InventoryDeletedEvent());
        }

        @Override
        public void failure(RetrofitError error) {
            mEventBus.post(new InventoryNotDeletedEvent());
        }
    };

    @Inject
    public InventoryModel(InventoryApi api){
        mInventoryApi = api;
    }

    public void sendInventoryItem(InventoryItem item)
    {
        mInventoryApi.add(item, mAddCallback);
    }

    public void deleteInventory()
    {
        mInventoryApi.deleteAll(mDeleteCallback);
    }
}<commit_msg>adapted InventoryModel to get whole inventory from server<commit_after>package de.fau.cs.mad.fablab.android.model;

import java.util.List;

import javax.inject.Inject;

import de.fau.cs.mad.fablab.android.model.events.InventoryDeletedEvent;
import de.fau.cs.mad.fablab.android.model.events.InventoryNotDeletedEvent;
import de.fau.cs.mad.fablab.android.viewmodel.common.ObservableArrayList;
import de.fau.cs.mad.fablab.rest.core.InventoryItem;
import de.fau.cs.mad.fablab.rest.myapi.InventoryApi;
import de.greenrobot.event.EventBus;
import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;

public class InventoryModel {

    private InventoryApi mInventoryApi;
    private EventBus mEventBus = EventBus.getDefault();
    private ObservableArrayList<InventoryItem> mItems;

    private Callback<InventoryItem> mAddCallback = new Callback<InventoryItem>() {
        @Override
        public void success(InventoryItem item, Response response) {
        }

        @Override
        public void failure(RetrofitError error) {

        }
    };

    private Callback<Boolean> mDeleteCallback = new Callback<Boolean>() {

        @Override
        public void success(Boolean success, Response response) {
            mEventBus.post(new InventoryDeletedEvent());
        }

        @Override
        public void failure(RetrofitError error) {
            mEventBus.post(new InventoryNotDeletedEvent());
        }
    };

    private Callback<List<InventoryItem>> mGetCallback = new Callback<List<InventoryItem>>() {
        @Override
        public void success(List<InventoryItem> items, Response response) {
            mItems.clear();
            mItems.addAll(items);
        }

        @Override
        public void failure(RetrofitError error) {

        }
    };

    @Inject
    public InventoryModel(InventoryApi api){
        mInventoryApi = api;
        mItems = new ObservableArrayList<>();
    }

    public void sendInventoryItem(InventoryItem item)
    {
        mInventoryApi.add(item, mAddCallback);
    }

    public void deleteInventory()
    {
        mInventoryApi.deleteAll(mDeleteCallback);
    }

    public void getInventory()
    {
        mInventoryApi.getAll(mGetCallback);
    }

    public ObservableArrayList<InventoryItem> getInventoryItems()
    {
        return mItems;
    }
}
{'fraction_non_alphanumeric': 0.09212214523992815, 'fraction_numerical': 0.0, 'mean_word_length': 3.081675392670157, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7489179', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1137, 'n_words': 213}