The backend had to be slightly fixed so that the json generation without being in a loop is not an issue. This is required for the policies listing feature
Issue-ID: POLICY-2926
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: Ia6a9e034f888384999a8ea557ce550c87c65c4be
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.clamp.clds.tosca.update.execution.cds;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import org.onap.policy.clamp.clds.tosca.ToscaSchemaConstants;
import org.onap.policy.clamp.clds.tosca.ToscaSchemaConstants;
import org.onap.policy.clamp.clds.tosca.update.execution.ToscaMetadataProcess;
+import org.onap.policy.clamp.clds.tosca.update.execution.target.ToscaMetadataTargetProcess;
import org.onap.policy.clamp.loop.service.Service;
*/
public class ToscaMetadataCdsProcess extends ToscaMetadataProcess {
+ private static final EELFLogger logger =
+ EELFManager.getInstance().getLogger(ToscaMetadataCdsProcess.class);
+
@Override
public void executeProcess(String parameters, JsonObject childObject, Service serviceModel) {
+ if (serviceModel == null) {
+ logger.info("serviceModel is null, therefore the ToscaMetadataCdsProcess is skipped");
+ return;
+ }
switch (parameters) {
case "actor":
JsonArray jsonArray = new JsonArray();
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.clamp.clds.tosca.update.execution.target;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import com.google.gson.JsonObject;
+import org.onap.policy.clamp.clds.tosca.update.execution.ToscaMetadataExecutor;
import org.onap.policy.clamp.clds.tosca.update.execution.ToscaMetadataProcess;
import org.onap.policy.clamp.loop.service.Service;
import org.onap.policy.clamp.policy.operational.OperationalPolicyRepresentationBuilder;
*/
public class ToscaMetadataTargetProcess extends ToscaMetadataProcess {
+ private static final EELFLogger logger =
+ EELFManager.getInstance().getLogger(ToscaMetadataTargetProcess.class);
+
@Override
public void executeProcess(String parameters, JsonObject childObject, Service serviceModel) {
+ if (serviceModel == null) {
+ logger.info("serviceModel is null, therefore the ToscaMetadataTargetProcess is skipped");
+ return;
+ }
childObject.add("anyOf", OperationalPolicyRepresentationBuilder.createAnyOfArray(serviceModel, false));
}
}
JsonArray requirements = new JsonArray();
ToscaElement toParse = components.get(nameComponent);
//Check for a father component, and launch the same process
- if (!toParse.getDerivedFrom().equals("tosca.datatypes.Root")
- && !toParse.getDerivedFrom().equals("tosca.policies.Root")) {
+ if (!"tosca.datatypes.Root".equals(toParse.getDerivedFrom())
+ && !"tosca.policies.Root".equals(toParse.getDerivedFrom())) {
requirements.addAll(getRequirements(toParse.getDerivedFrom()));
}
//Each property is checked, and add to the requirement array if it's required
type: policy.data.increment-sequence
required: false
policy.data.increment-sequence:
- derived_from: tosca.nodes.Root
+ derived_from: tosca.datatypes.Root
properties:
scope:
type: list