com.firstdata.clovergo.domain.usecase.GetLoggedEmployee Maven / Gradle / Ivy
package com.firstdata.clovergo.domain.usecase;
import com.firstdata.clovergo.domain.model.EmployeeMerchant;
import com.firstdata.clovergo.domain.model.UseCaseConstants;
import com.firstdata.clovergo.domain.repository.AuthenticationRepository;
import javax.inject.Inject;
import io.reactivex.Maybe;
/**
* Created by Arjun Chinya on 12/13/16.
*/
public class GetLoggedEmployee extends UseCase {
@Inject
public GetLoggedEmployee(AuthenticationRepository authenticationRepository) {
super(authenticationRepository);
}
public Maybe getBlockingObservable() {
repository.log("get logged employee");
EmployeeMerchant employeeMerchant = repository.retrieveFromCache(UseCaseConstants.EMPLOYEE_MERCHANT);
if (employeeMerchant != null) {
return Maybe.just(employeeMerchant);
} else
return Maybe.empty();
}
}