Skip to content

Commit fa80ef5

Browse files
committed
save single cell value in converters settings
1 parent 15ed60c commit fa80ef5

File tree

7 files changed

+38
-24
lines changed

7 files changed

+38
-24
lines changed

logicaldoc-core/src/main/java/com/logicaldoc/core/document/HibernateDocumentDAO.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,7 @@ public void store(Document doc, final DocumentHistory transaction) throws Persis
307307
/*
308308
* Check maximum number of documents per folder
309309
*/
310-
long maxDocsPerFolder = config.getLong("maxdocsperfolder", -1L);
311-
if (doc.getId() == 0L && maxDocsPerFolder > 0) {
312-
long count = folderDAO.countDocs(doc.getFolder().getId());
313-
if (count >= maxDocsPerFolder)
314-
throw new TooManyDocumentsException(doc.getFolder(), maxDocsPerFolder);
315-
}
310+
checkMaxDocsPerFolder(doc);
316311

317312
log.debug("Invoke listeners before store");
318313
Map<String, Object> dictionary = new HashMap<>();
@@ -357,6 +352,15 @@ public void store(Document doc, final DocumentHistory transaction) throws Persis
357352
}
358353
}
359354

355+
private void checkMaxDocsPerFolder(Document document) throws PersistenceException {
356+
long maxDocsPerFolder = config.getLong("maxdocsperfolder", -1L);
357+
if (document.getId() == 0L && maxDocsPerFolder > 0) {
358+
long count = folderDAO.countDocs(document.getFolder().getId());
359+
if (count >= maxDocsPerFolder)
360+
throw new TooManyDocumentsException(document.getFolder(), maxDocsPerFolder);
361+
}
362+
}
363+
360364
private void setType(Document doc) {
361365
if (StringUtils.isEmpty(doc.getType()) && doc.getFileName().contains("."))
362366
doc.setType(FileUtil.getExtension(doc.getFileName()).toLowerCase());

logicaldoc-core/src/main/java/com/logicaldoc/core/folder/FolderDAO.java

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,10 @@ public Folder create(Folder parent, Folder folderVO, boolean inheritSecurity, Fo
448448
* @param tenantId The tenant
449449
*
450450
* @return Collection of aliases
451+
*
452+
* @throws PersistenceException error at data layer
451453
*/
452-
public List<Folder> findAliases(Long foldRef, long tenantId);
454+
public List<Folder> findAliases(Long foldRef, long tenantId) throws PersistenceException;
453455

454456
/**
455457
* Creates the folder for the specified path. All unexisting nodes specified
@@ -636,8 +638,10 @@ public Folder copy(Folder source, Folder target, String newName, boolean folders
636638
* @param maxHits Optional defines the max number of returned hits
637639
*
638640
* @return The folders list
641+
*
642+
* @throws PersistenceException error at data layer
639643
*/
640-
public List<Folder> findDeleted(long userId, Integer maxHits);
644+
public List<Folder> findDeleted(long userId, Integer maxHits) throws PersistenceException;
641645

642646
/**
643647
* Checks if a folder with the given folderId is parent of the folder with
@@ -732,8 +736,10 @@ public void updateSecurityRef(long folderId, long rightsFolderId, FolderHistory
732736
* @param computeDeleted if the deleted folders have to be taken int account
733737
*
734738
* @return the number of folders
739+
*
740+
* @throws PersistenceException error at data layer
735741
*/
736-
public int count(boolean computeDeleted);
742+
public int count(boolean computeDeleted) throws PersistenceException;
737743

738744
/**
739745
* Retrieves all the workspaces in the system, that are the first-level
@@ -772,17 +778,21 @@ public void updateSecurityRef(long folderId, long rightsFolderId, FolderHistory
772778
* @param rootId identifier of the root folder
773779
*
774780
* @return the number of documents contained in the tree
781+
*
782+
* @throws PersistenceException error at data layer
775783
*/
776-
public long countDocsInTree(long rootId);
784+
public long countDocsInTree(long rootId) throws PersistenceException;
777785

778786
/**
779787
* Counts the number of documents inside a given folder
780788
*
781789
* @param folderId identifier of the folder
782790
*
783791
* @return the number of documents contained in the folder
792+
*
793+
* @throws PersistenceException error at data layer
784794
*/
785-
public long countDocs(long folderId);
795+
public long countDocs(long folderId) throws PersistenceException;
786796

787797
/**
788798
* Counts the number of documents inside a given folder's tree (direct and
@@ -792,17 +802,21 @@ public void updateSecurityRef(long folderId, long rightsFolderId, FolderHistory
792802
*
793803
* @return sum of the sizes of the documents contained in the tree expressed
794804
* in bytes
805+
*
806+
* @throws PersistenceException error at data layer
795807
*/
796-
public long computeTreeSize(long rootId);
808+
public long computeTreeSize(long rootId) throws PersistenceException;
797809

798810
/**
799811
* Retrieves the alphabetically ordered list of all the folder's tags
800812
*
801813
* @param folderId identifier of the folder
802814
*
803815
* @return list of tags
816+
*
817+
* @throws PersistenceException error at data layer
804818
*/
805-
public List<String> findTags(long folderId);
819+
public List<String> findTags(long folderId) throws PersistenceException;
806820

807821
/**
808822
* Merges the contents of two folders

logicaldoc-core/src/test/java/com/logicaldoc/core/folder/HibernateFolderDAOTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void testCreatePath() throws Exception {
135135
}
136136

137137
@Test
138-
public void testCount() {
138+
public void testCount() throws PersistenceException {
139139
int docCount = testSubject.count(false);
140140
int docCountDelete = testSubject.count(true);
141141
assertEquals(4, docCount);
@@ -189,7 +189,7 @@ public void testCountDocs() throws PersistenceException {
189189
long count = testSubject.countDocs(6L);
190190
assertEquals(4, count);
191191
}
192-
192+
193193
@Test
194194
public void testComputeTreeSize() throws PersistenceException {
195195
/*
@@ -774,7 +774,7 @@ public void testFindById() throws PersistenceException {
774774
}
775775

776776
@Test
777-
public void testFindDeleted() {
777+
public void testFindDeleted() throws PersistenceException {
778778
// Try with a folder id
779779
List<Folder> folders = testSubject.findDeleted(3, 100);
780780
assertEquals(2, folders.size());
@@ -1080,7 +1080,7 @@ public void testFindFolderIdByUserIdInPath() throws PersistenceException {
10801080
}
10811081

10821082
@Test
1083-
public void testFindTags() {
1083+
public void testFindTags() throws PersistenceException {
10841084
List<String> tags = testSubject.findTags(1200);
10851085
assertEquals(2, tags.size());
10861086
assertTrue(tags.contains("ftag1"));
@@ -1316,7 +1316,7 @@ public void testUpdateSecurityRef() throws PersistenceException {
13161316

13171317
// The root has its own policies
13181318
testSubject.updateSecurityRef(1200L, 5L, transaction);
1319-
1319+
13201320
folder = testSubject.findById(1200L);
13211321
assertEquals(5L, folder.getSecurityRef().longValue());
13221322
folder = testSubject.findById(1201L);

logicaldoc-core/src/test/java/com/logicaldoc/core/folder/HibernateFolderHistoryDAOTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ public void testCreateFolderHistory() throws PersistenceException {
120120
Assert.assertEquals(3, histories.size());
121121
}
122122

123-
@SuppressWarnings("deprecation")
124123
@Test
125124
public void testStore() throws PersistenceException {
126125
FolderHistory history = new FolderHistory();

logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/beans/GUIAttendee.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ public boolean equals(Object obj) {
5454
GUIAttendee other = (GUIAttendee) obj;
5555
if (notify != other.notify)
5656
return false;
57-
if (required != other.required)
58-
return false;
59-
return true;
57+
return required == other.required;
6058
}
6159
}

logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/settings/comparators/ComparatorsPanel.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import com.smartgwt.client.widgets.layout.VLayout;
3232
import com.smartgwt.client.widgets.menu.Menu;
3333
import com.smartgwt.client.widgets.menu.MenuItem;
34-
import com.smartgwt.client.widgets.toolbar.ToolStrip;
3534
import com.smartgwt.client.widgets.toolbar.ToolStripButton;
3635

3736
/**

logicaldoc-webapp/src/main/java/com/logicaldoc/web/data/TagsDataServlet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected void service(HttpServletRequest request, HttpServletResponse response,
7575
writer.write("</list>");
7676
}
7777

78-
private void enrichMapWithFolderTags(Long folderId, HashMap<String, Long> tagsMap, List<String> words) {
78+
private void enrichMapWithFolderTags(Long folderId, HashMap<String, Long> tagsMap, List<String> words) throws PersistenceException {
7979
FolderDAO fDao = Context.get(FolderDAO.class);
8080
if (folderId != null) {
8181
List<String> tags = fDao.findTags(folderId);

0 commit comments

Comments
 (0)