|
|
|
|
@ -21,6 +21,8 @@ import dto.BrewObj;
|
|
|
|
|
import dto.ConnectDB; |
|
|
|
|
import dto.ScanObjPayload; |
|
|
|
|
import dto.BrewObjPayload; |
|
|
|
|
import dto.GitObj; |
|
|
|
|
import dto.GitObjPayload; |
|
|
|
|
|
|
|
|
|
import static constants.HttpHeaders.AUTHORIZATION_STRING; |
|
|
|
|
import java.sql.Connection; |
|
|
|
|
@ -41,7 +43,7 @@ public class CreateScanRequest {
|
|
|
|
|
// ScanObjPayload scanObjPayload;
|
|
|
|
|
|
|
|
|
|
@POST |
|
|
|
|
@Path("/{scanChoice}") |
|
|
|
|
@Path("/brew") |
|
|
|
|
@Consumes({ "application/json" }) |
|
|
|
|
//in theory should take List<String> to clean it up
|
|
|
|
|
public BrewObj invokeScanAnalyze(@Valid String scanInvocation) throws URISyntaxException { |
|
|
|
|
@ -61,10 +63,24 @@ public class CreateScanRequest {
|
|
|
|
|
return brewObj; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private BrewObj scanBrewObj(JSONObject jsonData){ |
|
|
|
|
System.out.println(jsonData.getString("buildSystemType")); |
|
|
|
|
BrewObj aa = null; |
|
|
|
|
return aa; |
|
|
|
|
} |
|
|
|
|
@POST |
|
|
|
|
@Path("/git") |
|
|
|
|
@Consumes({ "application/json" }) |
|
|
|
|
public GitObj invokeGitScanAnalyze(@Valid String scanInvocation)throws URISyntaxException { |
|
|
|
|
JSONObject jsonData = new JSONObject(scanInvocation); |
|
|
|
|
GitObj gitObj = GitObjPayload.constructScanPayload(jsonData); |
|
|
|
|
|
|
|
|
|
ConnectDB connectDB = new ConnectDB(); |
|
|
|
|
Connection conn = connectDB.connect(); |
|
|
|
|
Statement stmt = null; |
|
|
|
|
String sql = "INSERT INTO gitscans (buildsystemtype, repository, reference, commitid) VALUES ('"+gitObj.buildSystemType+"','"+gitObj.repository+"','"+gitObj.reference+"','"+gitObj.commitId+"')"; |
|
|
|
|
try{ |
|
|
|
|
stmt = conn.createStatement(); |
|
|
|
|
ResultSet rs = stmt.executeQuery(sql); |
|
|
|
|
} catch (SQLException e){ |
|
|
|
|
System.out.println(e); |
|
|
|
|
} |
|
|
|
|
gitObj = null; |
|
|
|
|
return gitObj; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|