1 package org.splat.simer;
3 import java.util.ResourceBundle;
5 import org.splat.dal.bo.kernel.User;
6 import org.splat.dal.bo.som.ValidationCycle;
7 import org.splat.dal.bo.som.ValidationStep;
8 import org.splat.kernel.Name;
10 public class ValidationFacade {
12 private transient String _myicon;
13 private transient String _myname;
14 private transient Name _mypublisher;
15 private transient Name _myreviewer;
16 private transient Name _myapprover;
18 protected static class UserOption implements Name {
19 protected transient String _name;
20 protected transient long _index;
22 public long getIndex() {
27 public String toString() {
32 protected static class NotRequired extends UserOption {
33 protected NotRequired() {
35 _name = ResourceBundle.getBundle("labels",
36 ApplicationSettings.getCurrentLocale()).getString(
42 protected static class ByAuthor extends UserOption {
43 protected ByAuthor() {
45 _name = ResourceBundle.getBundle("labels",
46 ApplicationSettings.getCurrentLocale()).getString(
52 protected static class ByManager extends UserOption {
53 protected ByManager(final User manager) {
55 _name = ResourceBundle.getBundle("labels",
56 ApplicationSettings.getCurrentLocale()).getString(
58 _index = manager.getIndex();
62 // ==============================================================================================================================
64 // ==============================================================================================================================
66 public ValidationFacade(final ValidationCycle cycle) {
67 _myicon = "icon.empty.png";
68 if (cycle.isDefault()) {
71 if (cycle.isAssigned()) {
72 _myicon = "icon.done.png";
74 _myname = cycle.getDocumentType().getName();
76 _mypublisher = cycle.getActor(ValidationStep.PROMOTION);
77 _myreviewer = cycle.getActor(ValidationStep.REVIEW);
78 _myapprover = cycle.getActor(ValidationStep.APPROVAL);
79 if (_mypublisher == null) {
80 _mypublisher = new ByAuthor();
82 if (_myreviewer == null || _myapprover == null) {
83 Name skipped = new NotRequired();
84 if (_myreviewer == null) {
85 _myreviewer = skipped;
87 if (_myapprover == null) {
88 _myapprover = skipped;
93 // ==============================================================================================================================
95 // ==============================================================================================================================
97 public String getDocumentType() {
101 public long getApproverIndex() {
102 return _myapprover.getIndex();
105 public String getApproverName() {
106 return _myapprover.toString();
109 public String getIcon() {
113 public long getPublisherIndex() {
114 return _mypublisher.getIndex();
117 public String getPublisherName() {
118 return _mypublisher.toString();
121 public long getReviewerIndex() {
122 return _myreviewer.getIndex();
125 public String getReviewerName() {
126 return _myreviewer.toString();