id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
4421de0c-8c06-4300-ae1a-4828bdfd9efa | public String getSmsTelno() {
return smsTelno;
} |
fbed71e3-c098-411f-ac33-d1a227752593 | public void setSmsTelno(String smsTelno) {
this.smsTelno = smsTelno;
} |
0af98568-0857-472a-a11f-f528fe6ed61e | public String getSmsBody() {
return smsBody;
} |
29f16986-22ae-4a75-875e-152f648afee8 | public void setSmsBody(String smsBody) {
this.smsBody = smsBody;
} |
a704210a-05bc-449d-b0ad-4cb5d7dc9c15 | public String getSmsAux() {
return smsAux;
} |
4e7c9f3a-6610-45b3-9fa3-19ac4a47dbd4 | public void setSmsAux(String smsAux) {
this.smsAux = smsAux;
} |
74589573-986c-42ef-b0f8-792de98d6d64 | public Date getSmsDatetime() {
return smsDatetime;
} |
7d079e32-4db4-4beb-801c-3c5e7c9ae393 | public void setSmsDatetime(Date smsDatetime) {
this.smsDatetime = smsDatetime;
} |
07084de3-573f-4313-916f-b01f4d20be72 | public Date getCreatedDatetime() {
return createdDatetime;
} |
1c24fb69-6338-4548-bae7-a4bf9583284d | public void setCreatedDatetime(Date createdDatetime) {
this.createdDatetime = createdDatetime;
} |
bdb4f27f-9997-4aef-898d-cff37854c3f4 | @PrePersist
public void initTimestamp() {
smsDatetime = new Date();
createdDatetime = new Date();
} |
e9fccc70-60cd-4954-b527-e8ddfe709412 | public void onMessage(Message message) {
logger.log(Level.INFO, ">>> Help app to register in TDS ...");
} |
4f01819d-c99b-42e6-b555-0878f6abd670 | @SuppressWarnings("unchecked")
public void onMessage(Message message) {
try {
// 获得消息接收到的时间
recieveDatetime = service.findCurrentTimestamp();
TextMessage msg = (TextMessage) message;
msgList = new ObjectMapper().readValue(msg.getText(), List.class);
logger.log(Level.INFO, ">>> Message is arrived!")... |
f4cbc790-2c37-4039-a941-6d2f88c3341a | @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void registerSuccMsg(Map<String, String> record, int type) {
// ***@LiWei***以下为解决超过4000字符,保存异常添加代码***//
// 如果消息内容过长,截取一部分保存
String body = record.get("body");
if (body == null) {
body = "";
} else {
try {
byte[] bytes = body.getByte... |
e3d9765b-e0f2-4465-88f3-4109bc0f9f3c | @TransactionAttribute(TransactionAttributeType.REQUIRED)
public void registerMailLog(Map<String, String> record) {
UnsEmailLog log = new UnsEmailLog();
log.setSysId(record.get("sys"));
log.setEmailAddr(record.get("email"));
log.setEmailCc(record.get("emailcc"));
log.setEmailBcc(record.get("emailbcc"));
log... |
a54bc341-6581-498d-8310-166183fc0dee | @TransactionAttribute(TransactionAttributeType.REQUIRED)
public void registerSmsLog(Map<String, String> record) {
UnsSmsLog log = new UnsSmsLog();
log.setSysId(record.get("sys"));
log.setSmsTelno(record.get("telno"));
log.setSmsBody(record.get("body"));
log.setSmsAux(record.get("aux"));
log.setSmsDatetime(... |
6ecda730-0ea7-46ab-aa9e-83ba66b463cf | @TransactionAttribute(TransactionAttributeType.REQUIRED)
public void registerMsgLog(Map<String, String> record) {
UnsMsgLog log = new UnsMsgLog();
log.setSysId(record.get("sys"));
log.setMsgType(Integer.valueOf(record.get("type")));
log.setMsgEmail(record.get("email"));
log.setMsgEmailcc(record.get("emailcc"... |
c636d7b0-89ca-4bb2-959f-25b3d68794eb | @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void registerFailedMsg(Map<String, String> record, int failureType, Date updatedDatetime) {
// ***@LiWei***以下为解决超过4000字符,保存异常添加代码***//
// 如果消息内容过长,截取一部分保存
String body = record.get("body");
if (body == null) {
body = "";
} else {
try {
... |
180ca3b4-3cd9-4917-9cca-5580a6c8f427 | @GET
@Produces("text/plain;charset=UTF-8")
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public String getRejectedMessages(@PathParam("sys") String sys, @QueryParam("key") String key, @QueryParam("ts") @DefaultValue("0") String ts, @QueryParam("max") @DefaultValue("200") String max) {
int defaultSi... |
88a84a0b-36c3-4334-93d8-dac0eb97272e | @POST
@Produces(MediaType.TEXT_PLAIN)
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public String clearRejectedMessages(@PathParam("sys") String sys, @QueryParam("key") String key, @QueryParam("ts") String ts) {
// 如果未指明sysId,返回{}
if (UnsUtil.isNullOrEmpty(sys))
return "{}";
// 如果未指定密钥或系统密... |
bc6a2f7b-9721-4bdf-82c6-188da228ecd6 | public String getUsers(String keyword) {
queryMap = new HashMap<String, String>();
queryMap.put("keyword", keyword);
return new UnsUtil().getResource(UnsConsts.RES_USER, UnsConsts.MARK_EMPTY, queryMap);
} |
5f5066b4-c57b-4bd4-b8a9-b8d6653fc650 | public String getSys(String id) {
queryMap = new HashMap<String, String>();
return new UnsUtil().getResource(UnsConsts.RES_SYS, id, queryMap);
} |
6e4513e5-25d2-4e54-8627-e2efdafc44fc | @SuppressWarnings("unchecked")
public Map<String, String> getRecievers(String[] emails, String[] telnos, String[] pernrs) {
Map<String, String> revieverMap = new HashMap<String, String>();
try {
for (String email : emails) {
if (email == null || "".equals(email)) {
break;
}
List<Map<String, St... |
452b755d-c02c-4052-98a5-40a3ea071c5a | @SuppressWarnings("rawtypes")
public List getDurationMsgCount(String queryName, Date durationTimeAgo, Date recieveDatetime, String sysId, String msgAddr) {
return em.createNamedQuery(queryName).setParameter("durationDatetime", durationTimeAgo).setParameter("currentDatetime", recieveDatetime).setParameter("sysId", sy... |
2081762a-ca38-4632-b8e0-545e1eac9a4a | @SuppressWarnings("rawtypes")
public List getDurationMsgCount(String queryName, Date durationTimeAgo, Date recieveDatetime, String sysId) {
return em.createNamedQuery(queryName).setParameter("durationDatetime", durationTimeAgo).setParameter("currentDatetime", recieveDatetime).setParameter("sysId", sysId).getResultLi... |
66b19839-3a39-451f-9c80-d4904c20ca78 | @SuppressWarnings("unchecked")
public List<UnsFailedMsg> getUnsFailedMsgBySysId(String sysId) {
return em.createNamedQuery("UnsFailedMsg.findBySysId").setParameter("sysId", sysId).getResultList();
} |
bb3eea5a-4ae9-4c57-87cd-0824b4b90383 | public Long getUnsFailedMsgVersionBySysId(String sysId) {
return em.createNamedQuery("UnsFailedMsg.findVersionBySysId", Timestamp.class).setParameter("sysId", sysId).getSingleResult().getTime();
} |
cf1dc05e-a7ba-4938-9864-de5ff408d70e | @SuppressWarnings("unchecked")
public List<UnsFailedMsg> getUnsFailedMsgByVersion(String ts, String sysId) {
return em.createNamedQuery("UnsFailedMsg.findByVersion").setParameter("ts", new Date(Long.parseLong(ts) + UnsConsts.ONE_SECOND)).setParameter("sysId", sysId).getResultList();
} |
10830c2e-eac1-455a-b840-1887369ffe32 | @SuppressWarnings("unchecked")
public List<UnsFailedMsg> getUnsFailedMsgByVersion2(String ts, String sysId) {
return em.createNamedQuery("UnsFailedMsg.findByVersion2").setParameter("ts", new Date(Long.parseLong(ts))).setParameter("sysId", sysId).getResultList();
} |
ee7900a0-9a23-47a2-9cab-c292f1cc5cc7 | public List<UnsFailedMsg> getUnsFailedMsgLast(int size, String ts, String sysId) {
String jpql = "SELECT e FROM UnsFailedMsg e WHERE e.updatedDatetime >= :ts AND e.sysId = :sysId order by e.msgDatetime DESC";
Query query = em.createQuery(jpql).setParameter("ts", new Date(Long.parseLong(ts))).setParameter("sysId", s... |
b39c5d96-e610-4db5-9f62-fb47052c2746 | @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void updateUnsFailedMsg(List<UnsFailedMsg> failedMsgs) {
for (UnsFailedMsg failedMsg : failedMsgs) {
failedMsg.setDefunctInd("Y");
failedMsg.setUpdatedDatetime(new Date(System.currentTimeMillis()));
em.merge(failedMsg);
}
} |
bde922d8-187d-4055-9376-492b9b04c344 | @SuppressWarnings("unchecked")
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public int deleteUnsFailedMsg() {
int count = 0;
List<UnsFailedMsg> failedMsgs = em.createNamedQuery("UnsFailedMsg.findByDefunctInd").setParameter("defunctInd", "Y").getResultList();
for (UnsFailedMsg failedMsg : failedMsgs)... |
c18356dc-74f2-44bd-8516-7ea2f24279f1 | @SuppressWarnings("unchecked")
public Map<String, String> getSmsSendInfo(Map<String, String> record) {
Map<String, String> smsSendInfo = new HashMap<String, String>();
try {
// 获得接收人电话号码
String[] emails = record.get("email").split("[|]");
String[] telnos = record.get("telno").split("[|]");
String[] pe... |
5936e57a-b957-45fd-bf57-07445eb74712 | @SuppressWarnings("unchecked")
public String getSwitchOnFlg(String sys) {
String sysRes = getSys(sys);
List<Map<String, String>> sysInfo;
try {
sysInfo = new ObjectMapper().readValue("[" + sysRes + "]", List.class);
return sysInfo.get(0).get("SMSON");
} catch (JsonParseException e) {
e.printStackTrace... |
cea991b6-3e13-428f-8aea-4bd4cab529eb | public Timestamp findCurrentTimestamp() {
Query query = em.createNativeQuery("SELECT current timestamp FROM sysibm.sysdummy1", Timestamp.class);
return (Timestamp) query.getSingleResult();
} |
de7a87b3-ce84-40b1-b13b-b0d85041cffa | public int getUnsFailedMsgCountBySysId(String sysId) {
if (sysId == null) {
return 0;
}
Query query = em.createQuery("SELECT COUNT(e) FROM UnsFailedMsg e WHERE e.sysId = :sysId");
query.setParameter("sysId", sysId);
String strCount = query.getSingleResult().toString();
Long lCount = 0L;
try {
lCount... |
93dc08d2-f16e-49e6-bb6f-f4fa0a5a2065 | public boolean isValidMsgFommat(Map<String, String> record) {
int typeInt = 0;
if (UnsUtil.isNullOrEmpty(record.get("type"))) {
logger.log(Level.INFO, "Type is null or empty");
return false;
}
try {
typeInt = Integer.valueOf(record.get("type"));
} catch (NumberFormatException e) {
logger.log... |
a7ab9deb-8450-4041-8cf3-650cb65116bc | public boolean isValidPernr(Map<String, String> record) {
// pernr is empty
if (UnsConsts.MARK_EMPTY.equals(record.get("pernr"))) {
return true;
}
if (!UnsUtil.isNullOrEmpty(record.get("pernr"))&& isPernr(record.get("pernr"))) {
return haveSuchUser(record.get("pernr"));
}
return false;
} |
3b40ddb9-8168-4523-bf94-c5f416057112 | @SuppressWarnings("unchecked")
public boolean isValidSysKeyPair(String sys, String key) {
try {
String sysRes = service.getSys(sys);
List<Map<String, String>> sysInfo = new ObjectMapper().readValue("["+sysRes+"]", List.class);
if (!key.equals((sysInfo.get(0)).get("SYSKEY"))) { return false; }
} catch (Jso... |
b741e043-5fa1-4dcc-bb0c-d68abbb9203b | public int isValidMsgInfo(Map<String, String> record) {
int result = 1;
// check the message type
int type = Integer.valueOf(record.get("type"));
boolean isMailActive = (Integer.valueOf(Integer.toHexString(type)) & Integer
.valueOf(Integer.toHexString(1))) > 0 ? true : false;
boolean isSmsActive = (Int... |
43757000-a37c-4f4d-ab01-b918c96428ab | public boolean isOverAllocationSize(Map<String, String> record, Date recieveDatetime, int msgTarget) {
String sysId = record.get("sys");
Date one_minute_ago = new Date(recieveDatetime.getTime() - UnsConsts.ONE_MINUTE);
Date one_hour_ago = new Date(recieveDatetime.getTime() - UnsConsts.ONE_HOUR);
long to_day ... |
c2772847-8842-44c1-9883-f88116ada6b4 | private boolean isOverAllocationSizeChecker(String queryName,Date durationTimeAgo,
Date recieveDatetime, String sysId, String msgAddr, int maxsize) {
List msgs = service.getDurationMsgCount(queryName, durationTimeAgo, recieveDatetime, sysId, msgAddr);
if (msgs.size() > maxsize - 1) {
return true;
}
return... |
144e2c16-945d-4661-a23a-81757b74f960 | private boolean isOverTotalSizeChecker(Map<String, String> record, Date durationTimeAgo,
Date recieveDatetime) {
List mails = service.getDurationMsgCount(
"UnsEmailLog.findByDurationTime2", durationTimeAgo,
recieveDatetime, record.get("sys"));
List smss = service.getDurationMsgCount(
"UnsSmsLog.findB... |
1a597fc7-811e-434e-9ad9-cee275987dcb | private boolean isEmail(String mailAddr) {
String regex = "^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$";
Pattern p = Pattern.compile(regex);
if (mailAddr.contains("|")) {
String emails[] = mailAddr.split("[|]");
for (String email : emails) {
Matcher m ... |
7a4e795e-943a-431f-93ce-a49ca8306c99 | public boolean isTelno(String telno) {
String regex = "^((13[0-9])|(14[0-9])|(15[^4,\\D])|(18[^4,\\D]))\\d{8}$";
Pattern p = Pattern.compile(regex);
if (telno.contains("|")) {
String telnos[] = telno.split("[|]");
for (String tel : telnos) {
Matcher m = p.matcher(tel);
if (!m.matches()) {
logge... |
900b679f-5774-4b6b-aa1c-d056475edd0e | public boolean isSensitive(Map<String, String> record) {
boolean sensitiveFlg = false;
String[] emails = record.get("email").split("[|]");
String[] emailccs = null;
String[] emailbccs = null;
if (record.get("emailcc") != null) {
emailccs = record.get("emailcc").split("[|]");
}
if (record.get("ema... |
92f2f447-a4d1-4c45-b08c-92652230dcbc | private boolean checkSensitive(String mail) {
boolean isSensitive = false;
String suffix = mail.split("[@]")[1];
if (!suffix.equals("wilmar-intl.com")) {
isSensitive = true;
}
return isSensitive;
} |
8176f55d-1aac-4bf4-868f-af1134857903 | private boolean isPernr(String pernr) {
//String regex = "";
return true;
} |
aa2533ed-12dd-48c6-ad5f-3c76bfab903e | @SuppressWarnings("unchecked")
private boolean haveSuchUser(String pernr) {
List<Map<String, String>> userList = new ArrayList<Map<String,String>>();
try {
if (pernr.contains("|")) {
String pernrs[] = pernr.split("[|]");
for (String p : pernrs) {
userList = new ObjectMapper().readValue(service.getU... |
38f11e12-c038-40d0-b02b-c7d14fcc58bf | private Set<String> getProps() {
props = new HashSet<String>();
props.add("sys");
props.add("key");
props.add("type");
props.add("email");
props.add("telno");
props.add("pernr");
props.add("subject");
props.add("body");
props.add("aux");
return props;
} |
b12e0f8d-474b-41b7-b9e5-76e9b68b0508 | public String getResource(String type, String subpath, Map<String, String> queryMap) {
String resource = null;
StringBuffer resources = new StringBuffer();
// type:资源根; subpath:@PathParam; queryMap:@QueryParam
URL u = urlBulider(type, subpath, queryMap);
//make connection
HttpURLConnection urlc = n... |
a12e2dc5-4bb8-42dd-8e4f-a43f2012c492 | public URL urlBulider(String path, String subpath, Map<String, String> queryMap) {
// /users/subpath/?query1=q1&query2=q2
StringBuffer sbf = new StringBuffer();
sbf.append(UnsConsts.MARK_SLASH).append(path);
sbf.append(UnsConsts.MARK_SLASH).append(subpath);
sbf.append(UnsConsts.MARK_QUE);
try {
for (S... |
655baf96-27d1-4c3d-8bb1-97e6ab149814 | public static boolean isNullOrEmpty(String str) {
if (str == null) {
return true;
} else if (UnsConsts.MARK_EMPTY.equals(str) || (str.trim()).length() == 0) {
return true;
}
return false;
} |
39b21121-895f-4678-8407-da0300a0236a | public int send(Map<String, String> record) {
String[] emailccs = null;
String[] emailbccs = null;
String[] replyTos = null;
try {
HtmlEmail email = new HtmlEmail();
email.setHostName(DO_NOY_REPLY_SERVER);
email.setAuthentication(DO_NOT_REPLY_USR, DO_NOT_REPLY_PSW);
String[] email... |
e9ef9994-8d6e-477d-ae26-8a8f574850db | public void sendMessageOne(String sn, String orgaddr, String telno,
String content) throws MalformedURLException, IOException {
HttpURLConnection connection = (HttpURLConnection) new URL(
UnsConsts.HTTPHOST).openConnection();
connection.setReadTimeout(30000);
connection.setConnectTimeout(30000);
c... |
ce712a99-e72c-42b9-96e5-23fee7a6def7 | public int send(Map<String, String> record) {
String[] emails = record.get("email").split("[|]");
String[] telnos = record.get("telno").split("[|]");
String[] pernrs = record.get("pernr").split("[|]");
// 获得并设置接收人
Map<String, String> recieversMap = service.getRecievers(emails, telnos, pernrs);
telMap ... |
fc46bac4-de8b-4082-b61b-279df4bc385b | public ProjectsMenu(Logger LOGGER, Connection connection)
{
this.userInput = new Scanner(System.in);
this.LOGGER = LOGGER;
this.connection = connection;
} |
46725c4e-5131-4e9e-b153-03353bc74d8d | public void projectsMenuView()
{
ResultSet rs = null;
try
{
Statement statement = connection.createStatement();
rs = statement.executeQuery("SELECT * FROM projects ORDER BY id ASC");
}
catch (SQLException sqe)
{
LOGGER.log(Level.SEV... |
906d289b-644c-4bd4-9168-13be27673189 | public CommitsMenu(Logger LOGGER, Connection connection)
{
this.userInput = new Scanner(System.in);
this.LOGGER = LOGGER;
this.connection = connection;
} |
d7d7f72c-21d4-41f0-9888-a8bd1e305adb | public void commitsMenu()
{
String input;
boolean wantToQuit = false;
while (!wantToQuit)
{
System.out.println("This is the commits menu.");
System.out.println("1. CHECKOUT the repo.");
System.out.println("2. BACK to menu menu");
... |
d484af6d-5280-4fb4-be4b-973f7c679b26 | public void commitsMenuView(int projectID)
{
ResultSet rs;
// 1. get the goals
try
{
Statement statement = connection.createStatement();
rs = statement.executeQuery("SELECT * FROM commits INNER JOIN goals ON commits.goalID = goalID"
+ " Whe... |
2c48538d-bf56-4354-a4e3-6be2c9b31bc6 | private void commitsMenuCheckout()
{
System.out.println("Enter the ID of the project to retrieve commits from.");
ProjectsMenu projectsMenu = new ProjectsMenu(LOGGER, connection);
projectsMenu.projectsMenuView();
String input = userInput.nextLine();
//check input
Inp... |
65f5fc21-fe74-4f4a-a1e9-5749f41732fe | public ContributorsMenu(Logger LOGGER, Connection connection)
{
this.userInput = new Scanner(System.in);
this.LOGGER = LOGGER;
this.connection = connection;
} |
6167593f-ee9d-4ec3-a54d-89c7f648974d | public void contributorsMenu()
{
String input;
boolean wantToQuit = false;
while (!wantToQuit)
{
System.out.println("This is the contributor menu.");
System.out.println("1. VIEW all contributors.");
System.out.println("2. DELETE a contributor.");
... |
e4fdca3f-ae87-46dc-9ef5-8cef65dc07cc | private void contributorsMenuViewContactInfo()
{
//show the user all of the contributors and ask which for one
//they would like to see their contact info.
contributorsMenuView();
System.out.println("Enter the id of the contributor that you would like to see the contact information o... |
8b29ba10-221b-4796-a9ef-f6181d715f8b | private void contributorsMenuDelete(){
//show the user all of the contributors, and ask which one
//that they would like to delete
System.out.println("Enter the id of the contributor that you would like to delete.");
contributorsMenuView();
String input = userInput.nextLine();
... |
6bab35fe-0702-4695-afcf-26846cb0fee4 | private void contributorsMenuView(){
String statementString = "SELECT * FROM contributors";
try
{
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery(statementString);
String columnNames = "ID\t\t fName\t\t lName\t\temail... |
bcd82e50-9c51-4553-b093-d189be26f21e | public MainMenu(Logger LOGGER, Connection connection)
{
this.userInput = new Scanner(System.in);
this.LOGGER = LOGGER;
this.connection = connection;
} |
fc172dba-aeda-4bd0-847d-7529f0e837b4 | public void mainMenu()
{
GoalsMenu goalsMenu = new GoalsMenu(LOGGER, connection);
ContributorsMenu contributorsMenu = new ContributorsMenu(LOGGER, connection);
CommitsMenu commitsMenu = new CommitsMenu(LOGGER, connection);
PostsMenu postsMenu = new PostsMenu(LOGGER, connection);
... |
4e0ed82d-5d05-442e-b5e2-c60b74d26f46 | private void rollbackMenu()
{
try
{
connection.rollback();
}
catch (SQLException sqe)
{
System.out.println("Error. The rollback was unsuccessful.");
}
System.out.println("The changes since the last commit have been rolled back.");
} |
e648eddf-0e66-4426-bb3d-5042c8530549 | public void commitToDatabaseMenu()
{
try
{
connection.commit();
}
catch (SQLException sqe)
{
System.out.println("Error. The commit was not successful.");
}
System.out.println("The transaction has been commited.");
} |
b17f1cf6-c470-4d9d-90d8-6649215b84bb | private void quitMenu()
{
System.out.println();
boolean wantToQuit = false;
while (!wantToQuit)
{
System.out.println("This is the quit menu. If you have not made changes to the database,");
System.out.println("both options will do nothing except quit the pro... |
0303e980-cf42-4dab-8f11-c4c0f5984745 | public Commit(String directory) {
this.directory = directory;
fileList = new LinkedList();
} |
44be096b-14f8-45db-85f2-7341b991225f | public List<Change> generateChanges() {
File repository = new File(directory);
if(!repository.isDirectory()) {
System.err.println("Repository does not exist");
return null;
}
Map<String,File> childList = new TreeMap<String,File>();
listFiles(direc... |
fc9f4f54-bb2b-4c37-a062-5a0a0f2df5c5 | private void listFiles(String repoDir, File dir, Map<String,File> returnFileList) {
File[] fileList = dir.listFiles();
for(int i=0; i<fileList.length; i++) {
if(fileList[i].isFile()) {
//add all files to list
String path = fileList[i].getPath();
... |
c04075bb-054f-450b-8dc7-aaa177a8223f | public String toString() {
return path + "\n" + diff + "\n";
} |
1cd3197f-3ad6-453e-b300-9199370706be | public GoalsMenu(Logger LOGGER, Connection connection)
{
this.LOGGER = LOGGER;
this.connection = connection;
} |
e922fd62-d279-4913-9425-5e677bccf86f | public void goalsMenu()
{
System.out.println();
boolean wantToQuit = false;
while (!wantToQuit)
{
System.out.println("This is the GOALS menu.");
System.out.println("1. ADD a goal.");
System.out.println("2. VIEW a goal.");
System.out.pr... |
664954bd-772e-471f-9f4a-dc693a525936 | public void goalsMenuAdd()
{
System.out.println("Enter the ID of the project this goal belongs to.");
ProjectsMenu projectsMenu = new ProjectsMenu(LOGGER, connection);
projectsMenu.projectsMenuView();
//take in and check input
String input = userInput.nextLi... |
29273136-2e63-4eac-a686-f61c2fad3ff1 | public void goalsMenuView()
{
ResultSet rs;
// 1. get the goals
try
{
Statement statement = connection.createStatement();
rs = statement.executeQuery("SELECT * FROM goals ORDER BY id ASC");
}
catch (SQLException sqe)
{
LOGGE... |
99edf041-0eca-4500-898c-c71778fb3844 | public static boolean init() {
//get home directory
try {
Runtime r = Runtime.getRuntime();
Process p = r.exec(new String[] {"sh", "-c", "echo ~"});
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
p.waitFor();
... |
b62591ac-2251-4822-a3f2-d793a96691b5 | public static String diff(String oldFile, String newFile) {
//check that both files exist
//if first file is null, assign to empty file
//if second is null or invalid, return null
if(oldFile == null) {
oldFile = homeDirectory + "/.dot/empty";
}
if(newFile == n... |
68b44aea-a4f2-4676-9d4f-83e9725426de | public static void build(List<String> patches, String path) {
System.out.println("Building file " + path);
try {
//create new file
File f = new File(path);
f.createNewFile();
Runtime r = Runtime.getRuntime();
//apply p... |
5c8f47d2-6380-4fb0-b951-bbb370794555 | static boolean checkRepository(String directory) {
File dir = new File(directory);
return dir.isDirectory();
} |
9a1990e2-3584-4030-821d-98e069703a5a | static void close() {
if(settings != null) {
settings.save();
}
} |
5ab21d15-6c9d-40cd-b097-03e40770c4ce | public static String readFile(String path)
throws IOException
{
byte[] encoded = Files.readAllBytes(Paths.get(path));
Charset encoding = Charset.defaultCharset();
return encoding.decode(ByteBuffer.wrap(encoded)).toString();
} |
3367f466-782f-4a2d-a255-372dfec9f827 | public InputChecker(String s){
toBeChecked = s;
} |
c615cf25-e382-43c4-b74e-76dcf9129de4 | boolean isInt(){
for(int i = 0; i < toBeChecked.length(); ++i){
if(!Character.isDigit(toBeChecked.charAt(i))){
if(i == 0){
if(toBeChecked.charAt(i) !='-'){
return false;
}
}
return false;
... |
72482de2-bb92-4ef6-946d-513afb7eb70c | boolean hasAlpha(){
return !isInt();
} |
f7e0d5fc-07c2-4a57-8c71-750d314e8817 | public PostsMenu(Logger LOGGER, Connection connection)
{
this.LOGGER = LOGGER;
this.connection = connection;
} |
0eb579e1-52af-435e-998a-6085b4d5434f | public void postsMenu()
{
System.out.println();
boolean wantToQuit = false;
while (!wantToQuit)
{
System.out.println("This is the post menu. Obviously, "
+ "you cannot ADD posts on behalf of users, "
+ "but you can 1. moderate pos... |
a4927628-6b35-4e49-9455-f6471ffa0c83 | private void postMenuEdit()
{
ResultSet rs;
postMenuView();
System.out.println("Enter the ID of the post you want to edit.");
String input = userInput.nextLine();
//check input
InputChecker in = new InputChecker(input);
if(in.hasAlpha()){
System.o... |
284952da-9972-4e66-b658-646b9c3c550e | private void postMenuView()
{
String statementString = "SELECT * FROM posts";
try
{
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery(statementString);
String columnNames = "id\t\t contributorID\t goalID\t\tdataAnd... |
70dd825c-c434-4916-910b-5d22a6925d62 | public SampleQueryMenu(Logger LOGGER, Connection connection)
{
this.userInput = new Scanner(System.in);
this.LOGGER = LOGGER;
this.connection = connection;
} |
facab87c-57b6-497a-a5f0-9ff479156dce | public void query1()
{
ResultSet rs = null;
try
{
Statement statement = connection.createStatement();
rs = statement.executeQuery(query1);
}
catch (SQLException sqe)
{
LOGGER.log(Level.SEVERE, "Error: {0}", sqe.getMessage());
... |
2af720e3-32c5-40b9-94ff-deed188f5858 | public void query3()
{
ResultSet rs = null;
try
{
Statement statement = connection.createStatement();
rs = statement.executeQuery(query3);
}
catch (SQLException sqe)
{
LOGGER.log(Level.SEVERE, "Error: {0}", sqe.getMessage());
... |
777db303-0e13-4e26-9680-8f94f570cc16 | public void query2()
{
ResultSet rs = null;
try
{
Statement statement = connection.createStatement();
rs = statement.executeQuery(query2);
}
catch (SQLException sqe)
{
LOGGER.log(Level.SEVERE, "Error: {0}", sqe.getMessage());
... |
56f3f794-7d4e-4289-b1cd-e54e52de9104 | public void query4()
{
ResultSet rs = null;
try
{
Statement statement = connection.createStatement();
rs = statement.executeQuery(query4);
}
catch (SQLException sqe)
{
LOGGER.log(Level.SEVERE, "Error: {0}", sqe.getMessage());
... |
701264b0-dca5-4dad-890b-5cbd38629995 | public void query5()
{
ResultSet rs = null;
try
{
Statement statement = connection.createStatement();
rs = statement.executeQuery(query5);
}
catch (SQLException sqe)
{
LOGGER.log(Level.SEVERE, "Error: {0}", sqe.getMessage());
... |
fded986e-91a0-4625-9f9c-c347bb79fc39 | public void query6()
{
ResultSet rs = null;
try
{
Statement statement = connection.createStatement();
rs = statement.executeQuery(query6);
}
catch (SQLException sqe)
{
LOGGER.log(Level.SEVERE, "Error: {0}", sqe.getMessage());
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.