private void printHistory(Map<CtxHistoryAttribute, List<CtxHistoryAttribute>> mapHocData) {
    int i = 0;
    for (CtxHistoryAttribute ctxHocAttr : mapHocData.keySet()) {

      try {
        IAction action =
            (IAction)
                SerialisationHelper.deserialise(
                    ctxHocAttr.getBinaryValue(), this.getClass().getClassLoader());
        List<CtxHistoryAttribute> escortingAttrList = mapHocData.get(ctxHocAttr);
        System.out.println(
            i
                + " primary Attr: {"
                + action.getparameterName()
                + " "
                + action.getvalue()
                + "} escorting: {"
                + escortingAttrList.get(0).getStringValue()
                + " "
                + escortingAttrList.get(1).getStringValue()
                + " "
                + escortingAttrList.get(2).getStringValue()
                + "}");
        i++;

      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
  /*
   * (non-Javadoc)
   * @see org.societies.api.internal.privacytrust.privacyprotection.IPrivacyAgreementManager#getAgreement(org.societies.api.identity.Requestor)
   */
  @Override
  public AgreementEnvelope getAgreement(Requestor requestor) throws PrivacyException {
    // -- Verify
    if (null == requestor || null == requestor.getRequestorId()) {
      throw new PrivacyException(
          "Not enought information to search a privacy policy agreement. Requestor needed.");
    }
    // Dependency injection not ready
    if (!isDepencyInjectionDone()) {
      throw new PrivacyException("[Dependency Injection] PrivacyPolicyAgreementManager not ready");
    }

    try {
      List<CtxIdentifier> agreementIdList =
          ctxBroker
              .lookup(
                  CtxModelType.ATTRIBUTE, PrivacyAgreementManagerInternal.getRequestorId(requestor))
              .get();
      if (null == agreementIdList || agreementIdList.size() <= 0) {
        return null;
      }
      CtxIdentifier agreementId = agreementIdList.get(0);
      CtxAttribute agreementData = (CtxAttribute) ctxBroker.retrieve(agreementId).get();
      org.societies.api.internal.schema.privacytrust.privacyprotection.model.privacypolicy
              .AgreementEnvelope
          agreementTmp =
              (org.societies.api.internal.schema.privacytrust.privacyprotection.model.privacypolicy
                      .AgreementEnvelope)
                  SerialisationHelper.deserialise(
                      agreementData.getBinaryValue(),
                      this.getClass().getClassLoader()); // ClassLoader.getSystemClassLoader());
      if (null == agreementTmp) {
        throw new NullPointerException("NullPointerException Deserialized agreement is null");
      }
      AgreementEnvelope agreement =
          AgreementEnvelopeUtils.toAgreementEnvelope(agreementTmp, commManager.getIdManager());
      return agreement;
    } catch (CtxException e) {
      LOG.error("[Error getAgreement] Can't find the agreement. Context error.", e);
    } catch (IOException e) {
      LOG.error("[Error getAgreement] Can't find the agreement. IO error.", e);
    } catch (ClassNotFoundException e) {
      LOG.error("[Error getAgreement] Can't find the agreement. ClassNotFound error.", e);
    } catch (InterruptedException e) {
      LOG.error("[Error getAgreement] Can't find the agreement.", e);
    } catch (ExecutionException e) {
      LOG.error("[Error getAgreement] Can't find the agreement.", e);
    } catch (InvalidFormatException e) {
      LOG.error(
          "[Error getAgreement] Can't transform the agreement into a bean for serialization.", e);
    }
    return null;
  }
 private CtxHistoryAttribute createMockHocActionAttr(IAction action) {
   CtxHistoryAttribute ctxHocAttr = null;
   try {
     CtxAttributeIdentifier ctxAttrID =
         new CtxAttributeIdentifier(
             operator.getId(), CtxAttributeTypes.LAST_ACTION, getNextValue());
     CtxAttribute ctxAttr = new CtxAttribute(ctxAttrID);
     ctxAttr.setBinaryValue(SerialisationHelper.serialise(action));
     ctxHocAttr = new CtxHistoryAttribute(ctxAttr, getNextValue());
   } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return ctxHocAttr;
 }