Search in sources :

Example 6 with ReleaseStepsGOResponse

use of beans.response.ReleaseStepsGOResponse in project MSEC by Tencent.

the class ReleaseOnlyConfig method doRelease.

private ReleaseStepsGOResponse doRelease(ReleasePlan request) {
    ReleaseStepsGOResponse response = new ReleaseStepsGOResponse();
    //把计划保存到session里
    HttpSession session = getHttpRequest().getSession();
    ReleasePlan plan = (ReleasePlan) session.getAttribute("plan");
    //System.out.println("plan id in session:"+plan.getPlan_id());
    if (plan == null) {
        response.setMessage("can NOT find the session, it maybe timeout.");
        response.setStatus(100);
        return response;
    }
    if (request.getConfig_tag() == null || request.getConfig_tag().length() < 1) {
        response.setMessage("config tag is empty!");
        response.setStatus(100);
        return response;
    }
    plan.setConfig_tag(request.getConfig_tag());
    plan.setMemo(request.getMemo());
    //check if saved
    ReleasePlan plan2 = (ReleasePlan) session.getAttribute("plan");
    //System.out.println("config tag:"+plan2.getConfig_tag());
    // Commit Plan
    String commitResult = CommitPlan(plan2);
    if (commitResult == null || !commitResult.equals("success")) {
        response.setMessage("commit failed:" + (commitResult == null ? "" : commitResult));
        response.setStatus(100);
        return response;
    }
    response.setPlanDetail(plan2);
    response.setMessage("success");
    response.setStatus(0);
    return response;
}
Also used : HttpSession(javax.servlet.http.HttpSession) ReleaseStepsGOResponse(beans.response.ReleaseStepsGOResponse) ReleasePlan(beans.request.ReleasePlan)

Example 7 with ReleaseStepsGOResponse

use of beans.response.ReleaseStepsGOResponse in project MSEC by Tencent.

the class ReleaseOnlyLibrary method doRelease.

private ReleaseStepsGOResponse doRelease(ReleasePlan request) {
    ReleaseStepsGOResponse response = new ReleaseStepsGOResponse();
    //把计划保存到session里
    HttpSession session = getHttpRequest().getSession();
    ReleasePlan plan = (ReleasePlan) session.getAttribute("plan");
    if (plan == null) {
        response.setMessage("can NOT find the session, it maybe timeout.");
        response.setStatus(100);
        return response;
    }
    //System.out.println("plan id in session:"+plan.getPlan_id());
    plan.setMemo(request.getMemo());
    // Commit Plan
    String commitResult = CommitPlan(plan);
    if (commitResult == null || !commitResult.equals("success")) {
        response.setMessage("commit failed:" + (commitResult == null ? "" : commitResult));
        response.setStatus(100);
        return response;
    }
    response.setPlanDetail(plan);
    response.setMessage("success");
    response.setStatus(0);
    return response;
}
Also used : HttpSession(javax.servlet.http.HttpSession) ReleaseStepsGOResponse(beans.response.ReleaseStepsGOResponse) ReleasePlan(beans.request.ReleasePlan)

Example 8 with ReleaseStepsGOResponse

use of beans.response.ReleaseStepsGOResponse in project MSEC by Tencent.

the class ReleaseOnlyLibrary method exec.

public ReleaseStepsGOResponse exec(ReleasePlan request) {
    ReleaseStepsGOResponse response = new ReleaseStepsGOResponse();
    String result = checkIdentity();
    if (!result.equals("success")) {
        response.setStatus(99);
        response.setMessage(result);
        return response;
    }
    if (request.getSecond_level_service_name() == null || request.getSecond_level_service_name().length() < 1 || request.getFirst_level_service_name() == null || request.getFirst_level_service_name().length() < 1 || request.getPlan_id() == null || request.getPlan_id().length() < 1) {
        response.setMessage("input is invalid");
        response.setStatus(100);
        return response;
    }
    return doRelease(request);
}
Also used : ReleaseStepsGOResponse(beans.response.ReleaseStepsGOResponse)

Example 9 with ReleaseStepsGOResponse

use of beans.response.ReleaseStepsGOResponse in project MSEC by Tencent.

the class ReleaseStepsGO method exec.

public ReleaseStepsGOResponse exec(ReleasePlan request) {
    ReleaseStepsGOResponse response = new ReleaseStepsGOResponse();
    String result = checkIdentity();
    if (!result.equals("success")) {
        response.setStatus(99);
        response.setMessage(result);
        return response;
    }
    if (request.getSecond_level_service_name() == null || request.getSecond_level_service_name().length() < 1 || request.getFirst_level_service_name() == null || request.getFirst_level_service_name().length() < 1 || request.getPlan_id() == null || request.getPlan_id().length() < 1 || request.getStep_number() == null) {
        response.setMessage("input is invalid");
        response.setStatus(100);
        return response;
    }
    if (request.getStep_number() == 1) {
        return doStep1(request);
    }
    if (request.getStep_number() == 2) {
        return doStep2(request);
    }
    if (request.getStep_number() == 3) {
        return doStep3(request);
    }
    if (request.getStep_number() == 4) {
        response.setMessage("success");
        response.setStatus(0);
        return response;
    }
    if (request.getStep_number() == 5) {
        return doStep5(request);
    }
    response.setMessage("success");
    response.setStatus(0);
    return response;
}
Also used : ReleaseStepsGOResponse(beans.response.ReleaseStepsGOResponse)

Example 10 with ReleaseStepsGOResponse

use of beans.response.ReleaseStepsGOResponse in project MSEC by Tencent.

the class ReleaseStepsGO method doStep1.

private ReleaseStepsGOResponse doStep1(ReleasePlan request) {
    ReleaseStepsGOResponse response = new ReleaseStepsGOResponse();
    if (request.getDest_ip_list() == null || request.getDest_ip_list().size() < 1) {
        response.setMessage("input is invalid");
        response.setStatus(100);
        return response;
    }
    DBUtil util = new DBUtil();
    try {
        util.getConnection();
        String sql = "select dev_lang from t_second_level_service where first_level_service_name=? and second_level_service_name=?";
        ArrayList<Object> params = new ArrayList<Object>();
        params.add(request.getFirst_level_service_name());
        params.add(request.getSecond_level_service_name());
        Map<String, Object> map = util.findSimpleResult(sql, params);
        request.setDev_lang((String) map.get("dev_lang"));
    } catch (Exception e) {
        request.setDev_lang("c++");
    } finally {
        util.releaseConn();
    }
    //把计划保存到session里
    HttpSession session = getHttpRequest().getSession();
    session.setAttribute("plan", request);
    Object ooo = session.getAttribute("plan");
    response.setMessage("success");
    response.setStatus(0);
    return response;
}
Also used : DBUtil(ngse.org.DBUtil) HttpSession(javax.servlet.http.HttpSession) ArrayList(java.util.ArrayList) ReleaseStepsGOResponse(beans.response.ReleaseStepsGOResponse)

Aggregations

ReleaseStepsGOResponse (beans.response.ReleaseStepsGOResponse)11 HttpSession (javax.servlet.http.HttpSession)7 ReleasePlan (beans.request.ReleasePlan)6 ArrayList (java.util.ArrayList)1 DBUtil (ngse.org.DBUtil)1