Search in sources :

Example 1 with CertPolicyGroupDomainReltn

use of org.nhindirect.config.model.CertPolicyGroupDomainReltn 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));
}
Also used : SmtpAgentException(org.nhindirect.gateway.smtp.SmtpAgentException) CertPolicyGroupDomainReltn(org.nhindirect.config.model.CertPolicyGroupDomainReltn) HashMap(java.util.HashMap) CertPolicyGroupUse(org.nhindirect.config.model.CertPolicyGroupUse) Collection(java.util.Collection) PolicyExpression(org.nhindirect.policy.PolicyExpression) DomainPolicyResolverProvider(org.nhindirect.stagent.policy.impl.provider.DomainPolicyResolverProvider) AddressException(javax.mail.internet.AddressException) SmtpAgentException(org.nhindirect.gateway.smtp.SmtpAgentException) PolicyParseException(org.nhindirect.policy.PolicyParseException)

Example 2 with CertPolicyGroupDomainReltn

use of org.nhindirect.config.model.CertPolicyGroupDomainReltn in project nhin-d by DirectProject.

the class EntityModelConversion method toModelCertPolicyGroupDomainReltn.

public static CertPolicyGroupDomainReltn toModelCertPolicyGroupDomainReltn(org.nhindirect.config.store.CertPolicyGroupDomainReltn reltn) {
    if (reltn == null)
        return null;
    final CertPolicyGroupDomainReltn retVal = new CertPolicyGroupDomainReltn();
    retVal.setId(reltn.getId());
    retVal.setPolicyGroup(toModelCertPolicyGroup(reltn.getCertPolicyGroup()));
    retVal.setDomain(toModelDomain(reltn.getDomain()));
    return retVal;
}
Also used : CertPolicyGroupDomainReltn(org.nhindirect.config.model.CertPolicyGroupDomainReltn)

Aggregations

CertPolicyGroupDomainReltn (org.nhindirect.config.model.CertPolicyGroupDomainReltn)2 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 AddressException (javax.mail.internet.AddressException)1 CertPolicyGroupUse (org.nhindirect.config.model.CertPolicyGroupUse)1 SmtpAgentException (org.nhindirect.gateway.smtp.SmtpAgentException)1 PolicyExpression (org.nhindirect.policy.PolicyExpression)1 PolicyParseException (org.nhindirect.policy.PolicyParseException)1 DomainPolicyResolverProvider (org.nhindirect.stagent.policy.impl.provider.DomainPolicyResolverProvider)1