| | 463 | public synchronized String registerURL(String title, String url, String uid, String time, String keyword, PrintWriter out) |
| | 464 | { |
| | 465 | long no = System.currentTimeMillis(); |
| | 466 | if (title.equals("")) { |
| | 467 | int index = url.lastIndexOf("/"); |
| | 468 | if (index > -1) { |
| | 469 | title = url.substring(index); |
| | 470 | } |
| | 471 | } |
| | 472 | String registeredURL = "URL:"+no+":"+title; |
| | 473 | time = time.equals("")?Long.toString(new Date().getTime()):time; |
| | 474 | String category = "URL"; |
| | 475 | User user = searchUser(uid); |
| | 476 | String group = (String)user.getGroupList().get(0); |
| | 477 | |
| | 478 | repository.registerFile(registeredURL, url, time, url, category, uid, user.getName(), group, "true", "true", "false", "false", cutSearchword(keyword)); |
| | 479 | |
| | 480 | return registeredURL; |
| | 481 | } |
| | 482 | |
| | 569 | } |
| | 570 | |
| | 571 | boolean changeTitle(String filename, String value) |
| | 572 | { |
| | 573 | return repository.changeTag(filename, "_name", value, null); |
| | 574 | } |
| | 575 | |
| | 576 | static boolean isURL(String filename) |
| | 577 | { |
| | 578 | return filename.startsWith("URL:"); |
| | 579 | } |
| | 580 | |
| | 581 | static String getURL(String filename) |
| | 582 | { |
| | 583 | if (isURL(filename)) { |
| | 584 | String name = filename.substring("URL:".length()); |
| | 585 | int index = name.indexOf(":"); |
| | 586 | if (index > -1) { |
| | 587 | name = name.substring(index + 1); |
| | 588 | } else { |
| | 589 | name = ""; // internal error |
| | 590 | } |
| | 591 | return name; |
| | 592 | } else { |
| | 593 | return ""; |
| | 594 | } |