Revision 628
Added by berkley about 24 years ago
src/edu/ucsb/nceas/metacat/DocumentImpl.java | ||
---|---|---|
799 | 799 |
String group, int serverCode, boolean override) |
800 | 800 |
throws Exception |
801 | 801 |
{ |
802 |
int updaterev; |
|
802 | 803 |
MetaCatUtil util = new MetaCatUtil(); |
803 | 804 |
// Determine if the docid is OK for INSERT or UPDATE |
804 | 805 |
AccessionNumber ac = new AccessionNumber(conn); |
... | ... | |
816 | 817 |
int istreamInt; |
817 | 818 |
char istreamChar; |
818 | 819 |
DocumentImpl newdoc = new DocumentImpl(conn, docid); |
819 |
int updaterev = newdoc.getRev();
|
|
820 |
updaterev = newdoc.getRev(); |
|
820 | 821 |
String server = MetacatReplication.getServer(serverCode); |
821 | 822 |
MetacatReplication.replLog("attempting to lock " + docid); |
822 | 823 |
URL u = new URL("http://" + server + "?action=getlock&updaterev=" + |
... | ... | |
895 | 896 |
|
896 | 897 |
if ( action.equals("UPDATE") ) { |
897 | 898 |
// check for 'write' permission for 'user' to update this document |
899 |
|
|
898 | 900 |
if ( !hasPermission(conn, user, group, docid) ) { |
899 | 901 |
throw new Exception("User " + user + |
900 | 902 |
" does not have permission to update XML Document #" + docid); |
... | ... | |
954 | 956 |
public static void delete( Connection conn, String docid, |
955 | 957 |
String user, String group ) |
956 | 958 |
throws Exception { |
957 |
|
|
959 |
DocumentIdentifier id = new DocumentIdentifier(docid); |
|
960 |
docid = id.getSiteCode() + id.getSeparator() + id.getUniqueId(); |
|
961 |
|
|
958 | 962 |
// Determine if the docid is OK for DELETE |
959 | 963 |
AccessionNumber ac = new AccessionNumber(conn); |
960 | 964 |
String newdocid = ac.generate(docid, "DELETE"); |
... | ... | |
970 | 974 |
DocumentImpl.archiveDocRevision( conn, docid, user ); |
971 | 975 |
|
972 | 976 |
// Now delete it from the xml_documents table |
977 |
|
|
973 | 978 |
Statement stmt = conn.createStatement(); |
974 | 979 |
stmt.execute("DELETE FROM xml_index WHERE docid = '" + docid + "'"); |
975 | 980 |
stmt.execute("DELETE FROM xml_documents WHERE docid = '" + docid + "'"); |
Also available in: Unified diff
added revision support to the delete function