return makeAAssociateAC(as, rq, userIdentity);
}
protected AAssociateAC makeAAssociateAC(Association as, AAssociateRQ rq,
UserIdentityAC userIdentity) throws IOException {
AAssociateAC ac = new AAssociateAC();
ac.setCalledAET(rq.getCalledAET());
ac.setCallingAET(rq.getCallingAET());
Connection conn = as.getConnection();
ac.setMaxPDULength(conn.getReceivePDULength());
ac.setMaxOpsInvoked(Association.minZeroAsMax(rq.getMaxOpsInvoked(),
conn.getMaxOpsPerformed()));
ac.setMaxOpsPerformed(Association.minZeroAsMax(rq.getMaxOpsPerformed(),
conn.getMaxOpsInvoked()));
ac.setUserIdentityAC(userIdentity);
ApplicationEntity ae = as.getApplicationEntity();
for (PresentationContext rqpc : rq.getPresentationContexts())
ac.addPresentationContext(ae.negotiate(rq, ac, rqpc));
return ac;
}