Skip to content

Commit

Permalink
removing unused method
Browse files Browse the repository at this point in the history
  • Loading branch information
hplahar committed Jan 9, 2015
1 parent bb65d94 commit 4560b5c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
12 changes: 0 additions & 12 deletions src/main/java/org/jbei/ice/lib/folder/FolderController.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.jbei.ice.lib.folder;

import org.apache.commons.lang.StringUtils;
import org.jbei.ice.ControllerException;
import org.jbei.ice.lib.access.Permission;
import org.jbei.ice.lib.access.PermissionException;
import org.jbei.ice.lib.access.PermissionsController;
Expand Down Expand Up @@ -348,17 +347,6 @@ public FolderDetails delete(String userId, long folderId, FolderType type) {
}
}

public Folder addFolderContents(Account account, long id, ArrayList<Entry> entrys) throws ControllerException {
Folder folder = dao.get(id);
if (folder == null)
throw new ControllerException("Could not retrieve folder with id " + id);
folder = dao.addFolderContents(folder, entrys);
if (folder.isPropagatePermissions()) {
permissionsController.propagateFolderPermissions(account, folder, true);
}
return folder;
}

// expects the same entries to be added
public ArrayList<FolderDetails> addEntriesToFolder(String userId, ArrayList<FolderDetails> folders) {
EntryController entryController = new EntryController();
Expand Down
16 changes: 9 additions & 7 deletions src/test/java/org/jbei/ice/lib/folder/FolderControllerTest.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package org.jbei.ice.lib.folder;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;

import org.jbei.ice.lib.AccountCreator;
import org.jbei.ice.lib.TestEntryCreator;
import org.jbei.ice.lib.access.PermissionsController;
Expand All @@ -17,12 +13,15 @@
import org.jbei.ice.lib.entry.model.Strain;
import org.jbei.ice.lib.group.GroupController;
import org.jbei.ice.lib.shared.ColumnField;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;

/**
* @author Hector Plahar
*/
Expand Down Expand Up @@ -97,12 +96,15 @@ public void testRetrieveFolderContents() throws Exception {
Strain strain = TestEntryCreator.createTestStrain(account);
Assert.assertNotNull(strain);
parts.put(strain.getPartNumber(), strain);
folder.getEntries().add(strain.toDataTransferObject());
}
Assert.assertEquals(size, parts.size());

// add to folder
Folder added = controller.addFolderContents(account, folder.getId(), new ArrayList<>(parts.values()));
Assert.assertNotNull(added);
ArrayList<FolderDetails> foldersToAdd = new ArrayList<>();
foldersToAdd.add(folder);
foldersToAdd = controller.addEntriesToFolder(account.getEmail(), foldersToAdd);
Assert.assertNotNull(foldersToAdd);

// keep track to find duplicates
HashSet<Long> set = new HashSet<>();
Expand Down

0 comments on commit 4560b5c

Please sign in to comment.