import java.util.ResourceBundle;
-import org.splat.kernel.Name;
import org.splat.dal.bo.kernel.User;
import org.splat.dal.bo.som.ValidationCycle;
import org.splat.dal.bo.som.ValidationStep;
-
+import org.splat.kernel.Name;
public class ValidationFacade {
- String myicon;
- String myname;
- Name mypublisher;
- Name myreviewer;
- Name myapprover;
-
- protected static abstract class UserOption implements Name {
-// ----------------------------------------------------------
- protected String name;
- protected long index;
-
- public long getIndex() {
- return index;
- }
- public String toString () {
- return name;
- }
- }
- protected static class NotRequired extends UserOption {
-// -----------------------------------------------------
- protected NotRequired () {
- name = ResourceBundle.getBundle("labels", ApplicationSettings.getCurrentLocale()).getString("label.skipped");
- index = 0;
- }
- }
- protected static class ByAuthor extends UserOption {
-// --------------------------------------------------
- protected ByAuthor () {
- name = ResourceBundle.getBundle("labels", ApplicationSettings.getCurrentLocale()).getString("label.bytheauthor");
- index = 0;
- }
- }
- protected static class ByManager extends UserOption {
-// ---------------------------------------------------
- protected ByManager (User manager) {
- name = ResourceBundle.getBundle("labels", ApplicationSettings.getCurrentLocale()).getString("label.me");
- index = manager.getIndex();
- }
- }
-
-// ==============================================================================================================================
-// Constructors
-// ==============================================================================================================================
-
- public ValidationFacade (ValidationCycle cycle) {
-// -----------------------------------------------
- myicon = "icon.empty.png";
- if (cycle.isDefault()) {
- myname = "default";
- } else {
- if (cycle.isAssigned()) myicon = "icon.done.png";
- myname = cycle.getDocumentType().getName();
- }
- mypublisher = cycle.getActor(ValidationStep.PROMOTION);
- myreviewer = cycle.getActor(ValidationStep.REVIEW);
- myapprover = cycle.getActor(ValidationStep.APPROVAL);
- if (mypublisher == null) {
- mypublisher = new ByAuthor();
- }
- if (myreviewer == null || myapprover == null) {
- Name skipped = new NotRequired();
- if (myreviewer == null) myreviewer = skipped;
- if (myapprover == null) myapprover = skipped;
- }
+ private transient String _myicon;
+ private transient String _myname;
+ private transient Name _mypublisher;
+ private transient Name _myreviewer;
+ private transient Name _myapprover;
+
+ protected static class UserOption implements Name {
+ protected transient String _name;
+ protected transient long _index;
+
+ public long getIndex() {
+ return _index;
+ }
+
+ @Override
+ public String toString() {
+ return _name;
+ }
+ }
+
+ protected static class NotRequired extends UserOption {
+ protected NotRequired() {
+ super();
+ _name = ResourceBundle.getBundle("labels",
+ ApplicationSettings.getCurrentLocale()).getString(
+ "label.skipped");
+ _index = 0;
+ }
}
-// ==============================================================================================================================
-// Getters
-// ==============================================================================================================================
-
- public String getDocumentType () {
-// --------------------------------
- return myname;
- }
- public long getApproverIndex () {
-// ------------------------------
- return myapprover.getIndex();
- }
- public String getApproverName () {
-// --------------------------------
- return myapprover.toString();
- }
- public String getIcon () {
-// ------------------------
- return myicon;
- }
- public long getPublisherIndex () {
-// -------------------------------
- return mypublisher.getIndex();
- }
- public String getPublisherName () {
-// ---------------------------------
- return mypublisher.toString();
- }
- public long getReviewerIndex () {
-// ------------------------------
- return myreviewer.getIndex();
- }
- public String getReviewerName () {
-// --------------------------------
- return myreviewer.toString();
- }
+ protected static class ByAuthor extends UserOption {
+ protected ByAuthor() {
+ super();
+ _name = ResourceBundle.getBundle("labels",
+ ApplicationSettings.getCurrentLocale()).getString(
+ "label.bytheauthor");
+ _index = 0;
+ }
+ }
+
+ protected static class ByManager extends UserOption {
+ protected ByManager(final User manager) {
+ super();
+ _name = ResourceBundle.getBundle("labels",
+ ApplicationSettings.getCurrentLocale()).getString(
+ "label.me");
+ _index = manager.getIndex();
+ }
+ }
+
+ // ==============================================================================================================================
+ // Constructors
+ // ==============================================================================================================================
+
+ public ValidationFacade(final ValidationCycle cycle) {
+ _myicon = "icon.empty.png";
+ if (cycle.isDefault()) {
+ _myname = "default";
+ } else {
+ if (cycle.isAssigned()) {
+ _myicon = "icon.done.png";
+ }
+ _myname = cycle.getDocumentType().getName();
+ }
+ _mypublisher = cycle.getActor(ValidationStep.PROMOTION);
+ _myreviewer = cycle.getActor(ValidationStep.REVIEW);
+ _myapprover = cycle.getActor(ValidationStep.APPROVAL);
+ if (_mypublisher == null) {
+ _mypublisher = new ByAuthor();
+ }
+ if (_myreviewer == null || _myapprover == null) {
+ Name skipped = new NotRequired();
+ if (_myreviewer == null) {
+ _myreviewer = skipped;
+ }
+ if (_myapprover == null) {
+ _myapprover = skipped;
+ }
+ }
+ }
+
+ // ==============================================================================================================================
+ // Getters
+ // ==============================================================================================================================
+
+ public String getDocumentType() {
+ return _myname;
+ }
+
+ public long getApproverIndex() {
+ return _myapprover.getIndex();
+ }
+
+ public String getApproverName() {
+ return _myapprover.toString();
+ }
+
+ public String getIcon() {
+ return _myicon;
+ }
+
+ public long getPublisherIndex() {
+ return _mypublisher.getIndex();
+ }
+
+ public String getPublisherName() {
+ return _mypublisher.toString();
+ }
+
+ public long getReviewerIndex() {
+ return _myreviewer.getIndex();
+ }
+
+ public String getReviewerName() {
+ return _myreviewer.toString();
+ }
}
\ No newline at end of file