import org.splat.dal.bo.som.ValidationStep;
import org.splat.kernel.Name;
+/**
+ * Validation cycle presentation facade.
+ */
public class ValidationFacade {
+ /**
+ * Icon name.
+ */
private transient String _myicon;
+ /**
+ * Document type name.
+ */
private transient String _myname;
+ /**
+ * Publisher name.
+ */
private transient Name _mypublisher;
+ /**
+ * Reviewer name.
+ */
private transient Name _myreviewer;
+ /**
+ * Approver name.
+ */
private transient Name _myapprover;
+ /**
+ * Option presentation in users lists.
+ */
protected static class UserOption implements Name {
+ /**
+ * User name.
+ */
protected transient String _name;
+ /**
+ * User id.
+ */
protected transient long _index;
/**
* Create a localized named user option.
- * @param key option label key
- * @param locale current locale
+ *
+ * @param key
+ * option label key
+ * @param locale
+ * current locale
*/
public UserOption(final String key, final Locale locale) {
super();
_name = ResourceBundle.getBundle("labels", locale).getString(key);
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.splat.kernel.Name#getIndex()
+ */
public long getIndex() {
return _index;
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
return _name;
}
+
+ /**
+ * Get user's display name.
+ *
+ * @return user's display name
+ */
+ public String getDisplayName() {
+ return _name;
+ }
}
+ /**
+ * Not applicable user option presentation. For example, if there is no review<BR>
+ * step, then reviewer will be undefined.
+ */
protected static class NotRequired extends UserOption {
+ /**
+ * Constructor.
+ *
+ * @param locale
+ * current locale
+ */
protected NotRequired(final Locale locale) {
super("label.skipped", locale);
_index = 0;
}
}
+ /**
+ * Author presentation.
+ */
protected static class ByAuthor extends UserOption {
+ /**
+ * Constructor.
+ *
+ * @param locale
+ * current locale
+ */
protected ByAuthor(final Locale locale) {
super("label.bytheauthor", locale);
_index = 0;
}
}
+ /**
+ * Current user presentation ("Me").
+ */
protected static class ByManager extends UserOption {
+ /**
+ * Constructor.
+ *
+ * @param manager
+ * current user
+ * @param locale
+ * current locale
+ */
protected ByManager(final User manager, final Locale locale) {
super("label.me", locale);
_index = manager.getIndex();
// Constructors
// ==============================================================================================================================
+ /**
+ * Constructor.
+ *
+ * @param cycle
+ * the presented validation cycle
+ * @param locale
+ * the current locale
+ */
public ValidationFacade(final ValidationCycle cycle, final Locale locale) {
_myicon = "icon.empty.png";
if (cycle.isDefault()) {
// Getters
// ==============================================================================================================================
+ /**
+ * Get the document type of the validation cycle.
+ *
+ * @return document type name
+ */
public String getDocumentType() {
return _myname;
}
+ /**
+ * Get the approver id.
+ *
+ * @return user id
+ */
public long getApproverIndex() {
return _myapprover.getIndex();
}
+ /**
+ * Get the approver name.
+ *
+ * @return user name
+ */
public String getApproverName() {
return _myapprover.toString();
}
+ /**
+ * Get icon name.
+ *
+ * @return the icon name
+ */
public String getIcon() {
return _myicon;
}
- public long getPublisherIndex() {
- return _mypublisher.getIndex();
- }
-
+ /**
+ * Get the publisher id.
+ *
+ * @return user id
+ */
public String getPublisherName() {
return _mypublisher.toString();
}
- public long getReviewerIndex() {
- return _myreviewer.getIndex();
+ /**
+ * Get the publisher id.
+ *
+ * @return user id
+ */
+ public long getPublisherIndex() {
+ return _mypublisher.getIndex();
}
+ /**
+ * Get the reviewer id.
+ *
+ * @return user id
+ */
public String getReviewerName() {
return _myreviewer.toString();
}
+
+ /**
+ * Get the reviewer id.
+ *
+ * @return user id
+ */
+ public long getReviewerIndex() {
+ return _myreviewer.getIndex();
+ }
}
\ No newline at end of file