use of org.nhindirect.config.model.CertPolicyGroupUse in project nhin-d by DirectProject.
the class RESTSmtpAgentConfig method buildPolicyResolvers.
@Override
protected void buildPolicyResolvers() {
final Map<String, Collection<PolicyExpression>> incomingPrivatePolicies = new HashMap<String, Collection<PolicyExpression>>();
final Map<String, Collection<PolicyExpression>> outgoingPrivatePolicies = new HashMap<String, Collection<PolicyExpression>>();
final Map<String, Collection<PolicyExpression>> incomingPublicPolicies = new HashMap<String, Collection<PolicyExpression>>();
final Map<String, Collection<PolicyExpression>> outgoingPublicPolicies = new HashMap<String, Collection<PolicyExpression>>();
final Map<String, Collection<PolicyExpression>> trustPolicies = new HashMap<String, Collection<PolicyExpression>>();
Collection<CertPolicyGroupDomainReltn> domainReltns = null;
try {
// get all of the policy group to domain relations...
// doing this all in one call for efficiency
domainReltns = policyService.getPolicyGroupDomainReltns();
} catch (Exception e) {
throw new SmtpAgentException(SmtpAgentError.InvalidConfigurationFormat, "WebService error getting certificate policy configuration: " + e.getMessage(), e);
}
if (domainReltns != null) {
for (CertPolicyGroupDomainReltn domainReltn : domainReltns) {
if (domainReltn.getPolicyGroup().getPolicies() != null) {
for (CertPolicyGroupUse policyReltn : domainReltn.getPolicyGroup().getPolicies()) {
if (policyReltn.getPolicyUse().equals(CertPolicyUse.PRIVATE_RESOLVER)) {
if (policyReltn.isIncoming())
addPolicyToMap(incomingPrivatePolicies, domainReltn.getDomain().getDomainName(), policyReltn);
if (policyReltn.isOutgoing())
addPolicyToMap(outgoingPrivatePolicies, domainReltn.getDomain().getDomainName(), policyReltn);
} else if (policyReltn.getPolicyUse().equals(CertPolicyUse.PUBLIC_RESOLVER)) {
if (policyReltn.isIncoming())
addPolicyToMap(incomingPublicPolicies, domainReltn.getDomain().getDomainName(), policyReltn);
if (policyReltn.isOutgoing())
addPolicyToMap(outgoingPublicPolicies, domainReltn.getDomain().getDomainName(), policyReltn);
} else if (policyReltn.getPolicyUse().equals(CertPolicyUse.TRUST)) {
addPolicyToMap(trustPolicies, domainReltn.getDomain().getDomainName(), policyReltn);
}
}
}
}
}
publicPolicyResolverModule = PublicPolicyResolverModule.create(new DomainPolicyResolverProvider(incomingPublicPolicies, outgoingPublicPolicies));
privatePolicyResolverModule = PrivatePolicyResolverModule.create(new DomainPolicyResolverProvider(incomingPrivatePolicies, outgoingPrivatePolicies));
trustPolicyResolverModule = TrustPolicyResolverModule.create(new DomainPolicyResolverProvider(trustPolicies));
}
use of org.nhindirect.config.model.CertPolicyGroupUse in project nhin-d by DirectProject.
the class EntityModelConversion method toEntityCertPolicyGroup.
public static org.nhindirect.config.store.CertPolicyGroup toEntityCertPolicyGroup(CertPolicyGroup group) {
if (group == null)
return null;
final org.nhindirect.config.store.CertPolicyGroup retVal = new org.nhindirect.config.store.CertPolicyGroup();
final Collection<org.nhindirect.config.store.CertPolicyGroupReltn> reltns = new ArrayList<org.nhindirect.config.store.CertPolicyGroupReltn>();
if (group.getPolicies() != null) {
for (CertPolicyGroupUse use : group.getPolicies()) {
org.nhindirect.config.store.CertPolicyGroupReltn reltn = new org.nhindirect.config.store.CertPolicyGroupReltn();
reltn.setCertPolicy(toEntityCertPolicy(use.getPolicy()));
reltn.setCertPolicyGroup(retVal);
reltn.setIncoming(use.isIncoming());
reltn.setOutgoing(use.isOutgoing());
if (use.getPolicyUse() != null)
reltn.setPolicyUse(org.nhindirect.config.store.CertPolicyUse.valueOf(use.getPolicyUse().toString()));
reltns.add(reltn);
}
}
retVal.setPolicyGroupName(group.getPolicyGroupName());
retVal.setCreateTime(group.getCreateTime());
retVal.setCertPolicyGroupReltn(reltns);
return retVal;
}
use of org.nhindirect.config.model.CertPolicyGroupUse in project nhin-d by DirectProject.
the class EntityModelConversion method toModelCertPolicyGroup.
public static CertPolicyGroup toModelCertPolicyGroup(org.nhindirect.config.store.CertPolicyGroup group) {
if (group == null)
return null;
final CertPolicyGroup retVal = new CertPolicyGroup();
final Collection<CertPolicyGroupUse> uses = new ArrayList<CertPolicyGroupUse>();
if (group.getCertPolicyGroupReltn() != null) {
for (org.nhindirect.config.store.CertPolicyGroupReltn reltn : group.getCertPolicyGroupReltn()) {
final CertPolicyGroupUse use = new CertPolicyGroupUse();
use.setPolicy(toModelCertPolicy(reltn.getCertPolicy()));
if (reltn.getPolicyUse() != null)
use.setPolicyUse(CertPolicyUse.valueOf(reltn.getPolicyUse().toString()));
use.setIncoming(reltn.isIncoming());
use.setOutgoing(reltn.isOutgoing());
uses.add(use);
}
}
retVal.setPolicyGroupName(group.getPolicyGroupName());
retVal.setCreateTime(group.getCreateTime());
retVal.setPolicies(uses);
return retVal;
}
Aggregations