* @throws ToscaPolicyConversionException If there is something missing from the metadata
*/
protected PolicyType fillMetadataSection(PolicyType policy,
- Map<String, String> map) throws ToscaPolicyConversionException {
+ Map<String, Object> map) throws ToscaPolicyConversionException {
//
// Ensure the policy-id exists - we don't use it here. It
// is saved in the TOSCA Policy Name field.
//
// Add in the Policy Version
//
- policy.setVersion(map.get(POLICY_VERSION));
+ policy.setVersion(String.valueOf(map.get(POLICY_VERSION)));
return policy;
}
//
// Get the policy Id
//
- String policyId = toscaPolicy.getMetadata().get(POLICY_ID);
+ String policyId = String.valueOf(toscaPolicy.getMetadata().get(POLICY_ID));
//
// Set it as the policy ID
//
//
// Policy name should be at the root
//
- String policyName = toscaPolicy.getMetadata().get(POLICY_ID);
+ String policyName = String.valueOf(toscaPolicy.getMetadata().get(POLICY_ID));
//
// Set it as the policy ID
//
}
private class TestTranslator extends StdBaseTranslator {
- public Map<String, String> metadata = new HashMap<>();
+ public Map<String, Object> metadata = new HashMap<>();
@Override
protected void scanObligations(Collection<Obligation> obligations, DecisionResponse decisionResponse) {
//
// Policy name should be at the root
//
- String policyName = toscaPolicy.getMetadata().get("policy-id");
+ String policyName = String.valueOf(toscaPolicy.getMetadata().get("policy-id"));
//
// Set it as the policy ID
//
* @param map The Metadata TOSCA Map
* @return Same Policy Object
*/
- protected PolicyType fillMetadataSection(PolicyType policy, Map<String, String> map) {
+ protected PolicyType fillMetadataSection(PolicyType policy, Map<String, Object> map) {
//
// NOTE: The models code ensures the metadata section ALWAYS exists
//
//
// Add in the Policy Version
//
- policy.setVersion(map.get("policy-version"));
+ policy.setVersion(String.valueOf(map.get("policy-version")));
return policy;
}
// Here is our policy with a version and default combining algo
//
var newPolicyType = new PolicyType();
- newPolicyType.setPolicyId(toscaPolicy.getMetadata().get("policy-id"));
- newPolicyType.setVersion(toscaPolicy.getMetadata().get("policy-version"));
+ newPolicyType.setPolicyId(String.valueOf(toscaPolicy.getMetadata().get("policy-id")));
+ newPolicyType.setVersion(String.valueOf(toscaPolicy.getMetadata().get("policy-version")));
//
// When choosing the rule combining algorithm, be sure to be mindful of the
// setting xacml.att.policyFinderFactory.combineRootPolicies in the