!added impl classes for repositories
This commit is contained in:
parent
03de97846f
commit
05db1ef50a
@ -1,5 +1,33 @@
|
||||
package ru.dragonestia.picker.api.repository;
|
||||
|
||||
import ru.dragonestia.picker.api.model.account.Account;
|
||||
import ru.dragonestia.picker.api.model.account.AccountId;
|
||||
import ru.dragonestia.picker.api.model.account.Permission;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public interface AccountRepository {
|
||||
|
||||
List<AccountId> allAccountsIds();
|
||||
|
||||
Account getAccount(AccountId id);
|
||||
|
||||
List<Account> getAccounts(Collection<Account> ids);
|
||||
|
||||
void createAccount(AccountId id, String password, List<Permission> permissions);
|
||||
|
||||
void deleteAccount(AccountId id);
|
||||
|
||||
void setPermissions(AccountId id, List<Permission> permissions);
|
||||
|
||||
default void setPermissions(Account account, List<Permission> permissions) {
|
||||
setPermissions(account.id(), permissions);
|
||||
}
|
||||
|
||||
void changePassword(AccountId id, String newPassword);
|
||||
|
||||
default void changePassword(Account account, String newPassword) {
|
||||
changePassword(account.id(), newPassword);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,10 @@ import okhttp3.Request;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
|
||||
import ru.dragonestia.picker.api.impl.exception.ExceptionService;
|
||||
import ru.dragonestia.picker.api.impl.repository.AccountRepositoryImpl;
|
||||
import ru.dragonestia.picker.api.impl.repository.EntityRepositoryImpl;
|
||||
import ru.dragonestia.picker.api.impl.repository.InstanceRepositoryImpl;
|
||||
import ru.dragonestia.picker.api.impl.repository.RoomRepositoryImpl;
|
||||
import ru.dragonestia.picker.api.impl.util.RestTemplate;
|
||||
import ru.dragonestia.picker.api.impl.util.type.HttpMethod;
|
||||
import ru.dragonestia.picker.api.model.account.Account;
|
||||
@ -31,10 +35,10 @@ public class RoomPickerClient {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.restTemplate = new RestTemplate(this, this::updateAccountData);
|
||||
this.instanceRepository = null; //new InstanceRepositoryImpl(this);
|
||||
this.roomRepository = null; //new RoomRepositoryImpl(this);
|
||||
this.entityRepository = null; //new EntityRepositoryImpl(this);
|
||||
this.accountRepository = null; //new AccountRepositoryImpl(this);
|
||||
this.instanceRepository = new InstanceRepositoryImpl(getRestTemplate());
|
||||
this.roomRepository = new RoomRepositoryImpl(getRestTemplate());
|
||||
this.entityRepository = new EntityRepositoryImpl(getRestTemplate());
|
||||
this.accountRepository = new AccountRepositoryImpl(getRestTemplate());
|
||||
|
||||
ExceptionService.init();
|
||||
}
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
package ru.dragonestia.picker.api.impl.repository;
|
||||
|
||||
import ru.dragonestia.picker.api.impl.util.RestTemplate;
|
||||
import ru.dragonestia.picker.api.model.account.Account;
|
||||
import ru.dragonestia.picker.api.model.account.AccountId;
|
||||
import ru.dragonestia.picker.api.model.account.Permission;
|
||||
import ru.dragonestia.picker.api.repository.AccountRepository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class AccountRepositoryImpl implements AccountRepository {
|
||||
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
public AccountRepositoryImpl(RestTemplate restTemplate) {
|
||||
this.restTemplate = restTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AccountId> allAccountsIds() {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Account getAccount(AccountId id) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Account> getAccounts(Collection<Account> ids) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAccount(AccountId id, String password, List<Permission> permissions) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAccount(AccountId id) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPermissions(AccountId id, List<Permission> permissions) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changePassword(AccountId id, String newPassword) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package ru.dragonestia.picker.api.impl.repository;
|
||||
|
||||
import ru.dragonestia.picker.api.impl.util.RestTemplate;
|
||||
import ru.dragonestia.picker.api.model.entity.EntityId;
|
||||
import ru.dragonestia.picker.api.model.instance.InstanceId;
|
||||
import ru.dragonestia.picker.api.model.room.Room;
|
||||
import ru.dragonestia.picker.api.model.room.RoomId;
|
||||
import ru.dragonestia.picker.api.repository.EntityRepository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class EntityRepositoryImpl implements EntityRepository {
|
||||
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
public EntityRepositoryImpl(RestTemplate restTemplate) {
|
||||
this.restTemplate = restTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityId> searchUsers(EntityId input) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Room> getRooms(EntityId entity) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<EntityId, List<Room>> getRooms(Collection<EntityId> entities) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityId> getRoomEntities(InstanceId instanceId, RoomId roomId) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void linkEntitiesWithRoom(InstanceId instanceId, RoomId roomId, Collection<EntityId> entities, boolean force) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unlinkEntitiesFromRoom(InstanceId instanceId, RoomId roomId, Collection<EntityId> entities) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package ru.dragonestia.picker.api.impl.repository;
|
||||
|
||||
import ru.dragonestia.picker.api.impl.util.RestTemplate;
|
||||
import ru.dragonestia.picker.api.model.entity.EntityId;
|
||||
import ru.dragonestia.picker.api.model.instance.Instance;
|
||||
import ru.dragonestia.picker.api.model.instance.InstanceId;
|
||||
import ru.dragonestia.picker.api.model.instance.type.PickingMethod;
|
||||
import ru.dragonestia.picker.api.repository.InstanceRepository;
|
||||
import ru.dragonestia.picker.api.repository.response.ResponseObject;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class InstanceRepositoryImpl implements InstanceRepository {
|
||||
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
public InstanceRepositoryImpl(RestTemplate restTemplate) {
|
||||
this.restTemplate = restTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InstanceId> allInstancesIds() {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instance getInstance(InstanceId id) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<InstanceId, Instance> getInstances(Collection<InstanceId> ids) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createInstance(InstanceId id, PickingMethod method, boolean persist) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteInstance(InstanceId id) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteInstances(Collection<InstanceId> ids) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseObject.PickedRoom pickRoom(InstanceId id, Collection<EntityId> entities, boolean dontReturnEntities) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package ru.dragonestia.picker.api.impl.repository;
|
||||
|
||||
import ru.dragonestia.picker.api.impl.util.RestTemplate;
|
||||
import ru.dragonestia.picker.api.model.instance.InstanceId;
|
||||
import ru.dragonestia.picker.api.model.room.Room;
|
||||
import ru.dragonestia.picker.api.model.room.RoomId;
|
||||
import ru.dragonestia.picker.api.repository.RoomRepository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class RoomRepositoryImpl implements RoomRepository {
|
||||
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
public RoomRepositoryImpl(RestTemplate restTemplate) {
|
||||
this.restTemplate = restTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RoomId> allRoomsIds(InstanceId instanceId) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Room getRoom(InstanceId instanceId, RoomId roomId) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<RoomId, Room> getRooms(InstanceId instanceId, Collection<RoomId> rooms) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createRoom(InstanceId instanceId, RoomId roomId, int slots, String payload, boolean locked, boolean persist) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRoom(InstanceId instanceId, RoomId roomId) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRooms(InstanceId instanceId, Collection<RoomId> rooms) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lockRoom(InstanceId instanceId, RoomId roomId, boolean newState) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user