/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.util.Base64;
import java.util.Date;
import java.util.List;
-import java.util.Map;
import java.util.Properties;
-
import javax.ws.rs.core.Response;
-
import lombok.NonNull;
-
import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.authorative.provider.AuthorativeToscaProvider;
-import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
-import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
import org.onap.policy.models.tosca.legacy.provider.LegacyProvider;
import org.slf4j.Logger;
}
private String getValue(final String value) {
- if (value != null && value.matches("[$][{].*[}]$")) {
+ if (value != null && value.startsWith("${") && value.endsWith("}")) {
return System.getenv(value.substring(2, value.length() - 1));
}
return value;
return new LegacyProvider().deleteOperationalPolicy(pfDao, policyId, policyVersion);
}
- @Override
- public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(@NonNull final String policyId,
- final String policyVersion) throws PfModelException {
- assertInitialized();
- return new LegacyProvider().getGuardPolicy(pfDao, policyId, policyVersion);
- }
-
- @Override
- public Map<String, LegacyGuardPolicyOutput>
- createGuardPolicy(@NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
- assertInitialized();
- return new LegacyProvider().createGuardPolicy(pfDao, legacyGuardPolicy);
- }
-
- @Override
- public Map<String, LegacyGuardPolicyOutput>
- updateGuardPolicy(@NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
- assertInitialized();
- return new LegacyProvider().updateGuardPolicy(pfDao, legacyGuardPolicy);
- }
-
- @Override
- public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(@NonNull final String policyId,
- @NonNull final String policyVersion) throws PfModelException {
- assertInitialized();
-
- assertPolicyNotDeployedInPdpGroup(
- new ToscaPolicyIdentifier(policyId, policyVersion + LegacyProvider.LEGACY_MINOR_PATCH_SUFFIX));
-
- return new LegacyProvider().deleteGuardPolicy(pfDao, policyId, policyVersion);
- }
-
@Override
public List<PdpGroup> getPdpGroups(final String name) throws PfModelException {
assertInitialized();