How to use delete method of Unobtainium Package

Best Unobtainium_ruby code snippet using Unobtainium.delete

DBSetup.java

Source:DBSetup.java Github

copy

Full Screen

1package com.fdmgroup.DAO;2public class DBSetup 3{4 private GenericDAO genericDAO;5 6 public DBSetup()7 {8 genericDAO = new GenericDAO();9 }10 11 public void setupDB()12 {13//Tables, Sequences, Triggers14 String query = ""15 + "CREATE TABLE departments ( "16 + " deptid number NOT NULL, "17 + " CONSTRAINT pk_departments_deptid PRIMARY KEY(deptid), "18 + " name varchar2(30) NOT NULL "19 + " )";20 genericDAO.stmtExecute(query);21 query = "" 22 + "CREATE SEQUENCE \"departments_SEQ\" MINVALUE 0 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 0 CACHE 20 NOORDER NOCYCLE";23 genericDAO.stmtExecute(query);24 query = ""25 + "CREATE OR REPLACE TRIGGER \"departments_TRG\" "26 + " BEFORE INSERT ON departments "27 + " FOR EACH ROW "28 + " BEGIN "29 + " <<COLUMN_SEQUENCES>> "30 + " BEGIN "31 + " IF INSERTING AND :NEW.deptid IS NULL THEN "32 + " SELECT \"departments_SEQ\".NEXTVAL INTO :NEW.deptid FROM SYS.DUAL; "33 + " END IF; "34 + " END COLUMN_SEQUENCES; "35 + " END;";36 genericDAO.stmtExecute(query);37 query = ""38 + "CREATE TABLE roles ( "39 + " roleid number, "40 + " CONSTRAINT pk_roles_roleid PRIMARY KEY(roleid), "41 + " rolename varchar2(30) NOT NULL "42 + " )";43 genericDAO.stmtExecute(query);44 query = ""45 + "CREATE SEQUENCE \"roles_SEQ\" MINVALUE 0 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 0 CACHE 20 NOORDER NOCYCLE";46 genericDAO.stmtExecute(query);47 query = ""48 + "CREATE OR REPLACE TRIGGER \"roles_TRG\" "49 + " BEFORE INSERT ON roles "50 + " FOR EACH ROW "51 + " BEGIN "52 + " <<COLUMN_SEQUENCES>> "53 + " BEGIN "54 + " IF INSERTING AND :NEW.roleid IS NULL THEN "55 + " SELECT \"roles_SEQ\".NEXTVAL INTO :NEW.roleid FROM SYS.DUAL; "56 + " END IF; "57 + " END COLUMN_SEQUENCES; "58 + " END;";59 genericDAO.stmtExecute(query);60 query = ""61 + " CREATE TABLE users ( "62 + " userid number, "63 + " CONSTRAINT pk_users_userid PRIMARY KEY (userid), "64 + " deptid number NOT NULL, "65 + " CONSTRAINT fk_users_deptid FOREIGN KEY(deptid) REFERENCES departments(deptid), "66 + " username varchar2(30) NOT NULL, "67 + " CONSTRAINT UNIQUE_USERS_USERNAME UNIQUE (USERNAME), " 68 + " password varchar2(30) NOT NULL, "69 + " email varchar2(50) NOT NULL "70 + " ) ";71 genericDAO.stmtExecute(query);72 query = ""73 + " CREATE SEQUENCE \"USERS_SEQ\" MINVALUE 0 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 0 CACHE 20 NOORDER NOCYCLE ";74 genericDAO.stmtExecute(query);75 query = ""76 + "CREATE OR REPLACE TRIGGER \"USERS_TRG\" "77 + " BEFORE INSERT ON USERS "78 + " FOR EACH ROW "79 + " BEGIN "80 + " <<COLUMN_SEQUENCES>> "81 + " BEGIN "82 + " IF INSERTING AND :NEW.USERID IS NULL THEN "83 + " SELECT \"USERS_SEQ\".NEXTVAL INTO :NEW.USERID FROM SYS.DUAL; "84 + " END IF; "85 + " END COLUMN_SEQUENCES; "86 + " END;";87 genericDAO.stmtExecute(query);88 query = ""89 + "CREATE TABLE userroles ( "90 + " userid number NOT NULL, "91 + " CONSTRAINT fk_userroles_userid FOREIGN KEY(userid) REFERENCES users(userid), "92 + " roleid number NOT NULL, "93 + " CONSTRAINT fk_userroles_roleid FOREIGN KEY(roleid) REFERENCES roles(roleid) "94 + " )";95 genericDAO.stmtExecute(query);96 query = ""97 + "CREATE OR REPLACE TRIGGER \"USERS_USERROLES_TRG\" "98 + " AFTER INSERT ON USERS "99 + " FOR EACH ROW "100 + " BEGIN "101 + " INSERT INTO USERROLES VALUES (\"USERS_SEQ\".CURRVAL, 0); "102 + " END;";103 genericDAO.stmtExecute(query);104 query = ""105 + "CREATE TABLE statuss ( "106 + " statusid number, "107 + " CONSTRAINT pk_statuss_statusid PRIMARY KEY(statusid), "108 + " status varchar2(30) NOT NULL "109 + " )";110 genericDAO.stmtExecute(query);111 query = ""112 + "CREATE SEQUENCE \"statuss_SEQ\" MINVALUE 0 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 0 CACHE 20 NOORDER NOCYCLE";113 genericDAO.stmtExecute(query);114 query = ""115 + "CREATE OR REPLACE TRIGGER \"statuss_TRG\" "116 + " BEFORE INSERT ON statuss "117 + " FOR EACH ROW "118 + " BEGIN "119 + " <<COLUMN_SEQUENCES>> "120 + " BEGIN "121 + " IF INSERTING AND :NEW.statusid IS NULL THEN "122 + " SELECT \"statuss_SEQ\".NEXTVAL INTO :NEW.statusid FROM SYS.DUAL; "123 + " END IF; "124 + " END COLUMN_SEQUENCES; "125 + " END;";126 genericDAO.stmtExecute(query);127 query = ""128 + "CREATE TABLE issues ( "129 + " issueid number CONSTRAINT pk_issues_issueid PRIMARY KEY, "130 + " Title varchar2(30) NOT NULL, "131 + " CONSTRAINT UNIQUE_ISSUES_TITLE UNIQUE (TITLE), " 132 + " UserDescription varchar2(300) NOT NULL, "133 + " AdminComment varchar2(300), "134 + " AssignedTo number, "135 + " CONSTRAINT fk_issues_AssignedTo FOREIGN KEY(AssignedTo) REFERENCES users(userid), "136 + " SubmittedBy number NOT NULL, "137 + " CONSTRAINT fk_issues_SubmittedBy FOREIGN KEY(SubmittedBy) REFERENCES users(userid), "138 + " StatusId number NOT NULL, "139 + " CONSTRAINT fk_issues_StatusId FOREIGN KEY(StatusId) REFERENCES statuss(StatusId), "140 + " priority number NOT NULL, "141 + " DateSubmitted date NOT NULL, "142 + " DateResolved date, "143 + " DeptId number NOT NULL, "144 + " CONSTRAINT fk_issues_DeptId FOREIGN KEY(DeptId) REFERENCES departments(deptid) "145 + " )";146 genericDAO.stmtExecute(query);147 query = ""148 + "CREATE SEQUENCE \"issues_SEQ\" MINVALUE 0 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 0 CACHE 20 NOORDER NOCYCLE";149 genericDAO.stmtExecute(query);150 query = ""151 + "CREATE OR REPLACE TRIGGER \"issues_TRG\" "152 + " BEFORE INSERT ON issues "153 + " FOR EACH ROW "154 + " BEGIN "155 + " <<COLUMN_SEQUENCES>> "156 + " BEGIN "157 + " IF INSERTING AND :NEW.issueid IS NULL THEN "158 + " SELECT \"issues_SEQ\".NEXTVAL INTO :NEW.issueid FROM SYS.DUAL; "159 + " END IF; "160 + " END COLUMN_SEQUENCES; "161 + " END;";162 genericDAO.stmtExecute(query);163 query = ""164 + "CREATE TABLE issueupdates ( "165 + " issueupdateid number, "166 + " CONSTRAINT pk_issueupdates_issueupdateid PRIMARY KEY(issueupdateid), "167 + " issueid number, "168 + " CONSTRAINT fk_issueupdates_issueid FOREIGN KEY(issueid) REFERENCES issues(issueid), "169 + " submittedby number NOT NULL, "170 + " CONSTRAINT fk_issueupdates_submittedby FOREIGN KEY(submittedby) REFERENCES users(userid), "171 + " updateDate date NOT NULL, "172 + " updateComment varchar2(300) NOT NULL "173 + " )";174 genericDAO.stmtExecute(query);175 query = ""176 + "CREATE SEQUENCE \"issueupdates_SEQ\" MINVALUE 0 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 0 CACHE 20 NOORDER NOCYCLE";177 genericDAO.stmtExecute(query);178 query = ""179 + "CREATE OR REPLACE TRIGGER \"issueupdates_TRG\" "180 + " BEFORE INSERT ON issueupdates "181 + " FOR EACH ROW "182 + " BEGIN "183 + " <<COLUMN_SEQUENCES>> "184 + " BEGIN "185 + " IF INSERTING AND :NEW.issueupdateid IS NULL THEN "186 + " SELECT \"issueupdates_SEQ\".NEXTVAL INTO :NEW.issueupdateid FROM SYS.DUAL; "187 + " END IF; "188 + " END COLUMN_SEQUENCES; "189 + " END;";190 genericDAO.stmtExecute(query);191//Stored Procedures192 query = ""193 + "CREATE OR REPLACE PROCEDURE ADD_DEPARTMENT "194 + "( "195 + " i_Name IN VARCHAR2 "196 + ") "197 + "IS "198 + "BEGIN "199 + " INSERT INTO DEPARTMENTS(NAME) "200 + " VALUES (i_Name); "201 + " COMMIT; "202 + "END ADD_DEPARTMENT;";203 genericDAO.stmtExecute(query);204 query = ""205 + "CREATE OR REPLACE PROCEDURE ADD_ISSUE "206 + "( "207 + " i_title IN VARCHAR2, "208 + " i_userdescription IN VARCHAR2, "209 + " i_submittedby IN number, "210 + " i_statusid IN number, "211 + " i_priority IN number, "212 + " i_datesubmitted IN date, "213 + " i_deptid IN number "214 + ") "215 + "IS "216 + "BEGIN "217 + " INSERT INTO ISSUES(TITLE, USERDESCRIPTION, SUBMITTEDBY, STATUSID, PRIORITY, DATESUBMITTED, DEPTID) "218 + " VALUES (i_title, i_userdescription, i_submittedby, i_statusid, i_priority, i_datesubmitted, i_deptid); "219 + " COMMIT; "220 + "END ADD_ISSUE;";221 genericDAO.stmtExecute(query);222 query = ""223 + "CREATE OR REPLACE PROCEDURE ADD_ISSUEUPDATE "224 + "( "225 + " i_issueId IN number, "226 + " i_submittedby IN number, "227 + " i_updateDate IN date, "228 + " i_updateComment IN varchar "229 + ") "230 + "IS "231 + "BEGIN "232 + " INSERT INTO ISSUEUPDATES(ISSUEID, SUBMITTEDBY, UPDATEDATE, UPDATECOMMENT) "233 + " VALUES (i_issueId, i_submittedby, i_updateDate, i_updateComment); "234 + " COMMIT; "235 + "END ADD_ISSUEUPDATE;";236 genericDAO.stmtExecute(query);237 query = ""+ "CREATE OR REPLACE PROCEDURE ADD_ROLE "238 + "( "239 + " i_Name IN VARCHAR2 "240 + ") "241 + "IS "242 + "BEGIN "243 + " INSERT INTO ROLES(ROLENAME) "244 + " VALUES (i_Name); "245 + " COMMIT; "246 + "END ADD_ROLE;";247 genericDAO.stmtExecute(query);248 query = ""249 + "CREATE OR REPLACE PROCEDURE ADD_STATUS "250 + "( "251 + " i_Name IN VARCHAR2 "252 + ") "253 + "IS "254 + "BEGIN "255 + " INSERT INTO STATUSS(STATUS) "256 + " VALUES (i_Name); "257 + " COMMIT; "258 + "END ADD_STATUS;";259 genericDAO.stmtExecute(query);260 query = ""261 + "CREATE OR REPLACE PROCEDURE ADD_USER "262 + "( "263 + " i_deptid IN NUMBER, "264 + " i_username IN VARCHAR2, "265 + " i_password IN VARCHAR2, "266 + " i_email IN VARCHAR2 "267 + ") "268 + "IS "269 + "BEGIN "270 + " INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) "271 + " VALUES (i_deptid, i_username, i_password, i_email); "272 + " COMMIT; "273 + "END ADD_USER;"; 274 genericDAO.stmtExecute(query);275 query = ""276 + "CREATE OR REPLACE PROCEDURE ADD_USERROLE "277 + "( "278 + " i_userId IN NUMBER, "279 + " i_roleId IN NUMBER "280 + ") "281 + "IS "282 + "BEGIN "283 + " INSERT INTO USERROLES(userId, roleId) "284 + " VALUES (i_userId, i_roleId); "285 + " COMMIT; "286 + "END ADD_USERROLE;";287 genericDAO.stmtExecute(query);288 query = ""289 + "create or replace PROCEDURE GET_DEPARTMENT_BY_ID "290 + "( "291 + " i_deptId IN number, "292 + " o_deptId OUT number, "293 + " o_Name OUT VARCHAR2 "294 + ") "295 + "IS "296 + "BEGIN "297 + " SELECT deptId, Name "298 + " INTO o_deptId, o_Name "299 + " FROM DEPARTMENTS WHERE deptId = i_deptId; "300 + "END GET_DEPARTMENT_BY_ID;";301 genericDAO.stmtExecute(query);302 query = ""303 + "CREATE OR REPLACE PROCEDURE GET_DEPARTMENTS "304 + "( "305 + " o_recordset OUT SYS_REFCURSOR "306 + ") "307 + "IS "308 + "BEGIN "309 + " OPEN o_recordset FOR "310 + " SELECT DEPTID, NAME FROM DEPARTMENTS "311 + " ORDER BY DEPTID; "312 + "END GET_DEPARTMENTS;";313 genericDAO.stmtExecute(query);314 query = ""315 + "create or replace PROCEDURE GET_ISSUE_BY_ID "316 + "( "317 + " i_issueid IN number, "318 + " o_issueid OUT number, "319 + " o_Title OUT VARCHAR2, "320 + " o_UserDescription OUT VARCHAR2, "321 + " o_AdminComment OUT VARCHAR2, "322 + " o_AssignedTo OUT number, "323 + " o_AssignedUsername OUT VARCHAR2, "324 + " o_SubmittedBy OUT number, "325 + " o_SubmittedByUsername OUT VARCHAR2, "326 + " o_StatusId OUT number, "327 + " o_Status OUT VARCHAR2, "328 + " o_priority OUT number, "329 + " o_DateSubmitted OUT date, "330 + " o_DateResolved OUT date, "331 + " o_DeptId OUT number, "332 + " o_DeptName OUT VARCHAR2 "333 + ") "334 + "IS "335 + "BEGIN "336 + " SELECT issueId, title, userDescription, adminComment, assignedTo, assUser.username, submittedBy, subUser.Username, iss.statusId, Status, Priority, dateSubmitted, dateResolved, iss.deptid, dep.Name "337 + " INTO o_issueid, o_Title, o_UserDescription, o_AdminComment, o_AssignedTo, o_AssignedUsername, o_SubmittedBy, o_SubmittedByUsername, o_StatusId, o_Status, o_priority, o_DateSubmitted, o_DateResolved, o_DeptId, o_DeptName "338 + " FROM ISSUES iss "339 + " JOIN STATUSS stats ON "340 + " iss.statusId = stats.statusId "341 + " JOIN DEPARTMENTS DEP ON "342 + " iss.DeptId = dep.DeptId "343 + " JOIN USERS subUser ON "344 + " SUBMITTEDBY = subUser.USERID "345 + " JOIN USERS assUser ON "346 + " ASSIGNEDTO = assUser.USERID "347 + " WHERE issueid = i_issueid; "348 + "END GET_ISSUE_BY_ID;";349 genericDAO.stmtExecute(query);350 query = ""351 + "create or replace PROCEDURE GET_ISSUE_BY_TITLE "352 + "( "353 + " i_Title IN VARCHAR2, "354 + " o_issueid OUT number, "355 + " o_Title OUT VARCHAR2, "356 + " o_UserDescription OUT VARCHAR2, "357 + " o_AdminComment OUT VARCHAR2, "358 + " o_AssignedTo OUT number, "359 + " o_AssignedUsername OUT VARCHAR2, "360 + " o_SubmittedBy OUT number, "361 + " o_SubmittedByUsername OUT VARCHAR2, "362 + " o_StatusId OUT number, "363 + " o_Status OUT VARCHAR2, "364 + " o_priority OUT number, "365 + " o_DateSubmitted OUT date, "366 + " o_DateResolved OUT date, "367 + " o_DeptId OUT number, "368 + " o_DeptName OUT VARCHAR2 "369 + ") "370 + "IS "371 + "BEGIN "372 + " SELECT issueId, title, userDescription, adminComment, assignedTo, assUser.username, submittedBy, subUser.Username, iss.statusId, Status, Priority, dateSubmitted, dateResolved, iss.deptid, dep.Name "373 + " INTO o_issueid, o_Title, o_UserDescription, o_AdminComment, o_AssignedTo, o_AssignedUsername, o_SubmittedBy, o_SubmittedByUsername, o_StatusId, o_Status, o_priority, o_DateSubmitted, o_DateResolved, o_DeptId, o_DeptName "374 + " FROM ISSUES iss "375 + " JOIN STATUSS stats ON "376 + " iss.statusId = stats.statusId "377 + " JOIN DEPARTMENTS DEP ON "378 + " iss.DeptId = dep.DeptId "379 + " JOIN USERS subUser ON "380 + " SUBMITTEDBY = subUser.USERID "381 + " JOIN USERS assUser ON "382 + " ASSIGNEDTO = assUser.USERID "383 + " WHERE Title = i_Title; "384 + "END GET_ISSUE_BY_TITLE;";385 genericDAO.stmtExecute(query);386 query = ""387 + "create or replace PROCEDURE GET_ISSUES_BY_ASSIGNEDTO "388 + "( "389 + " i_AssignedTo IN number, "390 + " o_recordset OUT SYS_REFCURSOR "391 + ") "392 + "IS "393 + "BEGIN "394 + " if i_AssignedTo IS NULL THEN "395 + " OPEN o_recordset FOR "396 + " SELECT issueId, title, userDescription, adminComment, assignedTo, assUser.username, submittedBy, subUser.Username, iss.statusId, Status, Priority, dateSubmitted, dateResolved, iss.deptid, dep.Name "397 + " FROM ISSUES iss "398 + " JOIN STATUSS stats ON "399 + " iss.statusId = stats.statusId "400 + " JOIN DEPARTMENTS DEP ON "401 + " iss.DeptId = dep.DeptId "402 + " JOIN USERS subUser ON "403 + " SUBMITTEDBY = subUser.USERID "404 + " JOIN USERS assUser ON "405 + " ASSIGNEDTO = assUser.USERID "406 + " where ASSIGNEDTO IS NULL "407 + " ORDER BY ISSUEID; "408 + " else "409 + " OPEN o_recordset FOR "410 + " SELECT issueId, title, userDescription, adminComment, assignedTo, assUser.username, submittedBy, subUser.Username, iss.statusId, Status, Priority, dateSubmitted, dateResolved, iss.deptid, dep.Name "411 + " FROM ISSUES iss "412 + " JOIN STATUSS stats ON "413 + " iss.statusId = stats.statusId "414 + " JOIN DEPARTMENTS DEP ON "415 + " iss.DeptId = dep.DeptId "416 + " JOIN USERS subUser ON "417 + " SUBMITTEDBY = subUser.USERID "418 + " JOIN USERS assUser ON "419 + " ASSIGNEDTO = assUser.USERID "420 + " where ASSIGNEDTO = i_AssignedTo "421 + " ORDER BY ISSUEID; "422 + " end if; "423 + " "424 + "END GET_ISSUES_BY_ASSIGNEDTO;";425 genericDAO.stmtExecute(query);426 query = ""427 + "create or replace PROCEDURE GET_ISSUES_BY_SUBMITTEDBY "428 + "( "429 + " i_SubmittedBy IN number, "430 + " o_recordset OUT SYS_REFCURSOR "431 + ") "432 + "IS "433 + "BEGIN "434 + " OPEN o_recordset FOR "435 + " SELECT issueId, title, userDescription, adminComment, assignedTo, assUser.username, submittedBy, subUser.Username, iss.statusId, Status, Priority, dateSubmitted, dateResolved, iss.deptid, dep.Name "436 + " FROM ISSUES iss "437 + " JOIN STATUSS stats ON "438 + " iss.statusId = stats.statusId "439 + " JOIN DEPARTMENTS DEP ON "440 + " iss.DeptId = dep.DeptId "441 + " JOIN USERS subUser ON "442 + " SUBMITTEDBY = subUser.USERID "443 + " JOIN USERS assUser ON "444 + " ASSIGNEDTO = assUser.USERID "445 + " where SubmittedBy = i_SubmittedBy "446 + " ORDER BY ISSUEID; "447 + "END GET_ISSUES_BY_SUBMITTEDBY;";448 genericDAO.stmtExecute(query);449 query = ""450 + "create or replace PROCEDURE GET_ISSUES_UNASSIGNED "451 + "( "452 + " o_recordset OUT SYS_REFCURSOR "453 + ") "454 + "IS "455 + "BEGIN "456 + " OPEN o_recordset FOR "457 + " SELECT issueId, title, userDescription, adminComment, assignedTo, assUser.username, submittedBy, subUser.Username, iss.statusId, Status, Priority, dateSubmitted, dateResolved, iss.deptid, dep.Name "458 + " FROM ISSUES iss "459 + " JOIN STATUSS stats ON "460 + " iss.statusId = stats.statusId "461 + " JOIN DEPARTMENTS DEP ON "462 + " iss.DeptId = dep.DeptId "463 + " JOIN USERS subUser ON "464 + " SUBMITTEDBY = subUser.USERID "465 + " JOIN USERS assUser ON "466 + " ASSIGNEDTO = assUser.USERID "467 + " where ASSIGNEDTO IS NULL "468 + " ORDER BY ISSUEID; "469 + "END GET_ISSUES_UNASSIGNED;";470 genericDAO.stmtExecute(query);471 query = ""472 + "create or replace PROCEDURE GET_ISSUES "473 + "( "474 + " o_recordset OUT SYS_REFCURSOR "475 + ") "476 + "IS "477 + "BEGIN "478 + " OPEN o_recordset FOR "479 + " SELECT issueId, title, userDescription, adminComment, assignedTo, assUser.username, submittedBy, subUser.Username, iss.statusId, Status, Priority, dateSubmitted, dateResolved, iss.deptid, dep.Name "480 + " FROM ISSUES iss "481 + " JOIN STATUSS stats ON "482 + " iss.statusId = stats.statusId "483 + " JOIN DEPARTMENTS DEP ON "484 + " iss.DeptId = dep.DeptId "485 + " JOIN USERS subUser ON "486 + " SUBMITTEDBY = subUser.USERID "487 + " JOIN USERS assUser ON "488 + " ASSIGNEDTO = assUser.USERID "489 + " ORDER BY ISSUEID; "490 + "END GET_ISSUES;";491 genericDAO.stmtExecute(query);492 query = ""493 + "create or replace PROCEDURE GET_ISSUEUPDATE_BY_ID "494 + "( "495 + " i_issueUpdateId IN number, "496 + " o_issueUpdateId OUT number, "497 + " o_issueid OUT number, "498 + " o_SubmittedBy OUT number, "499 + " o_SubmittedByUsername OUT VARCHAR2, "500 + " o_UpdateDate OUT date, "501 + " o_UpdateComment OUT VARCHAR2 "502 + ") "503 + "IS "504 + "BEGIN "505 + " SELECT issueUpdateId, issueid, SubmittedBy, USERNAME, UpdateDate, UpdateComment "506 + " INTO o_issueUpdateId, o_issueid, o_SubmittedBy, o_SubmittedByUsername, o_UpdateDate, o_UpdateComment "507 + " FROM ISSUEUPDATES "508 + " JOIN USERS ON "509 + " SUBMITTEDBY = USERID "510 + " WHERE issueUpdateId = i_issueUpdateId; "511 + "END GET_ISSUEUPDATE_BY_ID;";512 genericDAO.stmtExecute(query);513 query = ""514 + "create or replace PROCEDURE GET_ISSUEUPDATES_BY_ISSUEID "515 + "( "516 + " i_issueId IN NUMBER, "517 + " o_recordset OUT SYS_REFCURSOR "518 + ") "519 + "IS "520 + "BEGIN "521 + " OPEN o_recordset FOR "522 + " SELECT ISSUEUPDATEID, ISSUEID, SUBMITTEDBY, USERNAME, UPDATEDATE, UPDATECOMMENT "523 + " FROM ISSUEUPDATES "524 + " JOIN USERS ON "525 + " SUBMITTEDBY = USERID "526 + " where ISSUEID = i_issueId; "527 + "END GET_ISSUEUPDATES_BY_ISSUEID;";528 genericDAO.stmtExecute(query);529 query = ""530 + "create or replace PROCEDURE GET_ISSUEUPDATES "531 + "( "532 + " o_recordset OUT SYS_REFCURSOR "533 + ") "534 + "IS "535 + "BEGIN "536 + " OPEN o_recordset FOR "537 + " SELECT ISSUEUPDATEID, ISSUEID, SUBMITTEDBY, USERNAME, UPDATEDATE, UPDATECOMMENT "538 + " FROM ISSUEUPDATES "539 + " JOIN USERS ON "540 + " SUBMITTEDBY = USERID "541 + " ORDER BY ISSUEID, ISSUEUPDATEID; "542 + "END GET_ISSUEUPDATES;";543 genericDAO.stmtExecute(query);544 query = ""545 + "create or replace PROCEDURE GET_ROLE_BY_ID "546 + "( "547 + " i_roleId IN number, "548 + " o_roleId OUT number, "549 + " o_Name OUT VARCHAR2 "550 + ") "551 + "IS "552 + "BEGIN "553 + " SELECT roleId, RoleName "554 + " INTO o_roleId, o_Name "555 + " FROM ROLES WHERE roleId = i_roleId; "556 + "END GET_ROLE_BY_ID;";557 genericDAO.stmtExecute(query);558 query = ""559 + "CREATE OR REPLACE PROCEDURE GET_ROLES_BY_USERID "560 + "( "561 + " i_userId IN number, "562 + " o_recordset OUT SYS_REFCURSOR "563 + ") "564 + "IS "565 + "BEGIN "566 + " OPEN o_recordset FOR "567 + " SELECT ROL.ROLEID, ROL.ROLENAME "568 + " FROM ROLES ROL "569 + " JOIN USERROLES UR ON "570 + " UR.ROLEID = ROL.ROLEID "571 + " JOIN USERS US ON "572 + " UR.USERID = US.USERID "573 + " where US.USERID = i_userId "574 + " ORDER BY ROL.ROLEID; "575 + "END GET_ROLES_BY_USERID;";576 genericDAO.stmtExecute(query);577 query = ""578 + "CREATE OR REPLACE PROCEDURE GET_ROLES "579 + "( "580 + " o_recordset OUT SYS_REFCURSOR "581 + ") "582 + "IS "583 + "BEGIN "584 + " OPEN o_recordset FOR "585 + " SELECT ROLEID, ROLENAME FROM ROLES "586 + " ORDER BY ROLEID; "587 + "END GET_ROLES;";588 genericDAO.stmtExecute(query);589 query = ""590 + "create or replace PROCEDURE GET_STATUS_BY_ID "591 + "( "592 + " i_statusId IN number, "593 + " o_statusId OUT number, "594 + " o_Name OUT VARCHAR2 "595 + ") "596 + "IS "597 + "BEGIN "598 + " SELECT statusId, status "599 + " INTO o_statusId, o_Name "600 + " FROM STATUSS WHERE statusId = i_statusId; "601 + "END GET_STATUS_BY_ID;";602 genericDAO.stmtExecute(query);603 query = ""604 + "CREATE OR REPLACE PROCEDURE GET_STATUSS "605 + "( "606 + " o_recordset OUT SYS_REFCURSOR "607 + ") "608 + "IS "609 + "BEGIN "610 + " OPEN o_recordset FOR "611 + " SELECT STATUSID, STATUS FROM STATUSS "612 + " ORDER BY STATUSID; "613 + "END GET_STATUSS;";614 genericDAO.stmtExecute(query);615 query = ""616 + "create or replace PROCEDURE GET_USER_BY_ID "617 + "( "618 + " i_userid IN number, "619 + " o_userid OUT number, "620 + " o_deptid OUT number, "621 + " o_deptName OUT VARCHAR2, "622 + " o_username OUT VARCHAR2, "623 + " o_password OUT VARCHAR2, "624 + " o_email OUT VARCHAR2 "625 + ") "626 + "IS "627 + "BEGIN "628 + " SELECT userid, USERS.DEPTID, DEPT.NAME, username, password, email "629 + " INTO o_userid, o_deptid, o_deptName, o_username, o_password, o_email "630 + " FROM USERS "631 + " JOIN DEPARTMENTS DEPT ON "632 + " USERS.DEPTID = DEPT.DEPTID "633 + " WHERE userid = i_userid; "634 + "END GET_USER_BY_ID;";635 genericDAO.stmtExecute(query);636 query = ""637 + "create or replace PROCEDURE GET_USER_BY_USERNAME "638 + "( "639 + " i_username IN VARCHAR2, "640 + " o_userid OUT number, "641 + " o_deptid OUT number, "642 + " o_deptName OUT VARCHAR2, "643 + " o_username OUT VARCHAR2, "644 + " o_password OUT VARCHAR2, "645 + " o_email OUT VARCHAR2 "646 + ") "647 + "IS "648 + "BEGIN "649 + " SELECT userid, USERS.DEPTID, DEPT.NAME, username, password, email "650 + " INTO o_userid, o_deptid, o_deptName, o_username, o_password, o_email "651 + " FROM USERS "652 + " JOIN DEPARTMENTS DEPT ON "653 + " USERS.DEPTID = DEPT.DEPTID "654 + " WHERE username = i_username; "655 + "END GET_USER_BY_USERNAME;";656 genericDAO.stmtExecute(query);657 query = ""658 + "CREATE OR REPLACE PROCEDURE GET_USERROLES "659 + "( "660 + " o_recordset OUT SYS_REFCURSOR "661 + ") "662 + "IS "663 + "BEGIN "664 + " OPEN o_recordset FOR "665 + " SELECT userId, roleId FROM USERROLES "666 + " ORDER BY userId, roleId; "667 + "END GET_USERROLES;";668 genericDAO.stmtExecute(query);669 query = ""670 + "CREATE OR REPLACE PROCEDURE GET_USERS "671 + "( "672 + " o_recordset OUT SYS_REFCURSOR "673 + ") "674 + "IS "675 + "BEGIN "676 + " OPEN o_recordset FOR "677 + " SELECT USERID, USERS.DEPTID, DEPT.NAME, USERNAME, PASSWORD, EMAIL FROM USERS "678 + " JOIN DEPARTMENTS DEPT ON "679 + " USERS.DEPTID = DEPT.DEPTID "680 + " ORDER BY USERID; "681 + "END GET_USERS;";682 genericDAO.stmtExecute(query);683 query = ""684 + "CREATE OR REPLACE PROCEDURE REMOVE_DEPARTMENT "685 + "( "686 + " i_deptId IN number "687 + ") "688 + "IS "689 + "BEGIN "690 + " DELETE FROM DEPARTMENTS WHERE deptId = i_deptId; "691 + " COMMIT; "692 + "END REMOVE_DEPARTMENT;";693 genericDAO.stmtExecute(query);694 query = ""695 + "CREATE OR REPLACE PROCEDURE REMOVE_ISSUE "696 + "( "697 + " i_issueid IN number "698 + ") "699 + "IS "700 + "BEGIN "701 + " DELETE FROM ISSUEUPDATES WHERE issueId = i_issueId; "702 + " DELETE FROM ISSUES WHERE issueid = i_issueid; "703 + " COMMIT; "704 + "END REMOVE_ISSUE;"; 705 genericDAO.stmtExecute(query);706 query = ""707 + "CREATE OR REPLACE PROCEDURE REMOVE_ISSUEUPDATE_BY_ISSUEID "708 + "( "709 + " i_issueId IN NUMBER "710 + ") "711 + "IS "712 + "BEGIN "713 + " DELETE FROM ISSUEUPDATES WHERE issueId = i_issueId; "714 + " "715 + " COMMIT; "716 + "END REMOVE_ISSUEUPDATE_BY_ISSUEID;";717 genericDAO.stmtExecute(query);718 query = ""719 + "CREATE OR REPLACE PROCEDURE REMOVE_ISSUEUPDATE "720 + "( "721 + " i_issueUpdateId IN number "722 + ") "723 + "IS "724 + "BEGIN "725 + " DELETE FROM ISSUEUPDATES WHERE issueUpdateId = i_issueUpdateId; "726 + " COMMIT; "727 + "END REMOVE_ISSUEUPDATE;";728 genericDAO.stmtExecute(query);729 query = ""730 + "CREATE OR REPLACE PROCEDURE REMOVE_ROLE "731 + "( "732 + " i_roleId IN NUMBER "733 + ") "734 + "IS "735 + "BEGIN "736 + " DELETE FROM USERROLES WHERE roleId = i_roleId; "737 + " DELETE FROM ROLES WHERE roleId = i_roleId; "738 + " COMMIT; "739 + "END REMOVE_ROLE;";740 genericDAO.stmtExecute(query);741 query = ""742 + "CREATE OR REPLACE PROCEDURE REMOVE_STATUS "743 + "( "744 + " i_statusId IN NUMBER "745 + ") "746 + "IS "747 + "BEGIN "748 + " DELETE FROM STATUSS WHERE statusId = i_statusId; "749 + " COMMIT; "750 + "END REMOVE_STATUS;"; 751 genericDAO.stmtExecute(query);752 query = ""753 + "CREATE OR REPLACE PROCEDURE REMOVE_USER "754 + "( "755 + " i_userid IN number "756 + ") "757 + "IS "758 + "BEGIN "759 + " DELETE FROM USERROLES WHERE userid = i_userid; "760 + " DELETE FROM USERS WHERE userid = i_userid; "761 + " COMMIT; "762 + "END REMOVE_USER;";763 genericDAO.stmtExecute(query);764 query = ""765 + "CREATE OR REPLACE PROCEDURE REMOVE_USERROLE "766 + "( "767 + " i_userId IN NUMBER, "768 + " i_roleId IN NUMBER "769 + ") "770 + "IS "771 + "BEGIN "772 + " DELETE FROM USERROLES WHERE userId = i_userId AND roleId = i_roleId; "773 + " COMMIT; "774 + "END REMOVE_USERROLE;";775 genericDAO.stmtExecute(query);776 query = ""777 + "create or replace PROCEDURE UPDATE_DEPARTMENT "778 + "( "779 + " i_deptId IN NUMBER, "780 + " i_Name IN VARCHAR2 "781 + ") "782 + "IS "783 + "BEGIN "784 + " UPDATE DEPARTMENTS SET Name = i_Name where deptId = i_deptId; "785 + " COMMIT; "786 + "END UPDATE_DEPARTMENT;";787 genericDAO.stmtExecute(query);788 query = ""789 + "create or replace PROCEDURE UPDATE_ISSUE "790 + "( "791 + " i_issueid IN number, "792 + " i_Title IN VARCHAR2, "793 + " i_UserDescription IN VARCHAR2, "794 + " i_AdminComment IN VARCHAR2, "795 + " i_AssignedTo IN number, "796 + " i_SubmittedBy IN number, "797 + " i_StatusId IN number, "798 + " i_priority IN number, "799 + " i_DateSubmitted IN date, "800 + " i_DateResolved IN date, "801 + " i_DeptId IN number "802 + ") "803 + "IS "804 + "BEGIN "805 + " UPDATE ISSUES SET Title = i_Title, UserDescription = i_UserDescription, AdminComment = i_AdminComment, AssignedTo = i_AssignedTo, SubmittedBy = i_SubmittedBy, "806 + " StatusId = i_StatusId, priority = i_priority, DateSubmitted = i_DateSubmitted, DateResolved = i_DateResolved, DeptId = i_DeptId "807 + " where issueid = i_issueid; "808 + " COMMIT; "809 + "END UPDATE_ISSUE;";810 genericDAO.stmtExecute(query); 811 query = ""812 + "create or replace PROCEDURE UPDATE_ISSUEUPDATE "813 + "( "814 + " i_issueUpdateId IN number, "815 + " i_issueId IN number, "816 + " i_SubmittedBy IN number, "817 + " i_UpdateDate IN date, "818 + " i_UpdateComment IN VARCHAR2 "819 + ") "820 + "IS "821 + "BEGIN "822 + " UPDATE ISSUEUPDATES SET issueId = i_issueId, SubmittedBy = i_SubmittedBy, UpdateDate = i_UpdateDate, UpdateComment = i_UpdateComment "823 + " where issueUpdateId = i_issueUpdateId; "824 + " COMMIT; "825 + "END UPDATE_ISSUEUPDATE;";826 genericDAO.stmtExecute(query); 827 query = ""828 + "create or replace PROCEDURE UPDATE_ROLE "829 + "( "830 + " i_roleId IN NUMBER, "831 + " i_Name IN VARCHAR2 "832 + ") "833 + "IS "834 + "BEGIN "835 + " UPDATE ROLES SET RoleName = i_Name where roleId = i_roleId; "836 + " COMMIT; "837 + "END UPDATE_ROLE;";838 genericDAO.stmtExecute(query);839 query = ""840 + "create or replace PROCEDURE UPDATE_STATUS "841 + "( "842 + " i_statusId IN NUMBER, "843 + " i_Name IN VARCHAR2 "844 + ") "845 + "IS "846 + "BEGIN "847 + " UPDATE STATUSS SET STATUS = i_Name where statusId = i_statusId; "848 + " COMMIT; "849 + "END UPDATE_STATUS;";850 genericDAO.stmtExecute(query);851 query = ""852 + "create or replace PROCEDURE UPDATE_USER "853 + "( "854 + " i_userid IN NUMBER, "855 + " i_deptid IN NUMBER, "856 + " i_username IN VARCHAR2, "857 + " i_password IN VARCHAR2, "858 + " i_email IN VARCHAR2 "859 + ") "860 + "IS "861 + "BEGIN "862 + " UPDATE USERS SET deptid = i_deptid, username = i_username, password = i_password, email = i_email where userid = i_userid; "863 + " COMMIT; "864 + "END UPDATE_USER;";865 genericDAO.stmtExecute(query);866 query = ""867 + "create or replace PROCEDURE UPDATE_USERROLE "868 + "( "869 + " i_userId IN NUMBER, "870 + " i_roleId IN NUMBER, "871 + " i_NewUserId IN NUMBER, "872 + " i_NewRoleId IN NUMBER "873 + ") "874 + "IS "875 + "BEGIN "876 + " UPDATE USERROLES SET userId = i_NewUserId, roleId = i_NewRoleId where userId = i_userId and roleId = i_roleId; "877 + " COMMIT; "878 + "END UPDATE_USERROLE;";879 genericDAO.stmtExecute(query);880 881 query = "commit";882 genericDAO.stmtExecute(query);883 }884 885 public void stubDBwithHeroes()886 {887 String query = ""888 + "INSERT INTO departments(NAME) VALUES( 'heroes' )";889 genericDAO.stmtExecute(query);890 query = ""891 + "INSERT INTO departments(NAME) VALUES( 'antiheroes' )";892 genericDAO.stmtExecute(query);893 query = ""894 + "INSERT INTO roles(ROLENAME) VALUES( 'basic' )";895 genericDAO.stmtExecute(query);896 query = ""897 + "INSERT INTO roles(ROLENAME) VALUES( 'deptadmin' )";898 genericDAO.stmtExecute(query);899 query = ""900 + "INSERT INTO roles(ROLENAME) VALUES( 'genadmin' )";901 genericDAO.stmtExecute(query);902 query = ""903 + "INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) VALUES( 0, 'Steve.Rogers', 'peggy', 'Steve.Rogers@marvel.com' ) ";904 genericDAO.stmtExecute(query);905 query = ""906 + "INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) VALUES( 0, 'Tony.Stark', 'pepper', 'Tony.Stark@marvel.com' ) ";907 genericDAO.stmtExecute(query);908 query = ""909 + "INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) VALUES( 0, 'Matt.Murdock', 'foggy', 'Matt.Murdock@marvel.com' ) ";910 genericDAO.stmtExecute(query);911 query = ""912 + "INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) VALUES( 0, 'Luke.Cage', 'jessica', 'Luke.Cage@marvel.com' ) ";913 genericDAO.stmtExecute(query);914 query = ""915 + "INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) VALUES( 0, 'Jessica.Jones', 'luke', 'Jessica.Jones@marvel.com' )";916 genericDAO.stmtExecute(query);917 query = ""918 + "INSERT INTO userroles VALUES( 0, 2 ) ";919 genericDAO.stmtExecute(query);920 query = ""921 + "INSERT INTO userroles VALUES( 1, 1 ) ";922 genericDAO.stmtExecute(query);923 query = ""924 + "INSERT INTO STATUSS(STATUS) VALUES( 'New' ) ";925 genericDAO.stmtExecute(query);926 query = ""927 + "INSERT INTO STATUSS(STATUS) VALUES( 'Work In Progress' ) ";928 genericDAO.stmtExecute(query);929 query = ""930 + "INSERT INTO STATUSS(STATUS) VALUES( 'Waiting on Resources' ) ";931 genericDAO.stmtExecute(query);932 query = ""933 + "INSERT INTO STATUSS(STATUS) VALUES( 'Resolved' ) ";934 genericDAO.stmtExecute(query);935 query = ""936 + "INSERT INTO STATUSS(STATUS) VALUES( 'Complete' )"; 937 genericDAO.stmtExecute(query);938 query = ""939 + "INSERT INTO ISSUES(TITLE, USERDESCRIPTION, SUBMITTEDBY, STATUSID, PRIORITY, DATESUBMITTED, DEPTID) "940 + "VALUES( 'Need Unobtainium', 'I do not have enough unobtainium', 2, 0, 1, to_date('19-09-2017 09:00:00', 'dd-mm-yyyy hh24:mi:ss'), 0 ) ";941 genericDAO.stmtExecute(query);942 query = ""943 +"UPDATE ISSUES SET ASSIGNEDTO = 1 WHERE ISSUEID = 0";944 genericDAO.stmtExecute(query);945 query = ""946 + "INSERT INTO ISSUES(TITLE, USERDESCRIPTION, SUBMITTEDBY, STATUSID, PRIORITY, DATESUBMITTED, DEPTID) "947 + "VALUES( 'Broke desk chair', 'My desk chair is broken', 3, 0, 1, to_date('19-09-2017 10:00:00', 'dd-mm-yyyy hh24:mi:ss'), 0 )";948 genericDAO.stmtExecute(query);949 query = ""950 + "INSERT INTO ISSUEUPDATES(ISSUEID, SUBMITTEDBY, UPDATEDATE, UPDATECOMMENT) VALUES( 0, 2, to_date('19-09-2017 09:10:00', 'dd-mm-yyyy hh24:mi:ss'), 'Unable to obtain unobtainium' ) ";951 genericDAO.stmtExecute(query);952 query = ""953 + "INSERT INTO ISSUEUPDATES(ISSUEID, SUBMITTEDBY, UPDATEDATE, UPDATECOMMENT) VALUES( 0, 2, to_date('19-09-2017 09:20:00', 'dd-mm-yyyy hh24:mi:ss'), 'Unobtainium may not be real' ) ";954 genericDAO.stmtExecute(query);955 query = ""956 + "INSERT INTO ISSUEUPDATES(ISSUEID, SUBMITTEDBY, UPDATEDATE, UPDATECOMMENT) VALUES( 1, 3, to_date('19-09-2017 10:30:00', 'dd-mm-yyyy hh24:mi:ss'), 'I am too awesome' )";957 genericDAO.stmtExecute(query);958 959 query = "commit";960 genericDAO.stmtExecute(query);961 }962 963 public void stubDBwithDemo()964 {965 String query = ""966 + "INSERT INTO departments(NAME) VALUES( 'IT Dept' )";967 genericDAO.stmtExecute(query);968 query = ""969 + "INSERT INTO departments(NAME) VALUES( 'Web Support' )";970 genericDAO.stmtExecute(query);971 query = ""972 + "INSERT INTO departments(NAME) VALUES( 'Legal' )";973 genericDAO.stmtExecute(query);974 query = ""975 + "INSERT INTO roles(ROLENAME) VALUES( 'Basic' )";976 genericDAO.stmtExecute(query);977 query = ""978 + "INSERT INTO roles(ROLENAME) VALUES( 'Dept Admin' )";979 genericDAO.stmtExecute(query);980 query = ""981 + "INSERT INTO roles(ROLENAME) VALUES( 'General Admin' )";982 genericDAO.stmtExecute(query);983 984 query = ""985 + "INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) VALUES( 0, 'Steve.Rogers', 'peggy', 'Steve.Rogers@marvel.com' ) ";986 genericDAO.stmtExecute(query);987 query = ""988 + "INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) VALUES( 0, 'Tony.Stark', 'pepper', 'Tony.Stark@marvel.com' ) ";989 genericDAO.stmtExecute(query);990 query = ""991 + "INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) VALUES( 0, 'Hank.Pym', 'janet', 'Hank.Pym@marvel.com' ) ";992 genericDAO.stmtExecute(query);993 query = ""994 + "INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) VALUES( 1, 'Peter.Parker', 'gwen', 'Peter.Parker@marvel.com' ) ";995 genericDAO.stmtExecute(query);996 query = ""997 + "INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) VALUES( 1, 'Jessica.Drew', 'tony', 'Jessica.Drew@marvel.com' )";998 genericDAO.stmtExecute(query);999 query = ""1000 + "INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) VALUES( 2, 'Matt.Murdock', 'foggy', 'Matt.Murdock@marvel.com' ) ";1001 genericDAO.stmtExecute(query);1002 query = ""1003 + "INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) VALUES( 2, 'Jennifer.Walters', 'bruce', 'Jennifer.Walters@marvel.com' ) ";1004 genericDAO.stmtExecute(query);1005 1006 query = ""1007 + "INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) VALUES( 0, 'Bruce.Banner', 'betty', 'Bruce.Banner@marvel.com' ) ";1008 genericDAO.stmtExecute(query);1009 query = ""1010 + "INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) VALUES( 1, 'Cindy.Moon', 'peter', 'Cindy.Moon@marvel.com' ) ";1011 genericDAO.stmtExecute(query);1012 query = ""1013 + "INSERT INTO USERS(DEPTID, USERNAME, PASSWORD, EMAIL) VALUES( 2, 'Patrick.Mulligan', 'toxin', 'Patrick.Mulligan@marvel.com' ) ";1014 genericDAO.stmtExecute(query);1015 1016 1017 query = ""1018 + "INSERT INTO userroles VALUES( 0, 2 ) ";1019 genericDAO.stmtExecute(query);1020 query = ""1021 + "INSERT INTO userroles VALUES( 1, 1 ) ";1022 genericDAO.stmtExecute(query);1023 query = ""1024 + "INSERT INTO userroles VALUES( 2, 1 ) ";1025 genericDAO.stmtExecute(query);1026 query = ""1027 + "INSERT INTO userroles VALUES( 3, 1 ) ";1028 genericDAO.stmtExecute(query);1029 query = ""1030 + "INSERT INTO userroles VALUES( 4, 1 ) ";1031 genericDAO.stmtExecute(query);1032 query = ""1033 + "INSERT INTO userroles VALUES( 5, 1 ) ";1034 genericDAO.stmtExecute(query);1035 query = ""1036 + "INSERT INTO userroles VALUES( 6, 1 ) ";1037 genericDAO.stmtExecute(query);1038 1039 query = ""1040 + "INSERT INTO STATUSS(STATUS) VALUES( 'New' ) ";1041 genericDAO.stmtExecute(query);1042 query = ""1043 + "INSERT INTO STATUSS(STATUS) VALUES( 'Work In Progress' ) ";1044 genericDAO.stmtExecute(query);1045 query = ""1046 + "INSERT INTO STATUSS(STATUS) VALUES( 'Waiting on Resources' ) ";1047 genericDAO.stmtExecute(query);1048 query = ""1049 + "INSERT INTO STATUSS(STATUS) VALUES( 'Resolved' ) ";1050 genericDAO.stmtExecute(query);1051 query = ""1052 + "INSERT INTO STATUSS(STATUS) VALUES( 'Complete' )"; 1053 genericDAO.stmtExecute(query);1054 1055 1056 query = ""1057 + "INSERT INTO ISSUES(TITLE, USERDESCRIPTION, SUBMITTEDBY, STATUSID, PRIORITY, DATESUBMITTED, DEPTID) "1058 + "VALUES( 'No Internet', 'I can not search the internet for....solutions.', 7, 0, 1, to_date('19-09-2017 09:00:00', 'dd-mm-yyyy hh24:mi:ss'), 0 ) ";1059 genericDAO.stmtExecute(query);1060 query = ""1061 +"UPDATE ISSUES SET ASSIGNEDTO = 1 WHERE ISSUEID = 0";1062 genericDAO.stmtExecute(query);1063 1064 query = ""1065 + "INSERT INTO ISSUES(TITLE, USERDESCRIPTION, SUBMITTEDBY, STATUSID, PRIORITY, DATESUBMITTED, DEPTID) "1066 + "VALUES( 'Link Broken', 'When clicking homepage link I am taken to an adult website.', 8, 0, 2, to_date('10-09-2017 20:00:00', 'dd-mm-yyyy hh24:mi:ss'), 1 )";1067 genericDAO.stmtExecute(query);1068 query = ""1069 +"UPDATE ISSUES SET ASSIGNEDTO = 3 WHERE ISSUEID = 1";1070 genericDAO.stmtExecute(query);1071 1072 query = ""1073 + "INSERT INTO ISSUES(TITLE, USERDESCRIPTION, SUBMITTEDBY, STATUSID, PRIORITY, DATESUBMITTED, DEPTID) "1074 + "VALUES( 'No Paycheck', 'I have not been paid for 1 month now.', 9, 0, 3, to_date('29-08-2017 10:30:00', 'dd-mm-yyyy hh24:mi:ss'), 2 )";1075 genericDAO.stmtExecute(query);1076 query = ""1077 +"UPDATE ISSUES SET ASSIGNEDTO = 5 WHERE ISSUEID = 2";1078 genericDAO.stmtExecute(query);1079 1080 1081 query = ""1082 + "INSERT INTO ISSUEUPDATES(ISSUEID, SUBMITTEDBY, UPDATEDATE, UPDATECOMMENT) VALUES( 0, 1, to_date('11-09-2017 20:00:00', 'dd-mm-yyyy hh24:mi:ss'), 'Link to adult website is still present.' ) ";1083 genericDAO.stmtExecute(query);1084 query = ""1085 + "INSERT INTO ISSUEUPDATES(ISSUEID, SUBMITTEDBY, UPDATEDATE, UPDATECOMMENT) VALUES( 0, 2, to_date('07-09-2017 11:20:00', 'dd-mm-yyyy hh24:mi:ss'), 'I STILL have not received a paycheck.' ) ";1086 genericDAO.stmtExecute(query);1087 query = ""1088 + "INSERT INTO ISSUEUPDATES(ISSUEID, SUBMITTEDBY, UPDATEDATE, UPDATECOMMENT) VALUES( 1, 2, to_date('14-09-2017 12:10:00', 'dd-mm-yyyy hh24:mi:ss'), 'Do I still work here?' )";1089 genericDAO.stmtExecute(query);1090 1091 query = "commit";1092 genericDAO.stmtExecute(query);1093 }1094 1095 public void tearDownDB()1096 {1097//Tables1098 String query = "";1099 query += "drop table issueupdates";1100 genericDAO.stmtExecute(query);1101 query = "";1102 query += "drop sequence \"issueupdates_SEQ\"";1103 genericDAO.stmtExecute(query);1104 query = "";1105 query += "drop table issues";1106 genericDAO.stmtExecute(query);1107 query = "";1108 query += "drop sequence \"issues_SEQ\"";1109 genericDAO.stmtExecute(query);1110 query = "";1111 query += "drop table statuss";1112 genericDAO.stmtExecute(query);1113 query = "";1114 query += "drop sequence \"statuss_SEQ\"";1115 genericDAO.stmtExecute(query);1116 query = "";1117 query += "drop table userroles";1118 genericDAO.stmtExecute(query);1119 query = "";1120 query += "drop table users";1121 genericDAO.stmtExecute(query);1122 query = "";1123 query += "drop sequence \"USERS_SEQ\"";1124 genericDAO.stmtExecute(query);1125 query = "";1126 query += "drop table departments";1127 genericDAO.stmtExecute(query);1128 query = "";1129 query += "drop sequence \"departments_SEQ\"";1130 genericDAO.stmtExecute(query);1131 query = "";1132 query += "drop table roles";1133 genericDAO.stmtExecute(query);1134 query = "";1135 query += "drop sequence \"roles_SEQ\"";1136 genericDAO.stmtExecute(query);1137//Stored Procedures1138 query = "";1139 query += "drop PROCEDURE \"ADD_DEPARTMENT\"";1140 genericDAO.stmtExecute(query);1141 query = "";1142 query += "drop PROCEDURE \"ADD_ISSUE\"";1143 genericDAO.stmtExecute(query);1144 query = "";1145 query += "drop PROCEDURE \"ADD_ISSUEUPDATE\"";1146 genericDAO.stmtExecute(query);1147 query = "";1148 query += "drop PROCEDURE \"ADD_ROLE\"";1149 genericDAO.stmtExecute(query);1150 query = "";1151 query += "drop PROCEDURE \"ADD_STATUS\"";1152 genericDAO.stmtExecute(query);1153 query = "";1154 query += "drop PROCEDURE \"ADD_USER\"";1155 genericDAO.stmtExecute(query);1156 query = "";1157 query += "drop PROCEDURE \"ADD_USERROLE\"";1158 genericDAO.stmtExecute(query);1159 query = "";1160 query += "drop PROCEDURE \"GET_DEPARTMENT_BY_ID\"";1161 genericDAO.stmtExecute(query);1162 query = "";1163 query += "drop PROCEDURE \"GET_DEPARTMENTS\"";1164 genericDAO.stmtExecute(query);1165 query = "";1166 query += "drop PROCEDURE \"GET_ISSUE_BY_ID\"";1167 genericDAO.stmtExecute(query);1168 query = "";1169 query += "drop PROCEDURE \"GET_ISSUE_BY_TITLE\"";1170 genericDAO.stmtExecute(query);1171 query = "";1172 query += "drop PROCEDURE \"GET_ISSUES_BY_ASSIGNEDTO\"";1173 genericDAO.stmtExecute(query);1174 query = "";1175 query += "drop PROCEDURE \"GET_ISSUES_BY_SUBMITTEDBY\"";1176 genericDAO.stmtExecute(query);1177 query = "";1178 query += "drop PROCEDURE \"GET_ISSUES_UNASSIGNED\"";1179 genericDAO.stmtExecute(query);1180 query = "";1181 query += "drop PROCEDURE \"GET_ISSUES\"";1182 genericDAO.stmtExecute(query);1183 query = "";1184 query += "drop PROCEDURE \"GET_ISSUEUPDATE_BY_ID\"";1185 genericDAO.stmtExecute(query);1186 query = "";1187 query += "drop PROCEDURE \"GET_ISSUEUPDATES_BY_ISSUEID\"";1188 genericDAO.stmtExecute(query);1189 query = "";1190 query += "drop PROCEDURE \"GET_ISSUEUPDATES\"";1191 genericDAO.stmtExecute(query);1192 query = "";1193 query += "drop PROCEDURE \"GET_ROLE_BY_ID\"";1194 genericDAO.stmtExecute(query);1195 query = "";1196 query += "drop PROCEDURE \"GET_ROLES_BY_USERID\"";1197 genericDAO.stmtExecute(query);1198 query = "";1199 query += "drop PROCEDURE \"GET_ROLES\"";1200 genericDAO.stmtExecute(query);1201 query = "";1202 query += "drop PROCEDURE \"GET_STATUS_BY_ID\"";1203 genericDAO.stmtExecute(query);1204 query = "";1205 query += "drop PROCEDURE \"GET_STATUSS\"";1206 genericDAO.stmtExecute(query);1207 query = "";1208 query += "drop PROCEDURE \"GET_USER_BY_ID\"";1209 genericDAO.stmtExecute(query);1210 query = "";1211 query += "drop PROCEDURE \"GET_USER_BY_USERNAME\"";1212 genericDAO.stmtExecute(query);1213 query = "";1214 query += "drop PROCEDURE \"GET_USERROLES\"";1215 genericDAO.stmtExecute(query);1216 query = "";1217 query += "drop PROCEDURE \"GET_USERS\"";1218 genericDAO.stmtExecute(query);1219 query = "";1220 query += "drop PROCEDURE \"REMOVE_DEPARTMENT\"";1221 genericDAO.stmtExecute(query);1222 query = "";1223 query += "drop PROCEDURE \"REMOVE_ISSUE\"";1224 genericDAO.stmtExecute(query);1225 query = "";1226 query += "drop PROCEDURE \"REMOVE_ISSUEUPDATE_BY_ISSUEID\"";1227 genericDAO.stmtExecute(query);1228 query = "";1229 query += "drop PROCEDURE \"REMOVE_ISSUEUPDATE\"";1230 genericDAO.stmtExecute(query);1231 query = "";1232 query += "drop PROCEDURE \"REMOVE_ROLE\"";1233 genericDAO.stmtExecute(query);1234 query = "";1235 query += "drop PROCEDURE \"REMOVE_STATUS\"";1236 genericDAO.stmtExecute(query);1237 query = "";1238 query += "drop PROCEDURE \"REMOVE_USER\"";1239 genericDAO.stmtExecute(query);1240 query = "";1241 query += "drop PROCEDURE \"REMOVE_USERROLE\"";1242 genericDAO.stmtExecute(query);1243 query = "";1244 query += "drop PROCEDURE \"UPDATE_DEPARTMENT\"";1245 genericDAO.stmtExecute(query);1246 query = "";1247 query += "drop PROCEDURE \"UPDATE_ISSUE\"";1248 genericDAO.stmtExecute(query);1249 query = "";1250 query += "drop PROCEDURE \"UPDATE_ISSUEUPDATE\"";1251 genericDAO.stmtExecute(query);1252 query = "";1253 query += "drop PROCEDURE \"UPDATE_ROLE\"";1254 genericDAO.stmtExecute(query);1255 query = "";1256 query += "drop PROCEDURE \"UPDATE_STATUS\"";1257 genericDAO.stmtExecute(query);1258 query = "";1259 query += "drop PROCEDURE \"UPDATE_USER\"";1260 genericDAO.stmtExecute(query);1261 query = "";1262 query += "drop PROCEDURE \"UPDATE_USERROLE\"";1263 genericDAO.stmtExecute(query);1264 1265 query = "commit";1266 genericDAO.stmtExecute(query);1267 }1268 1269}...

Full Screen

Full Screen

UtilMisc.java

Source:UtilMisc.java Github

copy

Full Screen

...462 if (par1World.getBlock(l, i1, j1).getMaterial() == Material.water)463 return true;464 return false;465 }466 public static void deleteObsidian(World world, int par2, int par3, int par4)467 {468 for (int l = par2 - 16; l <= par2 + 16; ++l)469 for (int i1 = par3 - 16; i1 <= par3 + 16; ++i1)470 for (int j1 = par4 - 16; j1 <= par4 + 16; ++j1)471 if (world.getBlock(l, i1, j1) == Blocks.obsidian)472 {473 world.setBlock(l, i1, j1, Blocks.air);474 }475 }476 public static boolean trueDaytime(long time)477 {478 if(time > 0 && time < 12000)479 {480 return true;...

Full Screen

Full Screen

PatientsTableAdapter.java

Source:PatientsTableAdapter.java Github

copy

Full Screen

...134 RegistrationFragment llf = RegistrationFragment.newInstance(patientList.get(position), patientList.get(position).getPrincipal(), String.valueOf(patientList.get(position).getId()) , true);135 ft.addToBackStack("main");136 ft.replace(R.id.currentFragment, llf);137 ft.commit();138 } else if (id == R.id.patient_delete_action) {139 Toast.makeText(mContext, "Aun no implementado", Toast.LENGTH_LONG).show();140 }141 return false;142 }143 });144 menu.show();145 return true;146 }147 });148 }149 return cell;150 }151}...

Full Screen

Full Screen

delete

Using AI Code Generation

copy

Full Screen

1u.delete('foo')2u.delete('bar')3 def delete(key)

Full Screen

Full Screen

delete

Using AI Code Generation

copy

Full Screen

1my_unobtainium.add('Iron', 0.1)2my_unobtainium.add('Gold', 0.2)3my_unobtainium.add('Platinum', 0.3)4my_unobtainium.add('Silver', 0.4)5my_unobtainium.delete('Silver')6hash.delete_if {| key, value | block }7my_unobtainium.add('Iron', 0.1)8my_unobtainium.add('Gold', 0.2)9my_unobtainium.add('Platinum', 0.3)10my_unobtainium.add('Silver', 0.4)11my_unobtainium.delete_if {|key, value| value > 0.2}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Unobtainium_ruby automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful