code cleanup
This commit is contained in:
parent
e5879f7809
commit
2e18ce3382
7 changed files with 57 additions and 36 deletions
|
@ -14,20 +14,25 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class EntityDependency implements Comparable<EntityDependency> {
|
||||
|
||||
@JsonProperty(value = "parent", required = true)
|
||||
public static final String ATTR_PARENT = "parent";
|
||||
public static final String ATTR_SELF = "self";
|
||||
public static final String ATTR_NAME = "name";
|
||||
public static final String ATTR_DESCRIPTION = "description";
|
||||
|
||||
@JsonProperty(value = ATTR_PARENT, required = true)
|
||||
public final EntityKey parent;
|
||||
@JsonProperty(value = "self", required = true)
|
||||
@JsonProperty(value = ATTR_SELF, required = true)
|
||||
public final EntityKey self;
|
||||
@JsonProperty(value = "name", required = true)
|
||||
@JsonProperty(value = ATTR_NAME, required = true)
|
||||
public final String name;
|
||||
@JsonProperty(value = "description", required = false)
|
||||
@JsonProperty(ATTR_DESCRIPTION)
|
||||
public final String description;
|
||||
|
||||
public EntityDependency(
|
||||
@JsonProperty(value = "parent", required = true) final EntityKey parent,
|
||||
@JsonProperty(value = "self", required = true) final EntityKey self,
|
||||
@JsonProperty(value = "name", required = true) final String name,
|
||||
@JsonProperty(value = "description", required = false) final String description) {
|
||||
@JsonProperty(value = ATTR_PARENT, required = true) final EntityKey parent,
|
||||
@JsonProperty(value = ATTR_SELF, required = true) final EntityKey self,
|
||||
@JsonProperty(value = ATTR_NAME, required = true) final String name,
|
||||
@JsonProperty(ATTR_DESCRIPTION) final String description) {
|
||||
|
||||
this.parent = parent;
|
||||
this.self = self;
|
||||
|
|
|
@ -24,14 +24,16 @@ import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
|||
public class EntityKey implements ModelIdAware, Serializable, Comparable<EntityKey> {
|
||||
|
||||
private static final long serialVersionUID = -2368065921846821061L;
|
||||
public static final String ATTR_MODEL_ID = "modelId";
|
||||
public static final String ATTR_ENTITY_TYPE = "entityType";
|
||||
|
||||
/** The model identifier of the entity */
|
||||
@JsonProperty(value = "modelId", required = true)
|
||||
@JsonProperty(value = ATTR_MODEL_ID, required = true)
|
||||
@NotNull
|
||||
public final String modelId;
|
||||
|
||||
/** The type of the entity */
|
||||
@JsonProperty(value = "entityType", required = true)
|
||||
@JsonProperty(value = ATTR_ENTITY_TYPE, required = true)
|
||||
@NotNull
|
||||
public final EntityType entityType;
|
||||
|
||||
|
@ -40,8 +42,8 @@ public class EntityKey implements ModelIdAware, Serializable, Comparable<EntityK
|
|||
|
||||
@JsonCreator
|
||||
public EntityKey(
|
||||
@JsonProperty(value = "modelId", required = true) final String modelId,
|
||||
@JsonProperty(value = "entityType", required = true) final EntityType entityType) {
|
||||
@JsonProperty(value = ATTR_MODEL_ID, required = true) final String modelId,
|
||||
@JsonProperty(value = ATTR_ENTITY_TYPE, required = true) final EntityType entityType) {
|
||||
|
||||
if (modelId == null) {
|
||||
throw new IllegalArgumentException("modelId has null reference");
|
||||
|
|
|
@ -21,14 +21,16 @@ public class EntityName extends EntityKey {
|
|||
|
||||
private static final long serialVersionUID = 9577137222563155L;
|
||||
|
||||
@JsonProperty(value = "name", required = true)
|
||||
public static final String ATTR_NAME = "name";
|
||||
|
||||
@JsonProperty(value = ATTR_NAME, required = true)
|
||||
public final String name;
|
||||
|
||||
@JsonCreator
|
||||
public EntityName(
|
||||
@JsonProperty(value = API.PARAM_MODEL_ID, required = true) final String id,
|
||||
@JsonProperty(value = API.PARAM_ENTITY_TYPE, required = true) final EntityType entityType,
|
||||
@JsonProperty(value = "name", required = true) final String name) {
|
||||
@JsonProperty(value = ATTR_NAME, required = true) final String name) {
|
||||
|
||||
super(id, entityType);
|
||||
this.name = name;
|
||||
|
|
|
@ -26,23 +26,27 @@ import ch.ethz.seb.sebserver.gbl.util.Utils;
|
|||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class EntityProcessingReport {
|
||||
|
||||
public static final String ATTR_SOURCE = "source";
|
||||
public static final String ATTR_RESULTS = "results";
|
||||
public static final String ATTR_ERRORS = "errors";
|
||||
|
||||
/** A set of entity-keys that are or were processed by a bulk action- or other process with a EntityProcessingReport
|
||||
* result. */
|
||||
@JsonProperty(value = "source", required = true)
|
||||
@JsonProperty(value = ATTR_SOURCE, required = true)
|
||||
public final Set<EntityKey> source;
|
||||
/** A set of entity-keys for all entities that has been detected as dependency to one or more of the source entities
|
||||
* during the process */
|
||||
@JsonProperty(value = "results", required = true)
|
||||
@JsonProperty(value = ATTR_RESULTS, required = true)
|
||||
public final Set<EntityKey> results;
|
||||
/** A set of error entries that defines an error if happened. */
|
||||
@JsonProperty(value = "errors", required = true)
|
||||
@JsonProperty(value = ATTR_ERRORS, required = true)
|
||||
public final Set<ErrorEntry> errors;
|
||||
|
||||
@JsonCreator
|
||||
public EntityProcessingReport(
|
||||
@JsonProperty(value = "source", required = true) final Collection<EntityKey> source,
|
||||
@JsonProperty(value = "results", required = true) final Collection<EntityKey> results,
|
||||
@JsonProperty(value = "errors", required = true) final Collection<ErrorEntry> errors) {
|
||||
@JsonProperty(value = ATTR_SOURCE, required = true) final Collection<EntityKey> source,
|
||||
@JsonProperty(value = ATTR_RESULTS, required = true) final Collection<EntityKey> results,
|
||||
@JsonProperty(value = ATTR_ERRORS, required = true) final Collection<ErrorEntry> errors) {
|
||||
|
||||
this.source = Utils.immutableSetOf(source);
|
||||
this.results = Utils.immutableSetOf(results);
|
||||
|
|
|
@ -20,18 +20,22 @@ import ch.ethz.seb.sebserver.gbl.util.Utils;
|
|||
|
||||
public class ClientConnectionData {
|
||||
|
||||
@JsonProperty("clientConnection")
|
||||
public static final String ATTR_CLIENT_CONNECTION = "clientConnection";
|
||||
public static final String ATTR_INDICATOR_VALUE = "indicatorValues";
|
||||
public static final String ATTR_MISSING_PING = "missingPing";
|
||||
|
||||
@JsonProperty(ATTR_CLIENT_CONNECTION)
|
||||
public final ClientConnection clientConnection;
|
||||
@JsonProperty("indicatorValues")
|
||||
@JsonProperty(ATTR_INDICATOR_VALUE)
|
||||
public final List<? extends IndicatorValue> indicatorValues;
|
||||
|
||||
public final Boolean missingPing;
|
||||
|
||||
@JsonCreator
|
||||
public ClientConnectionData(
|
||||
@JsonProperty("missingPing") final Boolean missingPing,
|
||||
@JsonProperty("clientConnection") final ClientConnection clientConnection,
|
||||
@JsonProperty("indicatorValues") final Collection<? extends SimpleIndicatorValue> indicatorValues) {
|
||||
@JsonProperty(ATTR_MISSING_PING) final Boolean missingPing,
|
||||
@JsonProperty(ATTR_CLIENT_CONNECTION) final ClientConnection clientConnection,
|
||||
@JsonProperty(ATTR_INDICATOR_VALUE) final Collection<? extends SimpleIndicatorValue> indicatorValues) {
|
||||
|
||||
this.missingPing = missingPing;
|
||||
this.clientConnection = clientConnection;
|
||||
|
@ -47,7 +51,7 @@ public class ClientConnectionData {
|
|||
this.indicatorValues = Utils.immutableListOf(indicatorValues);
|
||||
}
|
||||
|
||||
@JsonProperty("missingPing")
|
||||
@JsonProperty(ATTR_MISSING_PING)
|
||||
public Boolean getMissingPing() {
|
||||
return this.missingPing;
|
||||
}
|
||||
|
|
|
@ -16,21 +16,26 @@ import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup.LmsType;
|
|||
|
||||
public final class RunningExamInfo {
|
||||
|
||||
@JsonProperty("examId")
|
||||
public static final String ATTR_EXAM_ID = "examId";
|
||||
public static final String ATTR_NAME = "name";
|
||||
public static final String ATTR_URL = "url";
|
||||
public static final String ATTR_LMS_TYPE = "lmsType";
|
||||
|
||||
@JsonProperty(ATTR_EXAM_ID)
|
||||
public final String examId;
|
||||
@JsonProperty("name")
|
||||
@JsonProperty(ATTR_NAME)
|
||||
public final String name;
|
||||
@JsonProperty("url")
|
||||
@JsonProperty(ATTR_URL)
|
||||
public final String url;
|
||||
@JsonProperty("lmsType")
|
||||
@JsonProperty(ATTR_LMS_TYPE)
|
||||
public final String lmsType;
|
||||
|
||||
@JsonCreator
|
||||
public RunningExamInfo(
|
||||
@JsonProperty("examId") final String examId,
|
||||
@JsonProperty("name") final String name,
|
||||
@JsonProperty("url") final String url,
|
||||
@JsonProperty("lmsType") final String lmsType) {
|
||||
@JsonProperty(ATTR_EXAM_ID) final String examId,
|
||||
@JsonProperty(ATTR_NAME) final String name,
|
||||
@JsonProperty(ATTR_URL) final String url,
|
||||
@JsonProperty(ATTR_LMS_TYPE) final String lmsType) {
|
||||
|
||||
this.examId = examId;
|
||||
this.name = name;
|
||||
|
|
|
@ -105,8 +105,7 @@ public interface LmsAPITemplate {
|
|||
|
||||
Result<QuizData> getQuizFromCache(String id);
|
||||
|
||||
// TODO this can be used in a future release to resolve examinee's account detail information by an
|
||||
// examinee identifier received by on SEB-Client connection.
|
||||
// TODO
|
||||
//Result<ExamineeAccountDetails> getExamineeAccountDetails(String examineeUserId);
|
||||
|
||||
/** Used to get a list of chapters (display name and chapter-identifier) that can be used to
|
||||
|
|
Loading…
Add table
Reference in a new issue