1 package org.splat.simer;
3 import java.util.ResourceBundle;
5 import org.splat.kernel.Name;
6 import org.splat.dal.bo.kernel.User;
7 import org.splat.dal.bo.som.ValidationCycle;
8 import org.splat.dal.bo.som.ValidationStep;
11 public class ValidationFacade {
19 protected static abstract class UserOption implements Name {
20 // ----------------------------------------------------------
21 protected String name;
24 public long getIndex() {
27 public String toString () {
31 protected static class NotRequired extends UserOption {
32 // -----------------------------------------------------
33 protected NotRequired () {
34 name = ResourceBundle.getBundle("labels", ApplicationSettings.getCurrentLocale()).getString("label.skipped");
38 protected static class ByAuthor extends UserOption {
39 // --------------------------------------------------
40 protected ByAuthor () {
41 name = ResourceBundle.getBundle("labels", ApplicationSettings.getCurrentLocale()).getString("label.bytheauthor");
45 protected static class ByManager extends UserOption {
46 // ---------------------------------------------------
47 protected ByManager (User manager) {
48 name = ResourceBundle.getBundle("labels", ApplicationSettings.getCurrentLocale()).getString("label.me");
49 index = manager.getIndex();
53 // ==============================================================================================================================
55 // ==============================================================================================================================
57 public ValidationFacade (ValidationCycle cycle) {
58 // -----------------------------------------------
59 myicon = "icon.empty.png";
60 if (cycle.isDefault()) {
63 if (cycle.isAssigned()) myicon = "icon.done.png";
64 myname = cycle.getDocumentType().getName();
66 mypublisher = cycle.getActor(ValidationStep.PROMOTION);
67 myreviewer = cycle.getActor(ValidationStep.REVIEW);
68 myapprover = cycle.getActor(ValidationStep.APPROVAL);
69 if (mypublisher == null) {
70 mypublisher = new ByAuthor();
72 if (myreviewer == null || myapprover == null) {
73 Name skipped = new NotRequired();
74 if (myreviewer == null) myreviewer = skipped;
75 if (myapprover == null) myapprover = skipped;
79 // ==============================================================================================================================
81 // ==============================================================================================================================
83 public String getDocumentType () {
84 // --------------------------------
87 public long getApproverIndex () {
88 // ------------------------------
89 return myapprover.getIndex();
91 public String getApproverName () {
92 // --------------------------------
93 return myapprover.toString();
95 public String getIcon () {
96 // ------------------------
99 public long getPublisherIndex () {
100 // -------------------------------
101 return mypublisher.getIndex();
103 public String getPublisherName () {
104 // ---------------------------------
105 return mypublisher.toString();
107 public long getReviewerIndex () {
108 // ------------------------------
109 return myreviewer.getIndex();
111 public String getReviewerName () {
112 // --------------------------------
113 return myreviewer.toString();