Revision 1781
Added by Jing Tao over 21 years ago
src/edu/ucsb/nceas/metacat/DocumentImpl.java | ||
---|---|---|
1712 | 1712 |
String openingtag =serverResStr.substring(0, serverResStr.indexOf(">")+1); |
1713 | 1713 |
if(openingtag.equals("<lockgranted>")) |
1714 | 1714 |
{//the lock was granted go ahead with the insert |
1715 |
XMLReader parser = null; |
|
1715 | 1716 |
try |
1716 | 1717 |
{ |
1717 | 1718 |
//System.out.println("In lockgranted"); |
... | ... | |
1719 | 1720 |
server); |
1720 | 1721 |
/*XMLReader parser = initializeParser(conn, action, docid, updaterev, |
1721 | 1722 |
validate, user, groups, pub, serverCode, dtd);*/ |
1722 |
XMLReader parser = initializeParser(conn, action, docid, updaterev,
|
|
1723 |
parser = initializeParser(conn, action, docid, updaterev, |
|
1723 | 1724 |
user, groups, pub, serverCode, |
1724 | 1725 |
dtd,ruleBase, needValidation); |
1725 | 1726 |
conn.setAutoCommit(false); |
... | ... | |
1731 | 1732 |
{ |
1732 | 1733 |
conn.rollback(); |
1733 | 1734 |
conn.setAutoCommit(true); |
1735 |
//if it is a eml2 document, we need delete online data |
|
1736 |
if ( parser != null) |
|
1737 |
{ |
|
1738 |
ContentHandler handler = parser.getContentHandler(); |
|
1739 |
if (handler instanceof EmlSAXHandler) |
|
1740 |
{ |
|
1741 |
EmlSAXHandler eml = (EmlSAXHandler) handler; |
|
1742 |
eml.deleteInlineFiles(); |
|
1743 |
} |
|
1744 |
} |
|
1734 | 1745 |
throw e; |
1735 | 1746 |
} |
1736 | 1747 |
// run write into access db base one relation table and access object |
... | ... | |
1775 | 1786 |
" does not have permission to update XML Document #" + accnum); |
1776 | 1787 |
} |
1777 | 1788 |
} |
1778 |
|
|
1789 |
XMLReader parser = null; |
|
1779 | 1790 |
try |
1780 | 1791 |
{ |
1781 | 1792 |
|
1782 |
XMLReader parser = initializeParser(conn, action, docid, rev,
|
|
1793 |
parser = initializeParser(conn, action, docid, rev, |
|
1783 | 1794 |
user, groups, pub, serverCode, |
1784 | 1795 |
dtd, ruleBase, needValidation); |
1785 | 1796 |
|
... | ... | |
1792 | 1803 |
{ |
1793 | 1804 |
conn.rollback(); |
1794 | 1805 |
conn.setAutoCommit(true); |
1806 |
//if it is a eml2 document, we need delete online data |
|
1807 |
if ( parser != null) |
|
1808 |
{ |
|
1809 |
ContentHandler handler = parser.getContentHandler(); |
|
1810 |
if (handler instanceof EmlSAXHandler) |
|
1811 |
{ |
|
1812 |
EmlSAXHandler eml = (EmlSAXHandler) handler; |
|
1813 |
eml.deleteInlineFiles(); |
|
1814 |
} |
|
1815 |
} |
|
1795 | 1816 |
throw e; |
1796 | 1817 |
} |
1797 | 1818 |
|
... | ... | |
1895 | 1916 |
|
1896 | 1917 |
|
1897 | 1918 |
// insert into xml_nodes and xml_index table |
1919 |
XMLReader parser = null; |
|
1898 | 1920 |
try |
1899 | 1921 |
{ |
1900 | 1922 |
|
1901 |
XMLReader parser = initializeParser(conn, action, docid, rev,
|
|
1923 |
parser = initializeParser(conn, action, docid, rev, |
|
1902 | 1924 |
user, groups, pub, serverCode, dtd, |
1903 | 1925 |
ruleBase, needValidation); |
1904 | 1926 |
conn.setAutoCommit(false); |
... | ... | |
1910 | 1932 |
{ |
1911 | 1933 |
conn.rollback(); |
1912 | 1934 |
conn.setAutoCommit(true); |
1935 |
if ( parser != null) |
|
1936 |
{ |
|
1937 |
ContentHandler handler = parser.getContentHandler(); |
|
1938 |
if (handler instanceof EmlSAXHandler) |
|
1939 |
{ |
|
1940 |
EmlSAXHandler eml = (EmlSAXHandler) handler; |
|
1941 |
eml.deleteInlineFiles(); |
|
1942 |
} |
|
1943 |
} |
|
1913 | 1944 |
throw e; |
1914 | 1945 |
} |
1915 | 1946 |
|
Also available in: Unified diff
If xml document uploading failed, the inline data file will be deleted either.