All files JenkinsNode.ts

100% Statements 46/46
100% Branches 38/38
100% Functions 4/4
100% Lines 46/46
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    70x 70x 70x     2x     34x 34x 34x     68x 68x 36x   68x 36x   68x 36x   68x 36x   68x 36x   68x 36x   68x 36x   68x 36x   68x 36x   68x 36x   68x 36x   68x 36x   68x 36x   68x 36x   68x 36x   68x 36x   68x 36x   68x 36x   68x 36x                                                                                                              
 
 
import { IJenkinsNode }         from './jenkins-api-ts-typings';
 
export class JenkinsNode implements IJenkinsNode{
    jsonData:           JSON;
    
    name:               string;
    url:                string;
    
    displayName:        string;
    _class:             string;
    idle:               boolean;
    jnlpAgent:          boolean;
    icon:               string;
    iconClassName:      string;
    launchSupported:    boolean;
    manualLaunchAllowed:boolean;
    numExecutors:       number;
    offline:            boolean;
    offlineCauseReason: string;
    temporarilyOffline: boolean;
    
    actions:            Array<any>;
    executors:          Array<any>;
    loadStatistics:     any;
    monitorData:        any;
    offlineCause:       any;
    oneOffExecutors:    Array<any>;
    
    constructor() {
        this.actions = new Array<any>();
        this.executors = new Array<any>();
        this.oneOffExecutors = new Array<any>();
    }
    
    getJsonData(): string {
        return JSON.stringify(this.jsonData);
    }
    
    public fromJsonString(json: string) {
        let data:JSON = JSON.parse(json);
        this.jsonData = data;
        
        this.fromJson(data);
    }
    
    public fromJson(data: JSON) {
        this.jsonData = data;
        
        if(data.hasOwnProperty("displayName")) {
            this.displayName = (data as any)["displayName"];
        }
        
        if(data.hasOwnProperty("_class")) {
            this._class = (data as any)["_class"];
        }
        
        if(data.hasOwnProperty("idle")) {
            this.idle = (data as any)["idle"];
        }
        
        if(data.hasOwnProperty("jnlpAgent")) {
            this.jnlpAgent = (data as any)["jnlpAgent"];
        }
        
        if(data.hasOwnProperty("icon")) {
            this.icon = (data as any)["icon"];
        }
        
        if(data.hasOwnProperty("iconClassName")) {
            this.iconClassName = (data as any)["iconClassName"];
        }
        
        if(data.hasOwnProperty("launchSupported")) {
            this.launchSupported = (data as any)["launchSupported"];
        }
        
        if(data.hasOwnProperty("manualLaunchAllowed")) {
            this.manualLaunchAllowed = (data as any)["manualLaunchAllowed"];
        }
        
        if(data.hasOwnProperty("numExecutors")) {
            this.numExecutors = (data as any)["numExecutors"];
        }
        
        if(data.hasOwnProperty("offline")) {
            this.offline = (data as any)["offline"];
        }
        
        if(data.hasOwnProperty("offlineCauseReason")) {
            this.offlineCauseReason = (data as any)["offlineCauseReason"];
        }
        
        if(data.hasOwnProperty("temporarilyOffline")) {
            this.temporarilyOffline = (data as any)["temporarilyOffline"];
        }
        
        if(data.hasOwnProperty("temporarilyOffline")) {
            this.temporarilyOffline = (data as any)["temporarilyOffline"];
        }
        
        if(data.hasOwnProperty("actions")) {
            this.actions = (data as any)["actions"];
        }
        
        if(data.hasOwnProperty("executors")) {
            this.executors = (data as any)["executors"];
        }
        
        if(data.hasOwnProperty("loadStatistics")) {
            this.loadStatistics = (data as any)["loadStatistics"];
        }
        
        if(data.hasOwnProperty("monitorData")) {
            this.monitorData = (data as any)["monitorData"];
        }
        
        if(data.hasOwnProperty("offlineCause")) {
            this.offlineCause = (data as any)["offlineCause"];
        }
        
        if(data.hasOwnProperty("oneOffExecutors")) {
            this.oneOffExecutors = (data as any)["oneOffExecutors"];
        }
    }
}