private SPUserNotice( ASN1Sequence seq) { Enumeration e = seq.getObjects(); while (e.hasMoreElements()) { ASN1Encodable object = (ASN1Encodable)e.nextElement(); if (object instanceof DisplayText || object instanceof ASN1String) { explicitText = DisplayText.getInstance(object); } else if (object instanceof NoticeReference || object instanceof ASN1Sequence) { noticeRef = NoticeReference.getInstance(object); } else { throw new IllegalArgumentException("Invalid element in 'SPUserNotice': " + object.getClass().getName()); } } }
private void populate(UserNotice userNotice) { if (userNotice != null) { NoticeReference noticeReference = userNotice.getNoticeRef(); if (noticeReference != null) { DisplayText organization = noticeReference.getOrganization(); if (organization != null) { jtfOrganization.setText(organization.getString()); jtfOrganization.setCaretPosition(0); } populateNoticeNumbers(noticeReference); } DisplayText explicitText = userNotice.getExplicitText(); if (explicitText != null) { jtfExplicitText.setText(explicitText.getString()); jtfExplicitText.setCaretPosition(0); } } }
public SPUserNotice( NoticeReference noticeRef, DisplayText explicitText) { this.noticeRef = noticeRef; this.explicitText = explicitText; }
public DisplayText getExplicitText() { return explicitText; }
/** * Get string representation of user notice. * * @param userNotice * User notice * @return String representation of user notice */ public static String toString(UserNotice userNotice) { StringBuffer sbUserNotice = new StringBuffer(); NoticeReference noticeReference = userNotice.getNoticeRef(); if (noticeReference != null) { DisplayText organization = noticeReference.getOrganization(); if (organization != null) { sbUserNotice.append(MessageFormat.format(res.getString("PolicyInformationUtil.Organization"), organization.getString())); if ((noticeReference.getNoticeNumbers() != null) || (userNotice.getExplicitText() != null)) { sbUserNotice.append(", "); } } ASN1Integer[] noticeNumbers = noticeReference.getNoticeNumbers(); StringBuffer sbNoticeNumbers = new StringBuffer(); if (noticeNumbers != null) { for (int i = 0; i < noticeNumbers.length; i++) { ASN1Integer noticeNumber = noticeNumbers[i]; sbNoticeNumbers.append(noticeNumber.getValue().intValue()); if ((i + 1) < noticeNumbers.length) { sbNoticeNumbers.append(" "); } } sbUserNotice.append(MessageFormat.format(res.getString("PolicyInformationUtil.NoticeNumbers"), sbNoticeNumbers.toString())); if (userNotice.getExplicitText() != null) { sbUserNotice.append(", "); } } } DisplayText explicitText = userNotice.getExplicitText(); if (explicitText != null) { sbUserNotice.append(MessageFormat.format(res.getString("PolicyInformationUtil.ExplicitText"), explicitText.getString())); } return sbUserNotice.toString(); }