All files JenkinsTimeInQueueAction.ts

100% Statements 14/14
100% Branches 4/4
100% Functions 6/6
100% Lines 14/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43      32x 32x 32x     5x     6x     6x     14x 14x 14x     28x 28x 16x   28x 16x                              
 
 
import { JenkinsAction }       from './jenkins-api-ts-typings';
 
export class JenkinsTimeInQueueAction extends JenkinsAction {
    private queuingDurationMillis:  number = 0;
    private totalDurationMillis:    number = 0;
    
    constructor() {
        super();
    }
    
    public isTimeInQueueActionClass() {
        return true;
    }
    
    public getQueuingDurationMillis(): number {
        return this.queuingDurationMillis;
    }
    
    public getTotalDurationMillis(): number {
        return this.totalDurationMillis
    }
    
    public fromJsonString(json: string) {
        let data:JSON = JSON.parse(json);
        this.jsonData = data;
        
        this.fromJson(data);
    }
    
    public fromJson(data: JSON) {
        super.fromJson(data);
        
        if(data.hasOwnProperty("queuingDurationMillis")) {
            this.queuingDurationMillis = ((data as any)["queuingDurationMillis"]);
        }
        
        if(data.hasOwnProperty("totalDurationMillis")) {
            this.totalDurationMillis = ((data as any)["totalDurationMillis"]);
        }
    }
}