added more type information to RestCall's
This commit is contained in:
parent
718bd74e22
commit
3c42843f13
27 changed files with 245 additions and 56 deletions
|
@ -21,8 +21,8 @@ import ch.ethz.seb.sebserver.gbl.api.API.BulkActionType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.Entity;
|
import ch.ethz.seb.sebserver.gbl.model.Entity;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.EntityKey;
|
import ch.ethz.seb.sebserver.gbl.model.EntityKey;
|
||||||
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
||||||
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall.CallType;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestService;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestService;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.institution.GetInstitutionDependency;
|
|
||||||
|
|
||||||
public final class PageUtils {
|
public final class PageUtils {
|
||||||
|
|
||||||
|
@ -44,7 +44,9 @@ public final class PageUtils {
|
||||||
|
|
||||||
return () -> {
|
return () -> {
|
||||||
try {
|
try {
|
||||||
final Set<EntityKey> dependencies = restService.getBuilder(GetInstitutionDependency.class)
|
|
||||||
|
final Set<EntityKey> dependencies =
|
||||||
|
restService.<Set<EntityKey>> getBuilder(entity.entityType(), CallType.GET_DEPENDENCIES)
|
||||||
.withURIVariable(API.PARAM_MODEL_ID, String.valueOf(entity.getModelId()))
|
.withURIVariable(API.PARAM_MODEL_ID, String.valueOf(entity.getModelId()))
|
||||||
.withQueryParam(API.PARAM_BULK_ACTION_TYPE, BulkActionType.DEACTIVATE.name())
|
.withQueryParam(API.PARAM_BULK_ACTION_TYPE, BulkActionType.DEACTIVATE.name())
|
||||||
.call()
|
.call()
|
||||||
|
|
|
@ -29,6 +29,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.APIMessage;
|
import ch.ethz.seb.sebserver.gbl.api.APIMessage;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.api.JSONMapper;
|
import ch.ethz.seb.sebserver.gbl.api.JSONMapper;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.Entity;
|
import ch.ethz.seb.sebserver.gbl.model.Entity;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.Page;
|
import ch.ethz.seb.sebserver.gbl.model.Page;
|
||||||
|
@ -40,20 +41,32 @@ public abstract class RestCall<T> {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(RestCall.class);
|
private static final Logger log = LoggerFactory.getLogger(RestCall.class);
|
||||||
|
|
||||||
|
public enum CallType {
|
||||||
|
UNDEFINED,
|
||||||
|
GET_SINGLE,
|
||||||
|
GET_PAGE,
|
||||||
|
GET_NAMES,
|
||||||
|
GET_DEPENDENCIES,
|
||||||
|
NEW,
|
||||||
|
SAVE,
|
||||||
|
ACTIVATION_ACTIVATE,
|
||||||
|
ACTIVATION_DEACTIVATE
|
||||||
|
}
|
||||||
|
|
||||||
protected RestService restService;
|
protected RestService restService;
|
||||||
protected JSONMapper jsonMapper;
|
protected JSONMapper jsonMapper;
|
||||||
protected final TypeReference<T> typeRef;
|
protected TypeKey<T> typeKey;
|
||||||
protected final HttpMethod httpMethod;
|
protected final HttpMethod httpMethod;
|
||||||
protected final MediaType contentType;
|
protected final MediaType contentType;
|
||||||
protected final String path;
|
protected final String path;
|
||||||
|
|
||||||
protected RestCall(
|
protected RestCall(
|
||||||
final TypeReference<T> typeRef,
|
final TypeKey<T> typeKey,
|
||||||
final HttpMethod httpMethod,
|
final HttpMethod httpMethod,
|
||||||
final MediaType contentType,
|
final MediaType contentType,
|
||||||
final String path) {
|
final String path) {
|
||||||
|
|
||||||
this.typeRef = typeRef;
|
this.typeKey = typeKey;
|
||||||
this.httpMethod = httpMethod;
|
this.httpMethod = httpMethod;
|
||||||
this.contentType = contentType;
|
this.contentType = contentType;
|
||||||
this.path = path;
|
this.path = path;
|
||||||
|
@ -84,7 +97,7 @@ public abstract class RestCall<T> {
|
||||||
|
|
||||||
return Result.of(RestCall.this.jsonMapper.readValue(
|
return Result.of(RestCall.this.jsonMapper.readValue(
|
||||||
responseEntity.getBody(),
|
responseEntity.getBody(),
|
||||||
RestCall.this.typeRef));
|
RestCall.this.typeKey.typeRef));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -255,4 +268,45 @@ public abstract class RestCall<T> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final class TypeKey<T> {
|
||||||
|
final CallType callType;
|
||||||
|
final EntityType entityType;
|
||||||
|
private final TypeReference<T> typeRef;
|
||||||
|
|
||||||
|
public TypeKey(
|
||||||
|
final CallType callType,
|
||||||
|
final EntityType entityType,
|
||||||
|
final TypeReference<T> typeRef) {
|
||||||
|
|
||||||
|
this.callType = callType;
|
||||||
|
this.entityType = entityType;
|
||||||
|
this.typeRef = typeRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((this.callType == null) ? 0 : this.callType.hashCode());
|
||||||
|
result = prime * result + ((this.entityType == null) ? 0 : this.entityType.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
final TypeKey<?> other = (TypeKey<?>) obj;
|
||||||
|
if (this.callType != other.callType)
|
||||||
|
return false;
|
||||||
|
if (this.entityType != other.entityType)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,12 @@ import org.springframework.web.client.RestTemplate;
|
||||||
import org.springframework.web.util.UriComponentsBuilder;
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.api.JSONMapper;
|
import ch.ethz.seb.sebserver.gbl.api.JSONMapper;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.page.PageContext.AttributeKeys;
|
import ch.ethz.seb.sebserver.gui.service.page.PageContext.AttributeKeys;
|
||||||
import ch.ethz.seb.sebserver.gui.service.page.action.Action;
|
import ch.ethz.seb.sebserver.gui.service.page.action.Action;
|
||||||
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall.CallType;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.auth.AuthorizationContextHolder;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.auth.AuthorizationContextHolder;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.auth.WebserviceURIService;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.auth.WebserviceURIService;
|
||||||
|
|
||||||
|
@ -65,6 +67,15 @@ public class RestService {
|
||||||
return (RestCall<T>) this.calls.get(type.getName());
|
return (RestCall<T>) this.calls.get(type.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public final <T> RestCall<T> getRestCall(final EntityType entityType, final CallType callType) {
|
||||||
|
return (RestCall<T>) this.calls.values()
|
||||||
|
.stream()
|
||||||
|
.filter(call -> call.typeKey.callType == callType && call.typeKey.entityType == entityType)
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
public final <T> RestCall<T>.RestCallBuilder getBuilder(final Class<? extends RestCall<T>> type) {
|
public final <T> RestCall<T>.RestCallBuilder getBuilder(final Class<? extends RestCall<T>> type) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final RestCall<T> restCall = (RestCall<T>) this.calls.get(type.getName());
|
final RestCall<T> restCall = (RestCall<T>) this.calls.get(type.getName());
|
||||||
|
@ -75,6 +86,18 @@ public class RestService {
|
||||||
return restCall.newBuilder();
|
return restCall.newBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final <T> RestCall<T>.RestCallBuilder getBuilder(
|
||||||
|
final EntityType entityType,
|
||||||
|
final CallType callType) {
|
||||||
|
|
||||||
|
final RestCall<T> restCall = getRestCall(entityType, callType);
|
||||||
|
if (restCall == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return restCall.newBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
public <T> Action activation(final Action action) {
|
public <T> Action activation(final Action action) {
|
||||||
if (action.definition.restCallType == null) {
|
if (action.definition.restCallType == null) {
|
||||||
throw new IllegalArgumentException("ActionDefinition needs to define a restCallType to use this action");
|
throw new IllegalArgumentException("ActionDefinition needs to define a restCallType to use this action");
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class ActivateInstitution extends RestCall<EntityProcessingReport> {
|
public class ActivateInstitution extends RestCall<EntityProcessingReport> {
|
||||||
|
|
||||||
protected ActivateInstitution() {
|
protected ActivateInstitution() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.ACTIVATION_ACTIVATE,
|
||||||
|
EntityType.INSTITUTION,
|
||||||
new TypeReference<EntityProcessingReport>() {
|
new TypeReference<EntityProcessingReport>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.INSTITUTION_ENDPOINT + API.PATH_VAR_ACTIVE);
|
API.INSTITUTION_ENDPOINT + API.PATH_VAR_ACTIVE);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class DeactivateInstitution extends RestCall<EntityProcessingReport> {
|
public class DeactivateInstitution extends RestCall<EntityProcessingReport> {
|
||||||
|
|
||||||
protected DeactivateInstitution() {
|
protected DeactivateInstitution() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.ACTIVATION_DEACTIVATE,
|
||||||
|
EntityType.INSTITUTION,
|
||||||
new TypeReference<EntityProcessingReport>() {
|
new TypeReference<EntityProcessingReport>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.INSTITUTION_ENDPOINT + API.PATH_VAR_INACTIVE);
|
API.INSTITUTION_ENDPOINT + API.PATH_VAR_INACTIVE);
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gbl.util.Result;
|
import ch.ethz.seb.sebserver.gbl.util.Result;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -28,9 +29,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class ExportSEBConfig extends RestCall<byte[]> {
|
public class ExportSEBConfig extends RestCall<byte[]> {
|
||||||
|
|
||||||
protected ExportSEBConfig() {
|
protected ExportSEBConfig() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.UNDEFINED,
|
||||||
|
EntityType.INSTITUTION,
|
||||||
new TypeReference<byte[]>() {
|
new TypeReference<byte[]>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.SEB_CONFIG_EXPORT_ENDPOINT);
|
API.SEB_CONFIG_EXPORT_ENDPOINT);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.institution.Institution;
|
import ch.ethz.seb.sebserver.gbl.model.institution.Institution;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class GetInstitution extends RestCall<Institution> {
|
public class GetInstitution extends RestCall<Institution> {
|
||||||
|
|
||||||
protected GetInstitution() {
|
protected GetInstitution() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.GET_SINGLE,
|
||||||
|
EntityType.INSTITUTION,
|
||||||
new TypeReference<Institution>() {
|
new TypeReference<Institution>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.INSTITUTION_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT);
|
API.INSTITUTION_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT);
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.EntityKey;
|
import ch.ethz.seb.sebserver.gbl.model.EntityKey;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -28,9 +29,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class GetInstitutionDependency extends RestCall<Set<EntityKey>> {
|
public class GetInstitutionDependency extends RestCall<Set<EntityKey>> {
|
||||||
|
|
||||||
protected GetInstitutionDependency() {
|
protected GetInstitutionDependency() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.GET_DEPENDENCIES,
|
||||||
|
EntityType.INSTITUTION,
|
||||||
new TypeReference<Set<EntityKey>>() {
|
new TypeReference<Set<EntityKey>>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.INSTITUTION_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT + API.DEPENDENCY_PATH_SEGMENT);
|
API.INSTITUTION_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT + API.DEPENDENCY_PATH_SEGMENT);
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.EntityName;
|
import ch.ethz.seb.sebserver.gbl.model.EntityName;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -28,9 +29,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class GetInstitutionNames extends RestCall<List<EntityName>> {
|
public class GetInstitutionNames extends RestCall<List<EntityName>> {
|
||||||
|
|
||||||
protected GetInstitutionNames() {
|
protected GetInstitutionNames() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.GET_NAMES,
|
||||||
|
EntityType.INSTITUTION,
|
||||||
new TypeReference<List<EntityName>>() {
|
new TypeReference<List<EntityName>>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.INSTITUTION_ENDPOINT + API.NAMES_PATH_SEGMENT);
|
API.INSTITUTION_ENDPOINT + API.NAMES_PATH_SEGMENT);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.Page;
|
import ch.ethz.seb.sebserver.gbl.model.Page;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.institution.Institution;
|
import ch.ethz.seb.sebserver.gbl.model.institution.Institution;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
|
@ -27,9 +28,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class GetInstitutions extends RestCall<Page<Institution>> {
|
public class GetInstitutions extends RestCall<Page<Institution>> {
|
||||||
|
|
||||||
protected GetInstitutions() {
|
protected GetInstitutions() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.GET_PAGE,
|
||||||
|
EntityType.INSTITUTION,
|
||||||
new TypeReference<Page<Institution>>() {
|
new TypeReference<Page<Institution>>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.INSTITUTION_ENDPOINT);
|
API.INSTITUTION_ENDPOINT);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.institution.Institution;
|
import ch.ethz.seb.sebserver.gbl.model.institution.Institution;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class NewInstitution extends RestCall<Institution> {
|
public class NewInstitution extends RestCall<Institution> {
|
||||||
|
|
||||||
protected NewInstitution() {
|
protected NewInstitution() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.NEW,
|
||||||
|
EntityType.INSTITUTION,
|
||||||
new TypeReference<Institution>() {
|
new TypeReference<Institution>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.INSTITUTION_ENDPOINT);
|
API.INSTITUTION_ENDPOINT);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.institution.Institution;
|
import ch.ethz.seb.sebserver.gbl.model.institution.Institution;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class SaveInstitution extends RestCall<Institution> {
|
public class SaveInstitution extends RestCall<Institution> {
|
||||||
|
|
||||||
protected SaveInstitution() {
|
protected SaveInstitution() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.SAVE,
|
||||||
|
EntityType.INSTITUTION,
|
||||||
new TypeReference<Institution>() {
|
new TypeReference<Institution>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.PUT,
|
HttpMethod.PUT,
|
||||||
MediaType.APPLICATION_JSON_UTF8,
|
MediaType.APPLICATION_JSON_UTF8,
|
||||||
API.INSTITUTION_ENDPOINT);
|
API.INSTITUTION_ENDPOINT);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class ActivateLmsSetup extends RestCall<EntityProcessingReport> {
|
public class ActivateLmsSetup extends RestCall<EntityProcessingReport> {
|
||||||
|
|
||||||
protected ActivateLmsSetup() {
|
protected ActivateLmsSetup() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.ACTIVATION_ACTIVATE,
|
||||||
|
EntityType.LMS_SETUP,
|
||||||
new TypeReference<EntityProcessingReport>() {
|
new TypeReference<EntityProcessingReport>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.LMS_SETUP_ENDPOINT + API.PATH_VAR_ACTIVE);
|
API.LMS_SETUP_ENDPOINT + API.PATH_VAR_ACTIVE);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class DeactivateLmsSetup extends RestCall<EntityProcessingReport> {
|
public class DeactivateLmsSetup extends RestCall<EntityProcessingReport> {
|
||||||
|
|
||||||
protected DeactivateLmsSetup() {
|
protected DeactivateLmsSetup() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.ACTIVATION_DEACTIVATE,
|
||||||
|
EntityType.LMS_SETUP,
|
||||||
new TypeReference<EntityProcessingReport>() {
|
new TypeReference<EntityProcessingReport>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.LMS_SETUP_ENDPOINT + API.PATH_VAR_INACTIVE);
|
API.LMS_SETUP_ENDPOINT + API.PATH_VAR_INACTIVE);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup;
|
import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class GetLmsSetup extends RestCall<LmsSetup> {
|
public class GetLmsSetup extends RestCall<LmsSetup> {
|
||||||
|
|
||||||
protected GetLmsSetup() {
|
protected GetLmsSetup() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.GET_SINGLE,
|
||||||
|
EntityType.LMS_SETUP,
|
||||||
new TypeReference<LmsSetup>() {
|
new TypeReference<LmsSetup>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.LMS_SETUP_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT);
|
API.LMS_SETUP_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT);
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET)
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ch.ethz.seb.sebserver.gui.service.remote.webservice.api.lmssetup;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.model.EntityKey;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Component
|
||||||
|
@GuiProfile
|
||||||
|
public class GetLmsSetupDependencies extends RestCall<Set<EntityKey>> {
|
||||||
|
|
||||||
|
protected GetLmsSetupDependencies() {
|
||||||
|
super(new TypeKey<>(
|
||||||
|
CallType.GET_DEPENDENCIES,
|
||||||
|
EntityType.LMS_SETUP,
|
||||||
|
new TypeReference<Set<EntityKey>>() {
|
||||||
|
}),
|
||||||
|
HttpMethod.GET,
|
||||||
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
|
API.LMS_SETUP_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT + API.DEPENDENCY_PATH_SEGMENT);
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.Page;
|
import ch.ethz.seb.sebserver.gbl.model.Page;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup;
|
import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
|
@ -27,9 +28,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class GetLmsSetups extends RestCall<Page<LmsSetup>> {
|
public class GetLmsSetups extends RestCall<Page<LmsSetup>> {
|
||||||
|
|
||||||
protected GetLmsSetups() {
|
protected GetLmsSetups() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.GET_PAGE,
|
||||||
|
EntityType.LMS_SETUP,
|
||||||
new TypeReference<Page<LmsSetup>>() {
|
new TypeReference<Page<LmsSetup>>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.LMS_SETUP_ENDPOINT);
|
API.LMS_SETUP_ENDPOINT);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup;
|
import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class NewLmsSetup extends RestCall<LmsSetup> {
|
public class NewLmsSetup extends RestCall<LmsSetup> {
|
||||||
|
|
||||||
protected NewLmsSetup() {
|
protected NewLmsSetup() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.NEW,
|
||||||
|
EntityType.LMS_SETUP,
|
||||||
new TypeReference<LmsSetup>() {
|
new TypeReference<LmsSetup>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.LMS_SETUP_ENDPOINT);
|
API.LMS_SETUP_ENDPOINT);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup;
|
import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class SaveLmsSetup extends RestCall<LmsSetup> {
|
public class SaveLmsSetup extends RestCall<LmsSetup> {
|
||||||
|
|
||||||
protected SaveLmsSetup() {
|
protected SaveLmsSetup() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.SAVE,
|
||||||
|
EntityType.LMS_SETUP,
|
||||||
new TypeReference<LmsSetup>() {
|
new TypeReference<LmsSetup>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.PUT,
|
HttpMethod.PUT,
|
||||||
MediaType.APPLICATION_JSON_UTF8,
|
MediaType.APPLICATION_JSON_UTF8,
|
||||||
API.LMS_SETUP_ENDPOINT);
|
API.LMS_SETUP_ENDPOINT);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class ActivateUserAccount extends RestCall<EntityProcessingReport> {
|
public class ActivateUserAccount extends RestCall<EntityProcessingReport> {
|
||||||
|
|
||||||
protected ActivateUserAccount() {
|
protected ActivateUserAccount() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.ACTIVATION_ACTIVATE,
|
||||||
|
EntityType.USER,
|
||||||
new TypeReference<EntityProcessingReport>() {
|
new TypeReference<EntityProcessingReport>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.USER_ACCOUNT_ENDPOINT + API.PATH_VAR_ACTIVE);
|
API.USER_ACCOUNT_ENDPOINT + API.PATH_VAR_ACTIVE);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.user.UserInfo;
|
import ch.ethz.seb.sebserver.gbl.model.user.UserInfo;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class ChangePassword extends RestCall<UserInfo> {
|
public class ChangePassword extends RestCall<UserInfo> {
|
||||||
|
|
||||||
protected ChangePassword() {
|
protected ChangePassword() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.UNDEFINED,
|
||||||
|
EntityType.USER,
|
||||||
new TypeReference<UserInfo>() {
|
new TypeReference<UserInfo>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.PUT,
|
HttpMethod.PUT,
|
||||||
MediaType.APPLICATION_JSON_UTF8,
|
MediaType.APPLICATION_JSON_UTF8,
|
||||||
API.USER_ACCOUNT_ENDPOINT + API.PASSWORD_PATH_SEGMENT);
|
API.USER_ACCOUNT_ENDPOINT + API.PASSWORD_PATH_SEGMENT);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class DeactivateUserAccount extends RestCall<EntityProcessingReport> {
|
public class DeactivateUserAccount extends RestCall<EntityProcessingReport> {
|
||||||
|
|
||||||
protected DeactivateUserAccount() {
|
protected DeactivateUserAccount() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.ACTIVATION_DEACTIVATE,
|
||||||
|
EntityType.USER,
|
||||||
new TypeReference<EntityProcessingReport>() {
|
new TypeReference<EntityProcessingReport>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.USER_ACCOUNT_ENDPOINT + API.PATH_VAR_INACTIVE);
|
API.USER_ACCOUNT_ENDPOINT + API.PATH_VAR_INACTIVE);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.user.UserInfo;
|
import ch.ethz.seb.sebserver.gbl.model.user.UserInfo;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class GetUserAccount extends RestCall<UserInfo> {
|
public class GetUserAccount extends RestCall<UserInfo> {
|
||||||
|
|
||||||
protected GetUserAccount() {
|
protected GetUserAccount() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.GET_SINGLE,
|
||||||
|
EntityType.USER,
|
||||||
new TypeReference<UserInfo>() {
|
new TypeReference<UserInfo>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.USER_ACCOUNT_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT);
|
API.USER_ACCOUNT_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.Page;
|
import ch.ethz.seb.sebserver.gbl.model.Page;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.user.UserInfo;
|
import ch.ethz.seb.sebserver.gbl.model.user.UserInfo;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
|
@ -27,9 +28,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class GetUserAccounts extends RestCall<Page<UserInfo>> {
|
public class GetUserAccounts extends RestCall<Page<UserInfo>> {
|
||||||
|
|
||||||
protected GetUserAccounts() {
|
protected GetUserAccounts() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.GET_PAGE,
|
||||||
|
EntityType.USER,
|
||||||
new TypeReference<Page<UserInfo>>() {
|
new TypeReference<Page<UserInfo>>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.USER_ACCOUNT_ENDPOINT);
|
API.USER_ACCOUNT_ENDPOINT);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.user.UserInfo;
|
import ch.ethz.seb.sebserver.gbl.model.user.UserInfo;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class NewUserAccount extends RestCall<UserInfo> {
|
public class NewUserAccount extends RestCall<UserInfo> {
|
||||||
|
|
||||||
protected NewUserAccount() {
|
protected NewUserAccount() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.NEW,
|
||||||
|
EntityType.USER,
|
||||||
new TypeReference<UserInfo>() {
|
new TypeReference<UserInfo>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.USER_ACCOUNT_ENDPOINT);
|
API.USER_ACCOUNT_ENDPOINT);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.user.UserInfo;
|
import ch.ethz.seb.sebserver.gbl.model.user.UserInfo;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
@ -26,9 +27,11 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
public class SaveUserAccount extends RestCall<UserInfo> {
|
public class SaveUserAccount extends RestCall<UserInfo> {
|
||||||
|
|
||||||
protected SaveUserAccount() {
|
protected SaveUserAccount() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.SAVE,
|
||||||
|
EntityType.USER,
|
||||||
new TypeReference<UserInfo>() {
|
new TypeReference<UserInfo>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.PUT,
|
HttpMethod.PUT,
|
||||||
MediaType.APPLICATION_JSON_UTF8,
|
MediaType.APPLICATION_JSON_UTF8,
|
||||||
API.USER_ACCOUNT_ENDPOINT);
|
API.USER_ACCOUNT_ENDPOINT);
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.springframework.http.MediaType;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.api.JSONMapper;
|
import ch.ethz.seb.sebserver.gbl.api.JSONMapper;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.institution.Institution;
|
import ch.ethz.seb.sebserver.gbl.model.institution.Institution;
|
||||||
import ch.ethz.seb.sebserver.gbl.util.Result;
|
import ch.ethz.seb.sebserver.gbl.util.Result;
|
||||||
|
@ -50,9 +51,11 @@ public class RestServiceTest extends GuiIntegrationTest {
|
||||||
public static class GetInstitution extends RestCall<Institution> {
|
public static class GetInstitution extends RestCall<Institution> {
|
||||||
|
|
||||||
public GetInstitution() {
|
public GetInstitution() {
|
||||||
super(
|
super(new TypeKey<>(
|
||||||
|
CallType.GET_SINGLE,
|
||||||
|
EntityType.INSTITUTION,
|
||||||
new TypeReference<Institution>() {
|
new TypeReference<Institution>() {
|
||||||
},
|
}),
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
MediaType.APPLICATION_FORM_URLENCODED,
|
MediaType.APPLICATION_FORM_URLENCODED,
|
||||||
API.INSTITUTION_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT);
|
API.INSTITUTION_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT);
|
||||||
|
|
Loading…
Reference in a new issue