remove_view error

@rem = 'Perl, ccperl read this as an array assignment & skip the goto
@echo off
@goto endofperl
@rem ';
#--------------------------------------------------------------------
# Perl Begin
#-------------------------------------------------------------------
$ct='cleartool';
if($#ARGV == -1) {
print "usage: $0 <view-tag> .../n";
exit(1);
}
for($viewcnt = 0; $viewcnt <= $#ARGV; $viewcnt++) {
$view = $ARGV[$viewcnt];
print "/$view = $view/n";
# Get view-information
@viewinfo = `$ct lsview -long $view`;
foreach $entry (@viewinfo) {
chop($entry);
if($entry =~ /View tag uuid:/) {
($uuid = $entry) =~ s/.*View tag uuid://i;
}
}
print "/$uuid = ...$uuid.../n";
# remove entries from vob's
@voblist = `$ct lsvob -short`;
$error='';
foreach $vob (@voblist) {
chop($vob);
system("$ct rmview -force -vob $vob -uuid $uuid");
}
# unregister view
print "Unregister View/n";
system("$ct unregister -view -uuid $uuid");
# remove view tag
print "Remove Tag/n";
system("$ct rmtag -view -all $view");
}
#--------------------------------------------------------------------
# Perl End
#--------------------------------------------------------------------
__END__
:endofperl
REM Call Perl either with ext. ".bat" or without ext. ".bat" and
REM either in the current directory or somewhere in the path
ccperl -e "$s = shift;$c = $s =~ /.bat$/? $s : $s.'.bat';$p = (-x $c)? '' : ' -S '; system('ccperl'.$p.$c.' '.join(' ',@ARGV));exit $?;" %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
pause 
Also create a ControllerCreate class that extends Controller.The create method takes as arguments the name of a new library user, a number of books (as a string), and an integer representing the role of user to create (where the integer 0 means a lender and the integer 1 means a borrower). The create method of the controller then transforms the book number from a string to an integer (using the Integer.parseInt static method), creates an object from the correct class (based on the role specified by the user input: lender or borrower) and calls the addUser method of the library to add the new user object to the library. • If no exception occurs then the create method of the controller returns the empty string. • If the constructor of the Borrower class throws a NotALenderException then the create method of the controller must catch this exception and return as result the error message from the exception object. • If the parseInt method of the Integer class throws a NumberFormatException (because the user typed something which is not an integer) then the create method of the controller must catch this exception and return as result the error message from the exception object. Modify the run method of the GUI class to add a ViewCreate view that uses a ControllerCreate controller and the same model as before (not a new model!) Do not delete the previous views. Note: if at the end of Question 7 you had manually added to your library (model object) some users for testing, then you must now remove those users from the run method of the anonymous class inside the GUI class. You do not need these test users anymore because you have now a graphical user interface to create new users! Run your GUI and check that you can correctly use the new view to create different users for your library, with different types of roles. • Check that, when you create a new user, the simple view is automatically correctly updated to show the new total number of books borrowed by all users. • Also use the “get book” view to check that the users are correctly created with the correct names and correct number of books. • Also check that trying to create a borrower with a negative number of books correctly shows an error message. Also check that trying to create a user with a number of books which is not an integer correctly shows an error message (do not worry about the content of the error message). After you created a new user, you can also check whether it is a lender or a borrower using the “more book” view to increase the number of books of the user by a big negative number: • if the new user you created is a lender, then increasing the number of books by a big negative value will work and the number of books borrowed by the user will just become a larger value (you can then check that using the “get book” view); • if the new user you created is a borrower, then increasing the number of books by a big negative value will fail with an error message and the number of books borrowed by the user will not change (you can then check that using the “get book” view). 完成符合以上要求的java代码
05-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值