com.enderak.procol.common.model
Class ProColFile

java.lang.Object
  |
  +--java.io.File
        |
        +--com.enderak.procol.common.model.ProColFile
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class ProColFile
extends java.io.File

A file for use with ProCol

Author:
Justin Dieters
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
ProColFile(java.lang.String pathname)
          Creates a new ProColFile with the specified pathname
ProColFile(java.lang.String pathname, java.lang.String filename)
          Creates a new ProColFile with the specified pathname and filename
ProColFile(java.net.URI uri)
          Creates a new ProColFile with the specified URI
 
Method Summary
 boolean checkIn(java.lang.String userIn)
          Checks in a file
 boolean checkOut(java.lang.String userIn)
          Checks out the file
 boolean createNewVersion(java.lang.String newVersion, java.lang.String newChangeLog, java.lang.String userNameIn)
          Creates a new version of the file
 java.lang.String getFileInfo(java.net.URI relativeRoot)
          Returns this file info
 java.lang.String getOwner()
          Gets the current owner of the file
 java.lang.String getVersion()
          Gets the current version of the file as a String
 int[] getVersionAsArray()
          Gets the current version of the file as an int array
 java.io.File getVersionsFile()
          Gets the versions File
 java.net.URI getVersionsURI()
          Gets the versions URI
 boolean isCheckedOut()
          Get the checked-out status of the file
 boolean isCheckedOutBy(java.lang.String userName)
          Check if the file is checked out by a specific user
 ProColFile[] listProColFiles()
          Gets all child files as a ProColFile[] array
 boolean setOwner(java.lang.String ownerIn)
          Sets the owner of this file
 void setVersion(java.lang.String versionIn)
          Sets the current version of the file
 void setVersionsFile(java.net.URI versionsURI)
          Sets the file where version information is kept
 java.lang.String toString()
          Get this file as a printable String
 
Methods inherited from class java.io.File
canRead, canWrite, compareTo, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getName, getParent, getParentFile, getPath, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setLastModified, setReadOnly, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProColFile

public ProColFile(java.lang.String pathname)
Creates a new ProColFile with the specified pathname

Parameters:
pathname - The pathname to the file on disk

ProColFile

public ProColFile(java.lang.String pathname,
                  java.lang.String filename)
Creates a new ProColFile with the specified pathname and filename

Parameters:
pathname - The pathname to the file on disk
filename - The filename of the file on disk

ProColFile

public ProColFile(java.net.URI uri)
Creates a new ProColFile with the specified URI

Parameters:
uri - URI to the file
Method Detail

setVersionsFile

public void setVersionsFile(java.net.URI versionsURI)
Sets the file where version information is kept

Parameters:
versionsURI - The URI to the versions file

getVersionsURI

public java.net.URI getVersionsURI()
Gets the versions URI

Returns:
the versions URI

getVersionsFile

public java.io.File getVersionsFile()
Gets the versions File

Returns:
the version File

checkOut

public boolean checkOut(java.lang.String userIn)
Checks out the file

Parameters:
userIn - The user checking out the file
Returns:
True if checkout was successful, false if not

checkIn

public boolean checkIn(java.lang.String userIn)
Checks in a file

Parameters:
userIn - The user checking in the file
Returns:
True if checkin was successful, false if not

getOwner

public java.lang.String getOwner()
Gets the current owner of the file

Returns:
The name of the current file, or null if no owner

getVersion

public java.lang.String getVersion()
Gets the current version of the file as a String

Returns:
The version string, or 'null' if no version

getVersionAsArray

public int[] getVersionAsArray()
Gets the current version of the file as an int array

Returns:
the int array, or [0,0,0] if no version

setVersion

public void setVersion(java.lang.String versionIn)
Sets the current version of the file

Parameters:
versionIn - The new version string

createNewVersion

public boolean createNewVersion(java.lang.String newVersion,
                                java.lang.String newChangeLog,
                                java.lang.String userNameIn)
Creates a new version of the file

Parameters:
newVersion - The new version string
newChangeLog - The new changelog
userNameIn - The updating user
Returns:
True if new version creation was successful, false otherwise

setOwner

public boolean setOwner(java.lang.String ownerIn)
Sets the owner of this file

Parameters:
ownerIn -
Returns:
True if was able to set owner, false otherwise (i.e. already has an owner)

isCheckedOut

public boolean isCheckedOut()
Get the checked-out status of the file

Returns:
True if checked out, false if not

isCheckedOutBy

public boolean isCheckedOutBy(java.lang.String userName)
Check if the file is checked out by a specific user

Parameters:
userName - the user's name
Returns:
True if checked out by that user. False if checked out by someone else or not checked out

toString

public java.lang.String toString()
Get this file as a printable String

Overrides:
toString in class java.io.File
Returns:
The name of the file

getFileInfo

public java.lang.String getFileInfo(java.net.URI relativeRoot)
Returns this file info

Parameters:
relativeRoot - The root of this file to reletiveize from
Returns:
The file info in String format

listProColFiles

public ProColFile[] listProColFiles()
Gets all child files as a ProColFile[] array

Returns:
All children as ProColFile'ss.