package mentata.ldaphttp.forum; // import necessary classes import mentata.ldaphttp.LDAPHttpException; import mentata.ldaphttp.LDAPHttpVirtualAttribute; import mentata.gateway.GatewayReverseNestAttribute; /** * A directory entry that represents a comment with solicitation for replies. */ public class solicitation extends comment { // the business category for responses protected String comcat = "response"; protected String comclass = "comment"; /** * Instantiates an empty template for a solicitation. */ public solicitation() throws LDAPHttpException { // set default values for this object setLabel("solicitation"); // add or replace attributes addAttribute( new CommentFormAttribute(), "commentform", "", OPTIONAL, SINGLEVALUE); addAttribute( new GatewayReverseNestAttribute(getContextName(), "solicitation", "parent", "child"), "child", "", OPTIONAL, MULTIVALUE); // set attribute lists to support retrievability addAttributeList("retrieve_html", new String[] {"description", "owner", "content", "link", "dnqualifier", "parent", "commenthr", "child", "commentform"} ); } /** * Sets the business category and object class name for responses. * * @param comcat the business category and object class name */ protected final void setComment(String comcat) { setComment(comcat, comcat); } /** * Sets the business category and object class name for responses. * * @param comcat the business category * @param comclass the object class name */ protected final void setComment(String comcat, String comclass) { this.comcat = comcat; this.comclass = comclass; } /** * Returns the business category for responses. * * @return business category name */ public final String getCommentCategory() { return comcat; } /** * Returns the the object class name for responses. * * @return object class name */ public final String getCommentClass() { return comcat; } /** * An attribute for presenting a form for adding new comments. */ public class CommentFormAttribute extends LDAPHttpVirtualAttribute { /** * Generates an HTML form for adding new anonymous comments. */ public String[] getHTMLValues() throws LDAPHttpException { // build a create form solicitation current_comment = (solicitation)getObject(); StringBuffer results_buffer = new StringBuffer(); results_buffer.append("
"); results_buffer.append(""); results_buffer.append(""); results_buffer.append(""); results_buffer.append(""); results_buffer.append(""); results_buffer.append("
"); results_buffer.append(""); results_buffer.append(""); results_buffer.append(""); results_buffer.append(""); results_buffer.append(""); results_buffer.append(""); results_buffer.append("
From
Title
URL"); results_buffer.append("
optional, like http://www.mentata.com/ldaphttp/why/

"); // return the form as a single value return new String[] { results_buffer.toString() }; } } }