From eb59eeafe647c1838f7aa6a5065a53072281fb83 Mon Sep 17 00:00:00 2001 From: rkv Date: Thu, 15 Nov 2012 13:42:46 +0000 Subject: [PATCH] toString method is redefined. --- .../org/splat/service/dto/DocumentDTO.java | 18 +++++++++++ .../src/org/splat/service/dto/FileDTO.java | 25 +++++++++++++++ .../src/org/splat/service/dto/StepDTO.java | 31 +++++++++++++++++-- 3 files changed, 71 insertions(+), 3 deletions(-) diff --git a/Workspace/Siman-Common/src/org/splat/service/dto/DocumentDTO.java b/Workspace/Siman-Common/src/org/splat/service/dto/DocumentDTO.java index 6838cd5..8652cd9 100644 --- a/Workspace/Siman-Common/src/org/splat/service/dto/DocumentDTO.java +++ b/Workspace/Siman-Common/src/org/splat/service/dto/DocumentDTO.java @@ -104,4 +104,22 @@ public class DocumentDTO { _files.add(fileDTO); return fileDTO; } + + /** + * {@inheritDoc} + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer(); + String indent = " "; + buf.append(indent).append("Document: ").append(getTitle()).append('\n') + .append(indent).append(" Document ID: ").append(getId()) + .append('\n'); + for (FileDTO file : getFiles()) { + buf.append(file); + } + return buf.toString(); + } } diff --git a/Workspace/Siman-Common/src/org/splat/service/dto/FileDTO.java b/Workspace/Siman-Common/src/org/splat/service/dto/FileDTO.java index 4c0cd8c..0dda6c5 100644 --- a/Workspace/Siman-Common/src/org/splat/service/dto/FileDTO.java +++ b/Workspace/Siman-Common/src/org/splat/service/dto/FileDTO.java @@ -120,4 +120,29 @@ public class FileDTO { public void setPath(final String path) { _path = path; } + + /** + * {@inheritDoc} + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer(); + String indent = " "; + String ftype = "Source"; + if (isResult()) { + ftype = "Result"; + } + String fstate = "file-actual"; + if (getState() == 'O') { + fstate = "file-outdated"; + } + buf.append(indent).append(ftype).append(" file: ").append(getPath()) + .append('\n').append(indent).append( + " Automatic processing: ").append(getProcessing()) + .append('\n').append(indent).append(" State: ").append( + fstate).append('\n'); + return buf.toString(); + } } diff --git a/Workspace/Siman-Common/src/org/splat/service/dto/StepDTO.java b/Workspace/Siman-Common/src/org/splat/service/dto/StepDTO.java index 93b89e2..dfead5f 100644 --- a/Workspace/Siman-Common/src/org/splat/service/dto/StepDTO.java +++ b/Workspace/Siman-Common/src/org/splat/service/dto/StepDTO.java @@ -70,6 +70,7 @@ public class StepDTO { /** * Get the key. + * * @return the key */ public String getKey() { @@ -78,7 +79,9 @@ public class StepDTO { /** * Set the key. - * @param key the key to set + * + * @param key + * the key to set */ public void setKey(final String key) { _key = key; @@ -86,6 +89,7 @@ public class StepDTO { /** * Get the number. + * * @return the number */ public int getNumber() { @@ -94,7 +98,9 @@ public class StepDTO { /** * Set the number. - * @param number the number to set + * + * @param number + * the number to set */ public void setNumber(final int number) { _number = number; @@ -102,6 +108,7 @@ public class StepDTO { /** * Get the module. + * * @return the module */ public String getModule() { @@ -110,9 +117,27 @@ public class StepDTO { /** * Set the module. - * @param module the module to set + * + * @param module + * the module to set */ public void setModule(final String module) { _module = module; } + + /** + * {@inheritDoc} + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer(); + buf.append("Activity ID: " + getNumber() + "\nSALOME module: " + + getModule() + "\n"); + for (DocumentDTO doc : getDocs()) { + buf.append(doc); + } + return buf.toString(); + } } -- 2.30.2