Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java @ 317:824051dff018
When loading all artifacts fetch the name of the collections, too.
artifacts/trunk@2453 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 02 Aug 2011 14:05:34 +0000 |
parents | 0ca9b1073ccf |
children | 2ed77f7e1bab |
comparison
equal
deleted
inserted
replaced
316:0ca9b1073ccf | 317:824051dff018 |
---|---|
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(1); |
1764 String collectionId = result.getString(2); | 1764 String collectionId = result.getString(2); |
1765 String artifactId = result.getString(3); | 1765 String artifactId = result.getString(3); |
1766 String factoryName = result.getString(4); | 1766 String collectionName = result.getString(4); |
1767 String factoryName = result.getString(5); | |
1767 | 1768 |
1768 Artifact artifact = alreadyLoaded.get(artifactId); | 1769 Artifact artifact = alreadyLoaded.get(artifactId); |
1769 | 1770 |
1770 if (artifact != null) { | 1771 if (artifact != null) { |
1771 alc.artifactLoaded( | 1772 alc.artifactLoaded( |
1772 userId, collectionId, artifactId, artifact); | 1773 userId, |
1774 collectionId, collectionName, | |
1775 artifactId, artifact); | |
1773 continue; | 1776 continue; |
1774 } | 1777 } |
1775 | 1778 |
1776 ArtifactFactory factory = factoryLookup | 1779 ArtifactFactory factory = factoryLookup |
1777 .getArtifactFactory(factoryName); | 1780 .getArtifactFactory(factoryName); |
1779 if (factory == null) { | 1782 if (factory == null) { |
1780 logger.error("factory '" + factoryName + "' not found"); | 1783 logger.error("factory '" + factoryName + "' not found"); |
1781 continue; | 1784 continue; |
1782 } | 1785 } |
1783 | 1786 |
1784 byte [] bytes = result.getBytes(5); | 1787 byte [] bytes = result.getBytes(6); |
1785 | 1788 |
1786 artifact = factory.getSerializer().fromBytes(bytes); | 1789 artifact = factory.getSerializer().fromBytes(bytes); |
1787 | 1790 |
1788 if (artifact != null) { | 1791 if (artifact != null) { |
1789 alc.artifactLoaded( | 1792 alc.artifactLoaded( |
1790 userId, collectionId, artifactId, artifact); | 1793 userId, |
1794 collectionId, collectionName, | |
1795 artifactId, artifact); | |
1791 } | 1796 } |
1792 | 1797 |
1793 alreadyLoaded.put(artifactId, artifact); | 1798 alreadyLoaded.put(artifactId, artifact); |
1794 } | 1799 } |
1795 return true; | 1800 return true; |