/*
 * Copyright 2014 Open mHealth
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.openmhealth.dsu.domain;

/**
 * The modality of a data point. The modality represents whether the data point was sensed by a device or
 * application, or whether it was reported by the user.
 *
 * @author Emerson Farrugia
 */
public enum DataPointModality {

    SENSED,
    SELF_REPORTED
}

@@ -627,16 +627,205 @@
 omain;%0A%0A
+import com.fasterxml.jackson.annotation.JsonCreator;%0Aimport com.fasterxml.jackson.annotation.JsonValue;%0A%0Aimport javax.annotation.Nullable;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0A%0A
 /**%0A * T
@@ -1079,11 +1079,537 @@
 REPORTED
+;%0A%0A    private static Map%3CString, DataPointModality%3E constantsByJsonValue = new HashMap%3C%3E();%0A%0A    static %7B%0A        for (DataPointModality constant : values()) %7B%0A            constantsByJsonValue.put(constant.getJsonValue(), constant);%0A        %7D%0A    %7D%0A%0A    @JsonValue%0A    public String getJsonValue() %7B%0A        return name().toLowerCase().replaceAll(%22_%22, %22 %22);%0A    %7D%0A%0A    @JsonCreator%0A    @Nullable%0A    public static DataPointModality findByJsonValue(String jsonValue) %7B%0A        return constantsByJsonValue.get(jsonValue);%0A    %7D
 %0A%7D%0A

Add JSON value mapping to modality enumeration.