TargetType management over common RepositoryManagement (#2581)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -24,6 +24,7 @@ import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroupConditionBuilder;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
|
||||
@@ -314,7 +315,7 @@ public class JsonBuilder {
|
||||
for (final TargetType type : types) {
|
||||
|
||||
final JSONArray dsTypes = new JSONArray();
|
||||
type.getCompatibleDistributionSetTypes().forEach(dsType -> {
|
||||
type.getDistributionSetTypes().forEach(dsType -> {
|
||||
try {
|
||||
dsTypes.put(new JSONObject().put("id", dsType.getId()));
|
||||
} catch (final JSONException e1) {
|
||||
@@ -332,6 +333,30 @@ public class JsonBuilder {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static String targetTypesCreate(final List<TargetTypeManagement.Create> types) throws JSONException {
|
||||
final JSONArray result = new JSONArray();
|
||||
|
||||
for (final TargetTypeManagement.Create type : types) {
|
||||
|
||||
final JSONArray dsTypes = new JSONArray();
|
||||
type.getDistributionSetTypes().forEach(dsType -> {
|
||||
try {
|
||||
dsTypes.put(new JSONObject().put("id", dsType));
|
||||
} catch (final JSONException e1) {
|
||||
log.error("JSONException (skip)", e1);
|
||||
}
|
||||
});
|
||||
|
||||
result.put(new JSONObject().put("name", type.getName()).put("description", type.getDescription())
|
||||
.put("id", Long.MAX_VALUE).put("colour", type.getColour()).put("createdAt", "0")
|
||||
.put("updatedAt", "0").put("createdBy", "fghdfkjghdfkjh").put("updatedBy", "fghdfkjghdfkjh")
|
||||
.put("distributionsets", dsTypes));
|
||||
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static String rollout(final String name, final String description, final int groupSize,
|
||||
final long distributionSetId, final String targetFilterQuery, final RolloutGroupConditions conditions) {
|
||||
return rollout(name, description, groupSize, distributionSetId, targetFilterQuery, conditions, null, null, null,
|
||||
|
||||
Reference in New Issue
Block a user