JpaSoftwareModule#metadata made map (#2412)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -9,11 +9,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
import java.util.AbstractMap.SimpleImmutableEntry;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -28,32 +24,18 @@ public enum SoftwareModuleFields implements RsqlQueryField {
|
||||
NAME("name"),
|
||||
DESCRIPTION("description"),
|
||||
VERSION("version"),
|
||||
METADATA("metadata", new SimpleImmutableEntry<>("key", "value"));
|
||||
METADATA("metadata");
|
||||
|
||||
private final String jpaEntityFieldName;
|
||||
private final List<String> subEntityAttributes;
|
||||
private final Entry<String, String> subEntityMapTuple;
|
||||
|
||||
SoftwareModuleFields(final String jpaEntityFieldName) {
|
||||
this(jpaEntityFieldName, Collections.emptyList(), null);
|
||||
}
|
||||
|
||||
SoftwareModuleFields(final String jpaEntityFieldName, final String... subEntityAttributes) {
|
||||
this(jpaEntityFieldName, List.of(subEntityAttributes), null);
|
||||
}
|
||||
|
||||
SoftwareModuleFields(final String jpaEntityFieldName, final Entry<String, String> subEntityMapTuple) {
|
||||
this(jpaEntityFieldName, Collections.emptyList(), subEntityMapTuple);
|
||||
}
|
||||
|
||||
SoftwareModuleFields(final String jpaEntityFieldName, List<String> subEntityAttributes, final Entry<String, String> subEntityMapTuple) {
|
||||
this.jpaEntityFieldName = jpaEntityFieldName;
|
||||
this.subEntityMapTuple = subEntityMapTuple;
|
||||
this.subEntityAttributes = subEntityAttributes;
|
||||
this.subEntityAttributes = List.of(subEntityAttributes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Entry<String, String>> getSubEntityMapTuple() {
|
||||
return Optional.ofNullable(subEntityMapTuple);
|
||||
public boolean isMap() {
|
||||
return this == METADATA;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Sort fields for SoftwareModuleMetadata.
|
||||
*/
|
||||
@Getter
|
||||
public enum SoftwareModuleMetadataFields implements RsqlQueryField {
|
||||
|
||||
KEY("key"),
|
||||
VALUE("value"),
|
||||
TARGETVISIBLE("targetVisible");
|
||||
|
||||
private final String jpaEntityFieldName;
|
||||
|
||||
SoftwareModuleMetadataFields(final String jpaEntityFieldName) {
|
||||
this.jpaEntityFieldName = jpaEntityFieldName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String identifierFieldName() {
|
||||
return KEY.getJpaEntityFieldName();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user