Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java @ 320:b46c5b13ac94
Extract the collection and artifact creation times when doing the initial, too.
artifacts/trunk@2482 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 10 Aug 2011 14:18:33 +0000 |
parents | 2ed77f7e1bab |
children | 542caebea773 |
comparison
equal
deleted
inserted
replaced
319:61017c6031b8 | 320:b46c5b13ac94 |
---|---|
1758 new LRUCache<String, Artifact>(200); | 1758 new LRUCache<String, Artifact>(200); |
1759 | 1759 |
1760 prepareStatement(SQL_ALL_ARTIFACTS); | 1760 prepareStatement(SQL_ALL_ARTIFACTS); |
1761 result = stmnt.executeQuery(); | 1761 result = stmnt.executeQuery(); |
1762 while (result.next()) { | 1762 while (result.next()) { |
1763 String userId = result.getString(1); | 1763 String userId = result.getString("u_gid"); |
1764 String collectionId = result.getString(2); | 1764 String collectionId = result.getString("c_gid"); |
1765 String collectionName = result.getString(3); | 1765 String collectionName = result.getString("c_name"); |
1766 String artifactId = result.getString(4); | 1766 String artifactId = result.getString("a_gid"); |
1767 String factoryName = result.getString(5); | 1767 String factoryName = result.getString("factory"); |
1768 Date collectionCreated = | |
1769 new Date(result.getTimestamp("c_creation").getTime()); | |
1770 Date artifactCreated = | |
1771 new Date(result.getTimestamp("a_creation").getTime()); | |
1768 | 1772 |
1769 Artifact artifact = alreadyLoaded.get(artifactId); | 1773 Artifact artifact = alreadyLoaded.get(artifactId); |
1770 | 1774 |
1771 if (artifact != null) { | 1775 if (artifact != null) { |
1772 alc.artifactLoaded( | 1776 alc.artifactLoaded( |
1773 userId, | 1777 userId, |
1774 collectionId, collectionName, | 1778 collectionId, collectionName, |
1775 artifactId, artifact); | 1779 collectionCreated, |
1780 artifactId, artifactCreated, artifact); | |
1776 continue; | 1781 continue; |
1777 } | 1782 } |
1778 | 1783 |
1779 ArtifactFactory factory = factoryLookup | 1784 ArtifactFactory factory = factoryLookup |
1780 .getArtifactFactory(factoryName); | 1785 .getArtifactFactory(factoryName); |
1782 if (factory == null) { | 1787 if (factory == null) { |
1783 logger.error("factory '" + factoryName + "' not found"); | 1788 logger.error("factory '" + factoryName + "' not found"); |
1784 continue; | 1789 continue; |
1785 } | 1790 } |
1786 | 1791 |
1787 byte [] bytes = result.getBytes(6); | 1792 byte [] bytes = result.getBytes("data"); |
1788 | 1793 |
1789 artifact = factory.getSerializer().fromBytes(bytes); | 1794 artifact = factory.getSerializer().fromBytes(bytes); |
1790 | 1795 |
1791 if (artifact != null) { | 1796 if (artifact != null) { |
1792 alc.artifactLoaded( | 1797 alc.artifactLoaded( |
1793 userId, | 1798 userId, |
1794 collectionId, collectionName, | 1799 collectionId, collectionName, collectionCreated, |
1795 artifactId, artifact); | 1800 artifactId, artifactCreated, artifact); |
1796 } | 1801 } |
1797 | 1802 |
1798 alreadyLoaded.put(artifactId, artifact); | 1803 alreadyLoaded.put(artifactId, artifact); |
1799 } | 1804 } |
1800 return true; | 1805 return true; |