/*******************************************************************************
 *  Copyright (c) 2017 Universitat Politécnica de Catalunya (UPC)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *  Contributors:
 *  	Edith Zavala
 *******************************************************************************/

package org.loopa.generic.documents.managers;

import java.util.HashMap;
import java.util.Map;

import org.loopa.comm.message.IMessage;
import org.loopa.generic.documents.IPolicy;
import org.loopa.generic.documents.Policy;
import org.loopa.generic.element.component.ILoopAElementComponent;

public abstract class APolicyManager implements IPolicyManager {

	private IPolicy activePolicy;
	private ILoopAElementComponent component;

	public APolicyManager(IPolicy policy) {
		super();
		this.activePolicy = policy;
	}

	@Override
	public void processPolicy(IMessage m) {
		Map<String, String> content = new HashMap<String, String>();
		content.put("policyContent", m.getMessageContent().get("policy"));
		IPolicy p = new Policy(m.getMessageContent().get("tytpe"), content);
		this.activePolicy.update(p);
	}

	@Override
	public void setComponent(ILoopAElementComponent c) {
		this.component = c;
	}

	@Override
	public ILoopAElementComponent getComponent() {
		return this.component;
	}

	@Override
	public IPolicy getActivePolicy() {
		return getPolicy();
	}

	public IPolicy getPolicy() {
		return activePolicy;
	}

	public void setPolicy(IPolicy newPolicy) {
		this.activePolicy = newPolicy;
	}

}

@@ -1464,16 +1464,118 @@
 g%3E();%0A%09%09
+//Convert %22policy%22 (String of key:value) into a HashMap and pass it directly as the policyContent%0A%09%09/*
 content.
@@ -1632,16 +1632,18 @@
 licy%22));
+*/
 %0A%09%09IPoli
@@ -1689,17 +1689,16 @@
 .get(%22ty
-t
 pe%22), co

Add note to PolicyManager processPolicy method