#------------------------------------------------------------
# Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package RPS::CAMechanical::Job::CreateStatement;

use strict;
use warnings;

use lib '/app/tools/common/lib';
use Common::Assert;
use Common::RSApp;

use lib '/app/tools/rps/lib';
use RPS::Config;

use lib '/app/tools/job/lib';
use Job::Job;

use base 'RPS::CAMechanical::Job::Base';


sub _generateCommandLine
{
    my ($self) = @_;

    my $statementID = $self->getCommandLineArg('statementID');
    assert($statementID);

    my $clientID = $self->clientID();
    assert($clientID);

    my $logLevel = $self->getCommandLineArg('logLevel');
    $logLevel = 1 unless $logLevel;

    # !!! Use the 'config' system to get the path to the royalty scripts.
    #
    my $rpsConfig = RPS::Config->new();
    my $scriptPath = $rpsConfig->get('royalty_script_dir');


    # !!! Note that this is a linux-only command line.
    # !!! If we end up wanting to run these on windows <shudder>, we'd have
    # !!! to create a 'Win32' subclass and override this method.
    # !!! Actually, we'd need to create a 'linux' subclass as well.
    #
    my $commandLine = "nice $scriptPath/create_ca_mechanical_statement.pl -c $clientID -s $statementID -V $logLevel";

    return $commandLine;
}


sub _defaultSubclass
{
    return 'CAMechanicalStatement';
}


sub _defaultLogFile
{
    my ($self) = @_;

    my $statementID = $self->getCommandLineArg('statementID');
    assert($statementID);

    return "statement_$statementID";
}

###
1;#
###

