Index: lams_build/3rdParty.userlibraries =================================================================== diff -u -r4c55f5a75076dc524955b4222b07492d22d773ad -r7b17debf33a07e7f114b0d524d34da0f483ede0a --- lams_build/3rdParty.userlibraries (.../3rdParty.userlibraries) (revision 4c55f5a75076dc524955b4222b07492d22d773ad) +++ lams_build/3rdParty.userlibraries (.../3rdParty.userlibraries) (revision 7b17debf33a07e7f114b0d524d34da0f483ede0a) @@ -25,9 +25,6 @@ - - - Index: lams_build/conf/j2ee/jboss-deployment-structure.xml =================================================================== diff -u -r0ab3a7eecca026b1792030c9ed8eceb799042a14 -r7b17debf33a07e7f114b0d524d34da0f483ede0a --- lams_build/conf/j2ee/jboss-deployment-structure.xml (.../jboss-deployment-structure.xml) (revision 0ab3a7eecca026b1792030c9ed8eceb799042a14) +++ lams_build/conf/j2ee/jboss-deployment-structure.xml (.../jboss-deployment-structure.xml) (revision 7b17debf33a07e7f114b0d524d34da0f483ede0a) @@ -39,7 +39,6 @@ - Index: lams_build/lib/lucene/lucene-analyzers-common-4.10.2.jar =================================================================== diff -u -re179b1c5a61d9aa11b2b3d9d741ad2674322aec4 -r7b17debf33a07e7f114b0d524d34da0f483ede0a Binary files differ Index: lams_build/lib/lucene/lucene-core-4.10.2.jar =================================================================== diff -u -re179b1c5a61d9aa11b2b3d9d741ad2674322aec4 -r7b17debf33a07e7f114b0d524d34da0f483ede0a Binary files differ Index: lams_build/lib/lucene/lucene-queryparser-4.10.2.jar =================================================================== diff -u -re179b1c5a61d9aa11b2b3d9d741ad2674322aec4 -r7b17debf33a07e7f114b0d524d34da0f483ede0a Binary files differ Fisheye: Tag 7b17debf33a07e7f114b0d524d34da0f483ede0a refers to a dead (removed) revision in file `lams_build/lib/lucene/lucene.module.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_build/liblist.txt =================================================================== diff -u -r4c55f5a75076dc524955b4222b07492d22d773ad -r7b17debf33a07e7f114b0d524d34da0f483ede0a --- lams_build/liblist.txt (.../liblist.txt) (revision 4c55f5a75076dc524955b4222b07492d22d773ad) +++ lams_build/liblist.txt (.../liblist.txt) (revision 7b17debf33a07e7f114b0d524d34da0f483ede0a) @@ -33,9 +33,6 @@ json-simple json-simple-1.1.1.jar 1.1.1 Apache License 2.0 fangyidong A simple Java toolkit for JSON -lucene lucene-core-2.4.0.jar 2.4.0 Apache License 2.0 Apache text search engine library - lucene-snowball-2.4.0.jar 2.4.0 - mysql mysql-connector-java-5.1.43-bin.jar 5.1.43 GPL Oracle Java connector for MySQL odmg odmg-3.0.jar 3.0 Index: lams_central/src/java/org/lamsfoundation/lams/web/planner/PedagogicalPlannerAction.java =================================================================== diff -u -r497b3a63c3c7672cf8cc46ebde1f251ae6388512 -r7b17debf33a07e7f114b0d524d34da0f483ede0a --- lams_central/src/java/org/lamsfoundation/lams/web/planner/PedagogicalPlannerAction.java (.../PedagogicalPlannerAction.java) (revision 497b3a63c3c7672cf8cc46ebde1f251ae6388512) +++ lams_central/src/java/org/lamsfoundation/lams/web/planner/PedagogicalPlannerAction.java (.../PedagogicalPlannerAction.java) (revision 7b17debf33a07e7f114b0d524d34da0f483ede0a) @@ -33,9 +33,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -51,24 +49,6 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import org.apache.lucene.analysis.Analyzer; -import org.apache.lucene.analysis.standard.StandardAnalyzer; -import org.apache.lucene.document.Document; -import org.apache.lucene.document.Field; -import org.apache.lucene.document.StringField; -import org.apache.lucene.document.TextField; -import org.apache.lucene.index.CorruptIndexException; -import org.apache.lucene.index.DirectoryReader; -import org.apache.lucene.index.IndexWriter; -import org.apache.lucene.index.IndexWriterConfig; -import org.apache.lucene.index.IndexWriterConfig.OpenMode; -import org.apache.lucene.queryparser.classic.MultiFieldQueryParser; -import org.apache.lucene.queryparser.classic.ParseException; -import org.apache.lucene.search.IndexSearcher; -import org.apache.lucene.search.Query; -import org.apache.lucene.search.ScoreDoc; -import org.apache.lucene.search.TopDocs; -import org.apache.lucene.store.RAMDirectory; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; @@ -131,17 +111,6 @@ * Action managing Pedagogical Planner base page and non-tool activities. * * @author Marcin Cieslak - * - * - * - * - * - * - * - * - * - * - * */ public class PedagogicalPlannerAction extends LamsDispatchAction { private static Logger log = Logger.getLogger(PedagogicalPlannerAction.class); @@ -155,9 +124,6 @@ private static PedagogicalPlannerDAO pedagogicalPlannerDAO; private static ActivityDAO activityDAO; - private static final RAMDirectory luceneDir = new RAMDirectory(); - private static final Analyzer luceneAnalyzer = new StandardAnalyzer(); - private static final String FILE_EXTENSION_ZIP = ".zip"; private static final String FILE_EXTENSION_LAS = ".las"; @@ -354,7 +320,7 @@ throws ServletException { ActionMessages errors = new ActionMessages(); - List activities = new ArrayList(); + List activities = new ArrayList<>(); // Create DTOs that hold all the necessary information of the activities Activity activity = learningDesign.getFirstActivity(); @@ -752,48 +718,13 @@ Boolean edit = WebUtil.readBooleanParam(request, CentralConstants.PARAM_EDIT, false); edit &= canEdit; - // Fill the DTO - PedagogicalPlannerSequenceNodeDTO dto = null; - if (filterText != null) { - try { - // Filtering = display node and all the subnodes that were found in the search (not the immediate - // children of the node) - Set filteredNodeUids = filterSubnodes(node, filterText); - if (filteredNodeUids != null) { - request.setAttribute(CentralConstants.PARAM_FILTER_TEXT, filterText); - - Set filteredNodes = new LinkedHashSet( - filteredNodeUids.size()); - for (Long filteredUid : filteredNodeUids) { - PedagogicalPlannerSequenceNode subnode = getPedagogicalPlannerDAO().getByUid(filteredUid); - filteredNodes.add(subnode); - } - - dto = new PedagogicalPlannerSequenceNodeDTO(node, filteredNodes, isSysAdmin, - getPedagogicalPlannerDAO()); - for (PedagogicalPlannerSequenceNodeDTO subnodeDTO : dto.getSubnodes()) { - List titlePath = getPedagogicalPlannerDAO().getTitlePath(subnodeDTO.getUid()); - subnodeDTO.setTitlePath(titlePath); - } - } - } catch (Exception e) { - PedagogicalPlannerAction.log.error(e, e); - ActionMessages errors = new ActionMessages(); - errors.add(ActionMessages.GLOBAL_MESSAGE, - new ActionMessage(PedagogicalPlannerAction.ERROR_KEY_FILTER_PARSE)); - saveErrors(request, errors); - } + // No filtering or something went wrong in filtering + PedagogicalPlannerSequenceNodeDTO dto = new PedagogicalPlannerSequenceNodeDTO(node, node.getSubnodes(), + isSysAdmin, getPedagogicalPlannerDAO()); + if (nodeUid == null) { + dto.setRecentlyModifiedNodes(getRecentlyModifiedLearnindDesignsAsNodes()); } - if (dto == null) { - // No filtering or something went wrong in filtering - dto = new PedagogicalPlannerSequenceNodeDTO(node, node.getSubnodes(), isSysAdmin, - getPedagogicalPlannerDAO()); - if (nodeUid == null) { - dto.setRecentlyModifiedNodes(getRecentlyModifiedLearnindDesignsAsNodes()); - } - } - // Additional DTO parameters List titlePath = getPedagogicalPlannerDAO().getTitlePath(nodeUid); Boolean createSubnode = WebUtil.readBooleanParam(request, CentralConstants.PARAM_CREATE_SUBNODE, false); @@ -1306,10 +1237,10 @@ @SuppressWarnings("unchecked") private LearningDesign importLearningDesign(File sourceFile, ActionMessages errors) throws ServletException { User user = getUser(); - List toolsErrorMsgs = new ArrayList(); + List toolsErrorMsgs = new ArrayList<>(); Long learningDesignID = null; LearningDesign learningDesign = null; - List learningDesignErrorMsgs = new ArrayList(); + List learningDesignErrorMsgs = new ArrayList<>(); Integer workspaceFolderId = null; @@ -1366,7 +1297,7 @@ WorkspaceFolder parentFolder = getUserManagementService().getRootOrganisation().getNormalFolder(); Integer workspaceFolderType = WorkspaceFolder.PUBLIC_SEQUENCES; - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("name", name); properties.put("parentWorkspaceFolder.workspaceFolderId", parentFolder.getWorkspaceFolderId()); properties.put("workspaceFolderType", workspaceFolderType); @@ -1419,7 +1350,7 @@ } } else { - List toolsErrorMsgs = new ArrayList(); + List toolsErrorMsgs = new ArrayList<>(); String exportedLdFilePath = getExportService().exportLearningDesign(node.getLearningDesignId(), toolsErrorMsgs); if (!toolsErrorMsgs.isEmpty()) { @@ -1477,100 +1408,6 @@ } } - /** - * Finds all node's descendants matching the query. Results can be not only the subnodes of the node, but also - * deeper descendants. This method uses Lucene project for query parsing and searchig. - * - * @param node - * @param filterText - * @return set of nodes' uids - * @throws ParseException - * @throws CorruptIndexException - * @throws IOException - */ - private Set filterSubnodes(PedagogicalPlannerSequenceNode node, String filterText) - throws ParseException, CorruptIndexException, IOException { - Set matchingSubnodeUids = new LinkedHashSet(); - if (!StringUtils.isEmpty(filterText)) { - - Set docs = extractSubnodeDocuments(node); - if (!docs.isEmpty()) { - // Searching is performed in title, brief description and full description of the node. - MultiFieldQueryParser queryParser = new MultiFieldQueryParser( - new String[] { PedagogicalPlannerAction.FIELD_NAME_TITLE, - PedagogicalPlannerAction.FIELD_NAME_FULL_DESCRIPTION, - PedagogicalPlannerAction.FIELD_NAME_BRIEF_DESCRIPTION }, - PedagogicalPlannerAction.luceneAnalyzer); - - Query query = queryParser.parse(filterText); - - // build index based on nodes - IndexWriterConfig config = new IndexWriterConfig(PedagogicalPlannerAction.luceneAnalyzer.getVersion(), - PedagogicalPlannerAction.luceneAnalyzer); - config.setOpenMode(OpenMode.CREATE); - IndexWriter indexWriter = new IndexWriter(PedagogicalPlannerAction.luceneDir, config); - for (Document doc : docs) { - indexWriter.addDocument(doc); - } - indexWriter.close(); - - // execute search - IndexSearcher searcher = new IndexSearcher(DirectoryReader.open(PedagogicalPlannerAction.luceneDir)); - TopDocs topDocs = searcher.search(query, null, docs.size()); - - for (ScoreDoc scoreDoc : topDocs.scoreDocs) { - Document doc = searcher.doc(scoreDoc.doc); - String ancestorUid = doc.get(PedagogicalPlannerAction.FIELD_NAME_ANCESTOR_UID); - Long uid = new Long(ancestorUid); - matchingSubnodeUids.add(uid); - } - } - } - return matchingSubnodeUids; - } - - /** - * Adds documents made of subnodes' title, descriptions and uid, then descents deeper into descendants. - * - * @param node - * its subnodes will be parsed - * @return documents made of all of node's descendants - */ - private Set extractSubnodeDocuments(PedagogicalPlannerSequenceNode node) { - Set docs = new HashSet(); - if ((node != null) && (node.getSubnodes() != null)) { - for (PedagogicalPlannerSequenceNode subnode : node.getSubnodes()) { - Document doc = new Document(); - Field titleField = new TextField(PedagogicalPlannerAction.FIELD_NAME_TITLE, subnode.getTitle(), - Field.Store.NO); - titleField.setBoost(10); - doc.add(titleField); - - String briefDesc = WebUtil.removeHTMLtags(subnode.getBriefDescription()); - if (briefDesc != null) { - Field briefDescField = new TextField(PedagogicalPlannerAction.FIELD_NAME_BRIEF_DESCRIPTION, - briefDesc, Field.Store.NO); - doc.add(briefDescField); - } - String fullDesc = WebUtil.removeHTMLtags(subnode.getFullDescription()); - if (fullDesc != null) { - Field fullDescField = new TextField(PedagogicalPlannerAction.FIELD_NAME_FULL_DESCRIPTION, fullDesc, - Field.Store.NO); - doc.add(fullDescField); - } - - Field uidField = new StringField(PedagogicalPlannerAction.FIELD_NAME_ANCESTOR_UID, - subnode.getUid().toString(), Field.Store.YES); - doc.add(uidField); - docs.add(doc); - - Set subnodeDocs = extractSubnodeDocuments(subnode); - docs.addAll(subnodeDocs); - } - } - return docs; - } - /*----------------------- GROUPING METHODS -------------------------*/ /** @@ -1638,7 +1475,7 @@ User user = getUser(); // the list is sorted most-recently-edited-on-top (so by the timestamp descending) Set recentLDs = user.getRecentlyModifiedLearningDesigns(); - List recentNodes = new LinkedList(); + List recentNodes = new LinkedList<>(); // create "dummy", almost empty nodes for (Long learningDesignId : recentLDs) { LearningDesign learningDesign = getAuthoringService().getLearningDesign(learningDesignId); @@ -1718,7 +1555,7 @@ if (!StringUtils.isEmpty(activityMetadataString)) { String[] activityMetadataEntries = activityMetadataString.split("&"); // creata a map of metadata objects, because we are filling them multiple times during this iteration - Map activitiesMetadata = new TreeMap(); + Map activitiesMetadata = new TreeMap<>(); for (String activityMetadataEntry : activityMetadataEntries) { String[] keyAndValue = activityMetadataEntry.split("="); String[] keyParts = keyAndValue[0].split("\\."); @@ -1790,7 +1627,7 @@ HttpServletResponse response) throws IOException, ServletException { Long learningDesignId = WebUtil.readLongParam(request, CentralConstants.PARAM_LEARNING_DESIGN_ID); - List toolsErrorMsgs = new ArrayList(); + List toolsErrorMsgs = new ArrayList<>(); ActionMessages errors = new ActionMessages(); String zipFilePath = null; boolean valid = false; @@ -1854,7 +1691,7 @@ // list existing users (inherited role from parent nodes) Set allInheritedUsers = getPedagogicalPlannerDAO().getInheritedNodeUsers(nodeUid, Role.ROLE_SYSADMIN); - ArrayList filteredInheritedUsers = new ArrayList(); + ArrayList filteredInheritedUsers = new ArrayList<>(); for (Object o : allInheritedUsers) { User u = (User) o; // filter existing users of the actual node @@ -1865,7 +1702,7 @@ } // filter existing users from list of potential users - ArrayList potentialUsers = new ArrayList(); + ArrayList potentialUsers = new ArrayList<>(); for (Object o : potentialUsersVector) { User u = (User) o; if (existingUsers.contains(u) || allInheritedUsers.contains(u)) { Index: lams_central/web/includes/javascript/pedagogicalPlanner.js =================================================================== diff -u -r07865c855b32c77613ed72dd81cd499033dca4dd -r7b17debf33a07e7f114b0d524d34da0f483ede0a --- lams_central/web/includes/javascript/pedagogicalPlanner.js (.../pedagogicalPlanner.js) (revision 07865c855b32c77613ed72dd81cd499033dca4dd) +++ lams_central/web/includes/javascript/pedagogicalPlanner.js (.../pedagogicalPlanner.js) (revision 7b17debf33a07e7f114b0d524d34da0f483ede0a) @@ -290,19 +290,6 @@ document.getElementById("fileArea").style.display = document.getElementById("hasSubnodesType").checked ? "none" : "block"; } - function filterNodes(url,doFilter){ - if (doFilter){ - url += "&filterText="+document.getElementById("filterText").value; - } - document.location.href=url; - } - - function filterNodesOnEnter(url){ - if (window.event && window.event.keyCode == 13){ - filterNodes(url,true); - } - } - function collapseActivity(id, action){ $('.collapsible'+id).hide(); $('#activity'+id).hide('slow', function () {