/plugins/SVNPlugin/tags/0.7.0/src/ise/plugin/svn/data/CopyData.java

# · Java · 148 lines · 75 code · 25 blank · 48 comment · 5 complexity · 6a939363c856ee29725e4f9e7bd8f0a8 MD5 · raw file

  1. /*
  2. Copyright (c) 2007, Dale Anson
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without modification,
  5. are permitted provided that the following conditions are met:
  6. * Redistributions of source code must retain the above copyright notice,
  7. this list of conditions and the following disclaimer.
  8. * Redistributions in binary form must reproduce the above copyright notice,
  9. this list of conditions and the following disclaimer in the documentation
  10. and/or other materials provided with the distribution.
  11. * Neither the name of the author nor the names of its contributors
  12. may be used to endorse or promote products derived from this software without
  13. specific prior written permission.
  14. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  15. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  16. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  18. ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  19. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  20. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  21. ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  23. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. package ise.plugin.svn.data;
  26. import java.io.File;
  27. import java.io.Serializable;
  28. import java.util.*;
  29. import org.tmatesoft.svn.core.SVNURL;
  30. import org.tmatesoft.svn.core.wc.SVNRevision;
  31. public class CopyData extends SVNData implements Serializable {
  32. private static final long serialVersionUID = 42L;
  33. // single source file
  34. private File sourceFile = null;
  35. // multiple files
  36. private List<File> sourceFiles = null;
  37. // single source URL
  38. private SVNURL sourceURL = null;
  39. private List<SVNURL> sourceURLs = null;
  40. // copy destination if on local filesystem
  41. private File destinationFile = null;
  42. // copy destination if on remote repository
  43. private transient SVNURL destinationURL = null;
  44. // revision to copy from
  45. private transient SVNRevision revision = null;
  46. // true if this class represents a move rather than a copy
  47. private boolean isMove = false;
  48. // commit message
  49. private String message = null;
  50. // set/get commit message
  51. public void setMessage(String m) {
  52. message = m;
  53. }
  54. public String getMessage() {
  55. return message == null || message.length() == 0 ? "copying" : message;
  56. }
  57. // set/get revision to copy from
  58. public SVNRevision getRevision() {
  59. return revision;
  60. }
  61. public void setRevision( SVNRevision revision ) {
  62. this.revision = revision;
  63. }
  64. // set/get single source file to copy
  65. public File getSourceFile() {
  66. if (sourceFiles != null) {
  67. return sourceFiles.get(0);
  68. }
  69. return sourceFile;
  70. }
  71. public void setSourceFile( File sourceFile ) {
  72. this.sourceFile = sourceFile;
  73. }
  74. // Set/get filenames for copying multiple files to the destination.
  75. // @param files Map of filename to recursive, recursive is a boolean, always
  76. // false for files, could be true for directories.
  77. public void setSourceFiles(List<File> files) {
  78. sourceFiles = files;
  79. }
  80. public List<File> getSourceFiles() {
  81. return sourceFiles;
  82. }
  83. // set/get source url for copying remote url
  84. public SVNURL getSourceURL() {
  85. return sourceURL;
  86. }
  87. public void setSourceURL( SVNURL sourceURL ) {
  88. this.sourceURL = sourceURL;
  89. }
  90. public List<SVNURL> getSourceURLs() {
  91. return sourceURLs;
  92. }
  93. public void setSourceURLs( List<SVNURL> sourceURLs ) {
  94. this.sourceURLs = sourceURLs;
  95. }
  96. // set/get the local filesystem destination for the copy
  97. // @return the value of destinationFile, should be a directory if there is
  98. // more than one source file.
  99. public File getDestinationFile() {
  100. return destinationFile;
  101. }
  102. public void setDestinationFile( File destinationFile ) {
  103. this.destinationFile = destinationFile;
  104. }
  105. // set/get the remote repository destination url for the copy
  106. // @return the value of destinationURL.
  107. public SVNURL getDestinationURL() {
  108. return destinationURL;
  109. }
  110. public void setDestinationURL( SVNURL destinationURL ) {
  111. this.destinationURL = destinationURL;
  112. }
  113. // set/get is this a move rather than a copy
  114. public void setIsMove(boolean b) {
  115. isMove = b;
  116. }
  117. public boolean getIsMove() {
  118. return isMove;
  119. }
  120. }