Skip to content

Commit

Permalink
add setPartial to PropertyCommonRequestHeader and use it where approp…
Browse files Browse the repository at this point in the history
…riate.
  • Loading branch information
atsushieno committed Mar 6, 2024
1 parent 06c97a5 commit fe5995d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
10 changes: 6 additions & 4 deletions ktmidi-ci/api/android/ktmidi-ci.api
Original file line number Diff line number Diff line change
Expand Up @@ -1455,23 +1455,25 @@ public final class dev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRe
}

public final class dev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRequestHeader {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Ljava/lang/String;
public final fun component5 ()Ljava/lang/Integer;
public final fun component6 ()Ljava/lang/Integer;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;)Ldev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRequestHeader;
public static synthetic fun copy$default (Ldev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRequestHeader;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;ILjava/lang/Object;)Ldev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRequestHeader;
public final fun component7 ()Ljava/lang/Boolean;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;)Ldev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRequestHeader;
public static synthetic fun copy$default (Ldev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRequestHeader;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;ILjava/lang/Object;)Ldev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRequestHeader;
public fun equals (Ljava/lang/Object;)Z
public final fun getLimit ()Ljava/lang/Integer;
public final fun getMediaType ()Ljava/lang/String;
public final fun getMutualEncoding ()Ljava/lang/String;
public final fun getOffset ()Ljava/lang/Integer;
public final fun getResId ()Ljava/lang/String;
public final fun getResource ()Ljava/lang/String;
public final fun getSetPartial ()Ljava/lang/Boolean;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
Expand Down
10 changes: 6 additions & 4 deletions ktmidi-ci/api/jvm/ktmidi-ci.api
Original file line number Diff line number Diff line change
Expand Up @@ -1455,23 +1455,25 @@ public final class dev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRe
}

public final class dev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRequestHeader {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Ljava/lang/String;
public final fun component5 ()Ljava/lang/Integer;
public final fun component6 ()Ljava/lang/Integer;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;)Ldev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRequestHeader;
public static synthetic fun copy$default (Ldev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRequestHeader;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;ILjava/lang/Object;)Ldev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRequestHeader;
public final fun component7 ()Ljava/lang/Boolean;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;)Ldev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRequestHeader;
public static synthetic fun copy$default (Ldev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRequestHeader;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;ILjava/lang/Object;)Ldev/atsushieno/ktmidi/ci/propertycommonrules/PropertyCommonRequestHeader;
public fun equals (Ljava/lang/Object;)Z
public final fun getLimit ()Ljava/lang/Integer;
public final fun getMediaType ()Ljava/lang/String;
public final fun getMutualEncoding ()Ljava/lang/String;
public final fun getOffset ()Ljava/lang/Integer;
public final fun getResId ()Ljava/lang/String;
public final fun getResource ()Ljava/lang/String;
public final fun getSetPartial ()Ljava/lang/Boolean;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ class CommonRulesPropertyService(private val device: MidiCIDevice)
json.getObjectValue(PropertyCommonHeaderKeys.MEDIA_TYPE)?.stringValue,
json.getObjectValue(PropertyCommonHeaderKeys.OFFSET)?.numberValue?.toInt(),
json.getObjectValue(PropertyCommonHeaderKeys.LIMIT)?.numberValue?.toInt(),
json.getObjectValue(PropertyCommonHeaderKeys.SET_PARTIAL)?.isBooleanTrue,
)
private fun getReplyHeaderJson(src: PropertyCommonReplyHeader) = Json.JsonValue(mutableMapOf(
Pair(Json.JsonValue(PropertyCommonHeaderKeys.STATUS), Json.JsonValue(src.status.toDouble()))
Expand Down Expand Up @@ -269,7 +270,7 @@ class CommonRulesPropertyService(private val device: MidiCIDevice)
val decodedBody = decodeBody(header.mutualEncoding, body)
// Perform partial updates, if applicable
val existing = values.firstOrNull { it.id == header.resource }
if (headerJson.getObjectValue(PropertyCommonHeaderKeys.SET_PARTIAL)?.isBooleanTrue == true) {
if (header.setPartial == true) {
if (existing == null) {
logger.logError("Partial update is specified but there is no existing value for property ${header.resource}")
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ data class PropertyCommonRequestHeader(
val mediaType: String? = CommonRulesKnownMimeTypes.APPLICATION_JSON,
// M2-103-UM 6.6.2 Pagination
val offset: Int? = null,
val limit: Int? = null
val limit: Int? = null,
// M2-103-UM 8 Full and Partial SET Inquiries
val setPartial: Boolean? = null
)

// required fields are non-null, optionals are nullable
Expand Down

0 comments on commit fe5995d

Please sign in to comment.