@Override
 public String[] getActivePolicies() {
   log.debug("Start retrieving active policies at : " + new Date());
   List<String> policies = new ArrayList<String>();
   String[] policyIdentifiers = getOrderedPolicyIdentifiers();
   if (policyIdentifiers != null) {
     for (String identifier : policyIdentifiers) {
       if (!isPolicyDeActivationSupport()) {
         PolicyStoreDTO data =
             EntitlementAdminEngine.getInstance().getPolicyDataStore().getPolicyData(identifier);
         if (data != null && data.isActive()) {
           String policy = getPolicy(identifier);
           if (policy != null) {
             policies.add(policy);
           }
         }
       } else {
         String policy = getPolicy(identifier);
         if (policy != null) {
           policies.add(policy);
         }
       }
     }
   }
   log.debug("Finish retrieving active policies at : " + new Date());
   return policies.toArray(new String[policies.size()]);
 }
  @Override
  public String[] getOrderedPolicyIdentifiers() {

    log.debug("Start retrieving ordered policy identifiers at : " + new Date());
    String[] policyIdentifiers = getPolicyIdentifiers();
    if (policyIdentifiers != null && !isPolicyOrderingSupport()) {
      PolicyStoreDTO[] policyDTOs =
          EntitlementAdminEngine.getInstance().getPolicyStoreManager().getAllPolicyData();
      Arrays.sort(policyDTOs, new PolicyOrderComparator());
      List<String> list = new ArrayList<String>();
      List<String> finalList = new ArrayList<String>();
      // 1st put non -order items
      list.addAll(Arrays.asList(policyIdentifiers));
      for (PolicyStoreDTO dto : policyDTOs) {
        list.remove(dto.getPolicyId());
        finalList.add(dto.getPolicyId());
      }
      finalList.addAll(list);
      return finalList.toArray(new String[finalList.size()]);
    }
    log.debug("Finish retrieving ordered policy identifiers at : " + new Date());
    return policyIdentifiers;
  }