Skip to content

Instantly share code, notes, and snippets.

@ppmdo
Created February 16, 2018 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppmdo/f2b96ec37812f0da45f43a5ac8d6e354 to your computer and use it in GitHub Desktop.
Save ppmdo/f2b96ec37812f0da45f43a5ac8d6e354 to your computer and use it in GitHub Desktop.
Changes to dspace-api/src/main/java/org/dspace/content/Community.java
@@ -60,6 +60,7 @@ public class Community extends DSpaceObject
private Group admins;
// Keys for accessing Community metadata
+ public static final String ORDER = "order";
public static final String COPYRIGHT_TEXT = "copyright_text";
public static final String INTRODUCTORY_TEXT = "introductory_text";
public static final String SHORT_DESCRIPTION = "short_description";
@@ -267,7 +268,7 @@ public class Community extends DSpaceObject
tri = DatabaseManager.query(context,
query,
Constants.COMMUNITY,
- MetadataField.findByElement(context, MetadataSchema.find(context, MetadataSchema.DC_SCHEMA).getSchemaID(), "title", null).getFieldID()
+ MetadataField.findByElement(context, MetadataSchema.find(context, MetadataSchema.DC_SCHEMA).getSchemaID(), "identifier", "other").getFieldID()
);
} catch (SQLException e) {
log.error("Find all Communities - ",e);
@@ -731,18 +732,21 @@ public class Community extends DSpaceObject
try {
String query = "SELECT c.* FROM community2community c2c, community c " +
"LEFT JOIN metadatavalue m on (m.resource_id = c.community_id and m.resource_type_id = ? and m.metadata_field_id = ?) " +
+ "LEFT JOIN metadatavalue m2 on (m2.resource_id = c.community_id and m2.resource_type_id = ? and m2.metadata_field_id = ?) " +
"WHERE c2c.child_comm_id=c.community_id " +
"AND c2c.parent_comm_id= ? ";
if(DatabaseManager.isOracle()){
query += " ORDER BY cast(m.text_value as varchar2(128))";
}else{
- query += " ORDER BY m.text_value";
+ query += " ORDER BY m.text_value, m2.text_value";
}
tri = DatabaseManager.query(
ourContext,
query,
Constants.COMMUNITY,
+ MetadataField.findByElement(ourContext, MetadataSchema.find(ourContext, MetadataSchema.DC_SCHEMA).getSchemaID(), "identifier", "other").getFieldID(),
+ Constants.COMMUNITY,
MetadataField.findByElement(ourContext, MetadataSchema.find(ourContext, MetadataSchema.DC_SCHEMA).getSchemaID(), "title", null).getFieldID(),
getID()
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment