Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -r4865d4cfe5d0132047d5b840cb5311b9fbf848fb -r7a6897909f33a09faec913848956d4012f477c7c Binary files differ Index: lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java =================================================================== diff -u -r8dfc912013b6f3ec9a7b5bc2e7d19407c914bb3f -r7a6897909f33a09faec913848956d4012f477c7c --- lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java (.../ObjectExtractor.java) (revision 8dfc912013b6f3ec9a7b5bc2e7d19407c914bb3f) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java (.../ObjectExtractor.java) (revision 7a6897909f33a09faec913848956d4012f477c7c) @@ -558,6 +558,9 @@ if (version == null) { version = Configuration.get(ConfigurationKeys.SERVER_VERSION_NUMBER); } + learningDesign.setDesignType((String)JsonUtil.opt(ldJSON, AuthoringJsonTags.DESIGN_TYPE)); + log.debug("authoring: design type is "+learningDesign.getDesignType()); + learningDesign.setVersion(version); learningDesign.setDuration(JsonUtil.optLong(ldJSON, AuthoringJsonTags.DURATION)); Index: lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java =================================================================== diff -u -r5888eb3b8d899791a62caa68063e1a4d0ac2dcd7 -r7a6897909f33a09faec913848956d4012f477c7c --- lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java (.../AuthoringService.java) (revision 5888eb3b8d899791a62caa68063e1a4d0ac2dcd7) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java (.../AuthoringService.java) (revision 7a6897909f33a09faec913848956d4012f477c7c) @@ -1914,7 +1914,7 @@ LearningDesign learningDesign = new LearningDesign(null, null, null, learningDesignTitle, null, null, 1, false, false, null, null, null, new Date(), Configuration.get(ConfigurationKeys.SERVER_VERSION_NUMBER), user, - user, null, null, null, null, null, null, null, null, contentFolderID, false, null, 1); + user, null, null, null, null, null, null, null, null, contentFolderID, false, null, 1, null); WorkspaceFolder folder = null; Index: lams_central/src/java/org/lamsfoundation/lams/webservice/xml/LearningDesignRepositoryServlet.java =================================================================== diff -u -r6f7d7f332dbd468ea4e530e2f010bf54df382564 -r7a6897909f33a09faec913848956d4012f477c7c --- lams_central/src/java/org/lamsfoundation/lams/webservice/xml/LearningDesignRepositoryServlet.java (.../LearningDesignRepositoryServlet.java) (revision 6f7d7f332dbd468ea4e530e2f010bf54df382564) +++ lams_central/src/java/org/lamsfoundation/lams/webservice/xml/LearningDesignRepositoryServlet.java (.../LearningDesignRepositoryServlet.java) (revision 7a6897909f33a09faec913848956d4012f477c7c) @@ -339,9 +339,9 @@ String folderContentsJSON = null; if ( method.equals("getLearningDesignsJSON") ) { Integer folderID = WebUtil.readIntParam(request, "folderID", true); - folderContentsJSON = service.getFolderContentsJSON(folderID, userId, allowInvalidDesigns); + String designType = request.getParameter("type"); + folderContentsJSON = service.getFolderContentsJSON(folderID, userId, allowInvalidDesigns, designType); } else { - Integer folderID = WebUtil.readIntParam(request, "folderID", true); Integer page = WebUtil.readIntParam(request, "page", true); Integer size = WebUtil.readIntParam(request, "size", true); String sortName = request.getParameter("sortName"); Index: lams_central/src/java/org/lamsfoundation/lams/workspace/service/IWorkspaceManagementService.java =================================================================== diff -u -r6b0e0c0668f4d5ee32ae9e3fe76e12395f187e8c -r7a6897909f33a09faec913848956d4012f477c7c --- lams_central/src/java/org/lamsfoundation/lams/workspace/service/IWorkspaceManagementService.java (.../IWorkspaceManagementService.java) (revision 6b0e0c0668f4d5ee32ae9e3fe76e12395f187e8c) +++ lams_central/src/java/org/lamsfoundation/lams/workspace/service/IWorkspaceManagementService.java (.../IWorkspaceManagementService.java) (revision 7a6897909f33a09faec913848956d4012f477c7c) @@ -143,21 +143,31 @@ * Sample output: */ String getFolderContentsJSON(Integer folderID, Integer userID, boolean allowInvalidDesigns) throws JSONException, - IOException, UserAccessDeniedException, RepositoryCheckedException; - - /** - * Returns a section of the learning designs in the root of the user's personal folder. Returns the data in in JSON - * format. If searchString is not null, it does a case insenstive "contains" comparison on name (title). Otherwise - * sortName and sortDate should be null, ASC or DESC and the data will be paged. - * Sample output: - * {"total_rows":2,"rows":[{"learningDesignId":19,"description":"Team Based Learning: Blah Blah","name":"Blah Blah", - * "date":"2015-07-13 10:16:35.0"},{"learningDesignId":18,"description":"Team Based Learning Design: BBBBBB", - * "name":"TBL_BBBBB","date":"2015-07-13 10:07:41.0"}]} - */ - public String getPagedLearningDesignsJSON(Integer userID, boolean allowInvalidDesigns, String searchString, int page, int size, - String sortName, String sortDate) throws JSONException, IOException; - + IOException, UserAccessDeniedException, RepositoryCheckedException; + /** + * Returns Folder Contents in JSON format, restricted by designType (used for Integrations) + * If folderID == null, returns the top level folders available to the user. + * If folderID == -1, return only the learning designs in the root of the user's folder + * Otherwise returns the learning designs and subfolders of the given folder. + * Sample output: + */ + String getFolderContentsJSON(Integer folderID, Integer userID, boolean allowInvalidDesigns, String designType) throws JSONException, + IOException, UserAccessDeniedException, RepositoryCheckedException; + + /** + * Returns a section of the learning designs in the root of the user's personal folder. Returns the data in in JSON + * format. If searchString is not null, it does a case insenstive "contains" comparison on name (title). Otherwise + * sortName and sortDate should be null, ASC or DESC and the data will be paged. + * Sample output: + * {"total_rows":2,"rows":[{"learningDesignId":19,"description":"Team Based Learning: Blah Blah","name":"Blah Blah", + * "date":"2015-07-13 10:16:35.0"},{"learningDesignId":18,"description":"Team Based Learning Design: BBBBBB", + * "name":"TBL_BBBBB","date":"2015-07-13 10:07:41.0"}]} + */ + public String getPagedLearningDesignsJSON(Integer userID, boolean allowInvalidDesigns, String searchString, int page, int size, + String sortName, String sortDate) throws JSONException, IOException; + + /** * This method creates a new folder under the given parentFolder * inside the user's default workspace. * Index: lams_central/src/java/org/lamsfoundation/lams/workspace/service/WorkspaceManagementService.java =================================================================== diff -u -r6f7d7f332dbd468ea4e530e2f010bf54df382564 -r7a6897909f33a09faec913848956d4012f477c7c --- lams_central/src/java/org/lamsfoundation/lams/workspace/service/WorkspaceManagementService.java (.../WorkspaceManagementService.java) (revision 6f7d7f332dbd468ea4e530e2f010bf54df382564) +++ lams_central/src/java/org/lamsfoundation/lams/workspace/service/WorkspaceManagementService.java (.../WorkspaceManagementService.java) (revision 7a6897909f33a09faec913848956d4012f477c7c) @@ -401,11 +401,20 @@ public String getFolderContentsJSON(Integer folderID, Integer userID, boolean allowInvalidDesigns) throws JSONException, IOException, UserAccessDeniedException, RepositoryCheckedException { - return getFolderContentsJSON(folderID, userID, allowInvalidDesigns, false); + return getFolderContentsJSON(folderID, userID, allowInvalidDesigns, false, null); } - - public String getFolderContentsJSON(Integer folderID, Integer userID, boolean allowInvalidDesigns, boolean designsOnly) + + @Override + @SuppressWarnings("unchecked") + public String getFolderContentsJSON(Integer folderID, Integer userID, boolean allowInvalidDesigns, String designType) throws JSONException, IOException, UserAccessDeniedException, RepositoryCheckedException { + + return getFolderContentsJSON(folderID, userID, allowInvalidDesigns, false, designType); + } + + public String getFolderContentsJSON(Integer folderID, Integer userID, boolean allowInvalidDesigns, + boolean designsOnly, String designType) + throws JSONException, IOException, UserAccessDeniedException, RepositoryCheckedException { JSONObject result = new JSONObject(); Vector folderContents = null; @@ -434,7 +443,7 @@ } } else if ( userFolder != null ) { - return getFolderContentsJSON(userFolder.getResourceID().intValue(), userID, allowInvalidDesigns, true); + return getFolderContentsJSON(userFolder.getResourceID().intValue(), userID, allowInvalidDesigns, true, designType); } // else we want to return an empty JSON, which will be done by falling through to the folderContents loop. @@ -468,12 +477,14 @@ subfolderJSON.put("folderID", folderContent.getResourceID().intValue()); result.append("folders", subfolderJSON); } else if (FolderContentDTO.DESIGN.equals(contentType)) { - JSONObject learningDesignJSON = new JSONObject(); - learningDesignJSON.put("name", folderContent.getName()); - learningDesignJSON.put("learningDesignId", folderContent.getResourceID()); - learningDesignJSON.put("description", folderContent.getDescription()); - learningDesignJSON.put("date", folderContent.getLastModifiedDateTime()); - result.append("learningDesigns", learningDesignJSON); + if ( designType == null || designType.equals(folderContent.getDesignType())) { + JSONObject learningDesignJSON = new JSONObject(); + learningDesignJSON.put("name", folderContent.getName()); + learningDesignJSON.put("learningDesignId", folderContent.getResourceID()); + learningDesignJSON.putOpt("type", folderContent.getDesignType()); + learningDesignJSON.put("date", folderContent.getLastModifiedDateTime()); + result.append("learningDesigns", learningDesignJSON); + } } else { if (log.isDebugEnabled()) { log.debug("Unsupported folder content found, named \"" + folderContent.getName() + "\""); @@ -520,7 +531,7 @@ JSONObject learningDesignJSON = new JSONObject(); learningDesignJSON.put("name", StringEscapeUtils.escapeHtml(design.getTitle())); learningDesignJSON.put("learningDesignId", design.getLearningDesignId()); - learningDesignJSON.put("description", StringEscapeUtils.escapeHtml(design.getDescription())); + learningDesignJSON.putOpt("type", design.getDesignType()); learningDesignJSON.put("date", design.getLastModifiedDateTime()); result.put(learningDesignJSON); } Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesign.hbm.xml =================================================================== diff -u -rcdfac2952ff97628ca908d175f9b481a08007d9e -r7a6897909f33a09faec913848956d4012f477c7c --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesign.hbm.xml (.../LearningDesign.hbm.xml) (revision cdfac2952ff97628ca908d175f9b481a08007d9e) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesign.hbm.xml (.../LearningDesign.hbm.xml) (revision 7a6897909f33a09faec913848956d4012f477c7c) @@ -173,6 +173,13 @@ @hibernate.property column="content_folder_id" length="32" + + Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040043.sql =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040043.sql (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040043.sql (revision 7a6897909f33a09faec913848956d4012f477c7c) @@ -0,0 +1,12 @@ +-- Turn off autocommit, so nothing is committed if there is an error + +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; + +-- LDEV-3523 Type used to classify a learning design into a grouping understood by a user. Can be used by integrations and contents determined by the integration. +ALTER TABLE lams_learning_design ADD COLUMN design_type VARCHAR(255); + +-- If there were no errors, commit and restore autocommit to on +SET FOREIGN_KEY_CHECKS=0; +COMMIT; +SET AUTOCOMMIT = 1; Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesign.java =================================================================== diff -u -rcdfac2952ff97628ca908d175f9b481a08007d9e -r7a6897909f33a09faec913848956d4012f477c7c --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesign.java (.../LearningDesign.java) (revision cdfac2952ff97628ca908d175f9b481a08007d9e) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesign.java (.../LearningDesign.java) (revision 7a6897909f33a09faec913848956d4012f477c7c) @@ -159,6 +159,9 @@ /** persistent field*/ private Boolean removed; + + /** persistent field */ + private String designType; /* If the values for createDateTime and/or lastModifiedDateTime * are null, then it will default to the current datetime. @@ -191,7 +194,8 @@ String contentFolderID, Boolean editOverrideLock, User editOverrideUser, - Integer designVersion + Integer designVersion, + String designType ) { this.learningDesignId = learningDesignId; this.learningDesignUIID = ui_id; @@ -223,6 +227,7 @@ this.editOverrideUser = editOverrideUser; this.designVersion = designVersion; this.removed = Boolean.FALSE; + this.designType = designType; } /** default constructor */ @@ -304,6 +309,7 @@ newDesign.setEditOverrideUser(design.getEditOverrideUser()); newDesign.setOriginalUser(design.getOriginalUser()); newDesign.setRemoved(design.getRemoved()); + newDesign.setDesignType(design.getDesignType()); return newDesign; } @@ -606,5 +612,12 @@ public void setRemoved(Boolean removed) { this.removed = removed; } + public String getDesignType() { + return this.designType; + } + public void setDesignType(String designType) { + this.designType = designType; + } + } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/util/AuthoringJsonTags.java =================================================================== diff -u -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883 -r7a6897909f33a09faec913848956d4012f477c7c --- lams_common/src/java/org/lamsfoundation/lams/util/AuthoringJsonTags.java (.../AuthoringJsonTags.java) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883) +++ lams_common/src/java/org/lamsfoundation/lams/util/AuthoringJsonTags.java (.../AuthoringJsonTags.java) (revision 7a6897909f33a09faec913848956d4012f477c7c) @@ -155,6 +155,7 @@ public static final String LICENSE_TEXT = "licenseText"; public static final String CONTENT_FOLDER_ID = "contentFolderID"; public static final String SAVE_MODE = "saveMode"; + public static final String DESIGN_TYPE = "designType"; /** ComplexActivity specific tags */ public static final String CHILD_ACTIVITIES = "childActivities"; Index: lams_common/src/java/org/lamsfoundation/lams/workspace/dto/FolderContentDTO.java =================================================================== diff -u -reb42380458dff71406b1964f915d8428a4bf2a2e -r7a6897909f33a09faec913848956d4012f477c7c --- lams_common/src/java/org/lamsfoundation/lams/workspace/dto/FolderContentDTO.java (.../FolderContentDTO.java) (revision eb42380458dff71406b1964f915d8428a4bf2a2e) +++ lams_common/src/java/org/lamsfoundation/lams/workspace/dto/FolderContentDTO.java (.../FolderContentDTO.java) (revision 7a6897909f33a09faec913848956d4012f477c7c) @@ -57,6 +57,7 @@ public Long licenseID; // applicable for designs only public String licenseText; // applicable for designs only public Boolean readOnly; // applicable for designs only + public String designType; // applicable for designs only public String author; public String originalAuthor; public FolderContentDTO(){ @@ -77,6 +78,7 @@ this.permissionCode = permissionCode; this.licenseID = licenseID; this.versionDetails = null; + this.designType = null; this.readOnly = false; } public FolderContentDTO(LearningDesign design, Integer permissionCode, User user){ @@ -90,6 +92,7 @@ this.permissionCode = permissionCode; this.licenseID = ( design.getLicense() != null ? design.getLicense().getLicenseID() : null); this.licenseText = design.getLicenseText(); + this.designType = design.getDesignType(); this.versionDetails = null; this.readOnly = design.getReadOnly(); this.author = design.getUser().getFullName(); @@ -106,6 +109,7 @@ this.resourceID = new Long(workspaceFolder.getWorkspaceFolderId().intValue()); this.permissionCode = permissionCode; this.licenseID = null; + this.designType = null; this.versionDetails = null; this.readOnly = Boolean.FALSE; } @@ -125,6 +129,7 @@ this.versionDetails = new Vector(); versionDetails.addAll(details); this.readOnly = Boolean.FALSE; + this.designType = null; } @Override @@ -188,6 +193,12 @@ return resourceType!=null?resourceType:WDDXTAGS.STRING_NULL_VALUE; } /** + * @return Returns the designType. + */ + public String getDesignType() { + return designType; + } + /** * @return Returns the resourceTypeID. */ public Long getResourceTypeID() {