private JobState buildJobState(Job job, Run run, CiLightProperty property) {
        JobState jobState = new JobState();

        jobState.setName(job.getName());
        try {
            InetAddress localhost = InetAddress.getLocalHost();
            jobState.setServer(localhost.getHostName());
        } catch (UnknownHostException e) {
            e.printStackTrace();
            jobState.setServer("Unknown");
        }
        jobState.setUrl(job.getUrl());
        jobState.setCache(property.getCache());
        BuildState buildState = new BuildState();
        buildState.setNumber(run.number);
        buildState.setUrl(run.getUrl());
        buildState.setPhase(this);
        buildState.setStatus(getStatus(run));

        String rootUrl = Hudson.getInstance().getRootUrl();
        if (rootUrl != null) {
            buildState.setFullUrl(rootUrl + run.getUrl());
        }

        jobState.setBuild(buildState);

        ParametersAction paramsAction = run.getAction(ParametersAction.class);
        if (paramsAction != null && run instanceof AbstractBuild) {
            AbstractBuild build = (AbstractBuild) run;
            EnvVars env = new EnvVars();
            for (ParameterValue value : paramsAction.getParameters())
                if (!value.isSensitive())
                    value.buildEnvVars(build, env);
            buildState.setParameters(env);
        }

        return jobState;
    }