home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
contfile.tcl
< prev
next >
Wrap
Text File
|
1997-06-06
|
5KB
|
186 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)contfile.tcl /main/hindenburg/5
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)contfile.tcl /main/hindenburg/5 6 Jun 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
require_module_file "vsfile.tcl" vcm
# This class represents a Continuus file.
Class ContFile : {VSFile} {
constructor
method destructor
method createVSPath
method createUserPath
method createInVS
method removeFromVS
method renameInVS
method isCheckedOut
method checkOut
method deleteVersion
method unuseVersion
method getReference
method deleteReference
method setAttribute
method getAttributeValue
}
constructor ContFile {class this name type system} {
set this [VSFile::constructor $class $this $name $type $system]
# Start constructor user section
# End constructor user section
return $this
}
method ContFile::destructor {this} {
# Start destructor user section
# End destructor user section
$this VSFile::destructor
}
method ContFile::createVSPath {this} {
$this VSFile::createVSPath Cont
}
method ContFile::createUserPath {this} {
$this VSFile::createUserPath Cont
}
method ContFile::createInVS {this args} {
set path [$this path]
set dir [path_name directory $path]
# do some incomprehensible args manipulation
set arguments [lindex $args 0]
set comment [lindex $arguments 0]
# check if there is a task argument
# this is given by the browser but not by code generation.
if { [llength $arguments] > 1 } {
set task [lindex $arguments 1]
} else {
set task 0
}
# create path if necessary
if { ![file isdirectory $dir] } {
if { ![$this createUserPath] } {
return 0
}
}
# create the element itself
set contType [[[$this systemVersion] typeMapper] map [$this type]]
set createCommand [ContCommand::createObject $path $contType $comment $task]
return [vsCommandHandler execute $createCommand]
}
method ContFile::removeFromVS {this} {
set removeCommand [ContCommand::deleteObject [$this path]]
return [vsCommandHandler execute $removeCommand]
}
method ContFile::renameInVS {this oldName} {
# construct old path from new path and old name
set fullName [path_name file [$this path]]
regsub ^[$this name] $fullName "" extensionPart
set oldPath [path_name concat [path_name directory [$this path]] \
"${oldName}$extensionPart"]
set renameCommand [ContCommand::rename $oldPath [$this path]]
return [vsCommandHandler execute $renameCommand]
}
# Returns whether the currently selected version of this file
# is in working state.
#
method ContFile::isCheckedOut {this} {
# just test writable
return [file writable [$this path]]
}
method ContFile::checkOut {this comment args} {
set checkOutCommand [ContCommand::checkOut [$this path] $comment]
return [vsCommandHandler execute $checkOutCommand]
}
# Delete and replace current version of this file.
#
method ContFile::deleteVersion {this} {
set deleteCommand [ContCommand::deleteVersion [$this path]]
return [vsCommandHandler execute $deleteCommand]
}
# Unuse and replace current version of this file.
#
method ContFile::unuseVersion {this} {
set unuseCommand [ContCommand::unuseVersion [$this path]]
return [vsCommandHandler execute $unuseCommand]
}
method ContFile::getReference {this {version ""}} {
if { $version == "" } {
return [$this path]
}
set path [args_file {}]
if [ContCommand::getVersion [$this path] $version $path] {
$this references "[$this references] [list $path]"
return $path
}
# don't know what went wrong, try to remove the file just in case
catch { BasicFS::removeFile $path }
return ""
}
method ContFile::deleteReference {this path} {
set splitPath [file_split $path]
set refFound 0
set newList {}
foreach ref [$this references] {
if { [file_split $ref] == $splitPath } {
set refFound 1
} else {
lappend newList [list $ref]
}
}
if !$refFound {
return
}
# reference was a temporary file, delete from list and file system
$this references $newList
BasicFS::removeFile $path
}
# Sets the specified Continuus attribute to the
# specified value for this file.
#
method ContFile::setAttribute {this name value} {
set setCommand [ContCommand::setAttribute [$this path] $name $value]
return [vsCommandHandler execute $setCommand]
}
# Get the value of the specified attribute for this file.
#
method ContFile::getAttributeValue {this name} {
return [ContCommand::getAttributeValue [$this path] $name]
}
# Do not delete this line -- regeneration end marker