All files JenkinsBuild.ts

100% Statements 52/52
100% Branches 40/40
100% Functions 4/4
100% Lines 52/52
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140    92x 92x 92x 92x 92x 92x     2x     45x 45x 45x     90x 90x 46x   90x 46x   90x 46x   90x 46x   90x 46x   90x 46x   90x 46x   90x 46x   90x 46x   90x 46x   90x 46x   90x 46x   90x 46x   90x 46x 46x   90x 46x   90x 46x   90x 46x   90x 46x   90x 46x   90x 46x                                                                                                                          
 
 
import { IJenkinsBuild }        from './jenkins-api-ts-typings'
import { IJenkinsChangeSet }    from './jenkins-api-ts-typings'
import { IJenkinsAction }       from './jenkins-api-ts-typings'
 
 export class JenkinsBuild implements IJenkinsBuild {
    jsonData:           JSON;
    
    _class:             string;
    number:             number;
    url:                string;
 
    displayName:        string;
    fullDisplayName:    string;
    description:        string;
    id:                 string;
    queueId:            string;
    result:             string;
    duration:           number;
    estimatedDuration:  number;
    timestamp:          number;
    date:               Date;
    building:           boolean;
    keepLog:            boolean;
    builtOn:            string;
    mavenVersionUsed:   string;
    
    changeSets:         Array<IJenkinsChangeSet>;
    actions:            Array<IJenkinsAction>;
    artifacts:          Array<any>;
    mavenArtifacts:     Array<any>;
    executor:           Array<any>;
    culprits:           Array<any>;
 
    constructor() {
        this.changeSets = new Array<IJenkinsChangeSet>();
        this.actions = new Array<any>();
        this.artifacts = new Array<any>();
        this.executor = new Array<any>();
        this.culprits = new Array<any>();
        this.mavenArtifacts = new Array<any>();
    }
    
    getJsonData(): string {
        return JSON.stringify(this.jsonData);
    }
    
    public fromJsonString(json: string): void {
        let data:JSON = JSON.parse(json);
        this.jsonData = data;
        
        this.fromJson(data);
    }
    
    public fromJson(data: JSON): void {
        this.jsonData = data;
        
        if(data.hasOwnProperty("number")) {
            this.number = (data as any)["number"];
        }
        
        if(data.hasOwnProperty("url")) {
            this.url = (data as any)["url"];
        }
                
        if(data.hasOwnProperty("displayName")) {
            this.displayName = (data as any)["displayName"];
        }
        
        if(data.hasOwnProperty("fullDisplayName")) {
            this.fullDisplayName = (data as any)["fullDisplayName"];
        }
        
        if(data.hasOwnProperty("description")) {
            this.description = (data as any)["description"];
        }
        
        if(data.hasOwnProperty("_class")) {
            this._class = (data as any)["_class"];
        }
        
        if(data.hasOwnProperty("building")) {
            this.building = (data as any)["building"];
        }
        
        if(data.hasOwnProperty("duration")) {
            this.duration = (data as any)["duration"];
        }
        
        if(data.hasOwnProperty("estimatedDuration")) {
            this.estimatedDuration = (data as any)["estimatedDuration"];
        }
        
        if(data.hasOwnProperty("id")) {
            this.id = (data as any)["id"];
        }
        
        if(data.hasOwnProperty("keepLog")) {
            this.keepLog = (data as any)["keepLog"];
        }
        
        if(data.hasOwnProperty("queueId")) {
            this.queueId = (data as any)["queueId"];
        }
        
        if(data.hasOwnProperty("result")) {
            this.result = (data as any)["result"];
        }
        
        if(data.hasOwnProperty("timestamp")) {
            this.timestamp = (data as any)["timestamp"];
            this.date = new Date((data as any)["timestamp"]);
        }
        
        if(data.hasOwnProperty("builtOn")) {
            this.builtOn = (data as any)["builtOn"];
        }
        
        if(data.hasOwnProperty("artifacts")) {
            this.artifacts = (data as any)["artifacts"];
        }
        
        if(data.hasOwnProperty("executor")) {
            this.executor = (data as any)["executor"];
        }
        
        if(data.hasOwnProperty("culprits")) {
            this.culprits = (data as any)["culprits"];
        }
        
        if(data.hasOwnProperty("mavenVersionUsed")) {
            this.mavenVersionUsed = (data as any)["mavenVersionUsed"];
        }
        
        if(data.hasOwnProperty("mavenArtifacts")) {
            this.mavenArtifacts = (data as any)["mavenArtifacts"];
        }
    }
}