Commit 1fedeeeedca12d15090984f430d217631e5f857a

Authored by Fernando Ribeiro
1 parent 3b2f1b01e8

Replaced dspace base code with dspace5.2++. This code has all the patches made u…

…ntil dspace 5.4. Have all addons except statistics addon. Next commit will have all previous changes made to dspce52++
Showing 484 changed files with 44664 additions and 1873 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 484 files displayed.

LICENSE
1 1 DSpace source code license:
2 2  
3 3  
4   -Copyright (c) 2002-2015, DuraSpace. All rights reserved.
  4 +Copyright (c) 2002-2013, DuraSpace. All rights reserved.
5 5  
6 6 Redistribution and use in source and binary forms, with or without
7 7 modification, are permitted provided that the following conditions are
... ...
LICENSES_THIRD_PARTY
... ... @@ -266,24 +266,24 @@ https://wiki.duraspace.org/display/DSPACE/Code+Contribution+Guidelines
266 266 * Morfologik Stemming Dictionary for Polish (org.carrot2:morfologik-polish:1.7.1 - http://morfologik.blogspot.com/morfologik-polish/)
267 267 * Morfologik Stemming APIs (org.carrot2:morfologik-stemming:1.7.1 - http://morfologik.blogspot.com/morfologik-stemming/)
268 268 * databene ContiPerf (org.databene:contiperf:2.2.0 - http://databene.org/contiperf)
269   - * DSpace Kernel :: API and Implementation (org.dspace:dspace-api:5.3-SNAPSHOT - https://github.com/dspace/DSpace/dspace-api)
  269 + * DSpace Kernel :: API and Implementation (org.dspace:dspace-api:5.1-SNAPSHOT - https://github.com/dspace/DSpace/dspace-api)
270 270 * DSpace I18N :: Language Packs (org.dspace:dspace-api-lang:5.0.4 - http://nexus.sonatype.org/oss-repository-hosting.html/dspace-api-lang)
271   - * DSpace JSP-UI (org.dspace:dspace-jspui:5.3-SNAPSHOT - https://github.com/dspace/DSpace/dspace-jspui)
272   - * DSpace OAI-PMH (org.dspace:dspace-oai:5.3-SNAPSHOT - https://github.com/dspace/DSpace/dspace-oai)
273   - * DSpace RDF (org.dspace:dspace-rdf:5.3-SNAPSHOT - https://github.com/dspace/DSpace/dspace-rdf)
274   - * DSpace REST :: API and Implementation (org.dspace:dspace-rest:5.3-SNAPSHOT - http://demo.dspace.org)
275   - * DSpace Services Framework :: API and Implementation (org.dspace:dspace-services:5.3-SNAPSHOT - https://github.com/dspace/DSpace/dspace-services)
276   - * Apache Solr Webapp (org.dspace:dspace-solr:5.3-SNAPSHOT - https://github.com/dspace/DSpace/dspace-solr)
277   - * DSpace SWORD (org.dspace:dspace-sword:5.3-SNAPSHOT - https://github.com/dspace/DSpace/dspace-sword)
278   - * DSpace SWORD v2 (org.dspace:dspace-swordv2:5.3-SNAPSHOT - https://github.com/dspace/DSpace/dspace-swordv2)
279   - * DSpace XML-UI (Manakin) (org.dspace:dspace-xmlui:5.3-SNAPSHOT - https://github.com/dspace/DSpace/dspace-xmlui)
280   - * DSpace XML-UI (Manakin) I18N :: Language Packs (org.dspace:dspace-xmlui-lang:5.0.5 - http://nexus.sonatype.org/oss-repository-hosting.html/dspace-xmlui-lang)
  271 + * DSpace JSP-UI (org.dspace:dspace-jspui:5.1-SNAPSHOT - https://github.com/dspace/DSpace/dspace-jspui)
  272 + * DSpace OAI-PMH (org.dspace:dspace-oai:5.1-SNAPSHOT - https://github.com/dspace/DSpace/dspace-oai)
  273 + * DSpace RDF (org.dspace:dspace-rdf:5.1-SNAPSHOT - https://github.com/dspace/DSpace/dspace-rdf)
  274 + * DSpace REST :: API and Implementation (org.dspace:dspace-rest:5.1-SNAPSHOT - http://demo.dspace.org)
  275 + * DSpace Services Framework :: API and Implementation (org.dspace:dspace-services:5.1-SNAPSHOT - https://github.com/dspace/DSpace/dspace-services)
  276 + * Apache Solr Webapp (org.dspace:dspace-solr:5.1-SNAPSHOT - https://github.com/dspace/DSpace/dspace-solr)
  277 + * DSpace SWORD (org.dspace:dspace-sword:5.1-SNAPSHOT - https://github.com/dspace/DSpace/dspace-sword)
  278 + * DSpace SWORD v2 (org.dspace:dspace-swordv2:5.1-SNAPSHOT - https://github.com/dspace/DSpace/dspace-swordv2)
  279 + * DSpace XML-UI (Manakin) (org.dspace:dspace-xmlui:5.1-SNAPSHOT - https://github.com/dspace/DSpace/dspace-xmlui)
  280 + * DSpace XML-UI (Manakin) I18N :: Language Packs (org.dspace:dspace-xmlui-lang:5.0.4 - http://nexus.sonatype.org/oss-repository-hosting.html/dspace-xmlui-lang)
281 281 * handle (org.dspace:handle:6.2 - no url defined)
282 282 * jargon (org.dspace:jargon:1.4.25 - no url defined)
283 283 * mets (org.dspace:mets:1.5.2 - no url defined)
284 284 * oclc-harvester2 (org.dspace:oclc-harvester2:0.1.12 - no url defined)
285 285 * Repackaged Cocoon Servlet Service Implementation (org.dspace.dependencies.cocoon:dspace-cocoon-servlet-service-impl:1.0.3 - http://projects.dspace.org/dspace-pom/dspace-cocoon-servlet-service-impl)
286   - * DSpace Kernel :: Additions and Local Customizations (org.dspace.modules:additions:5.3-SNAPSHOT - https://github.com/dspace/DSpace/modules/additions)
  286 + * DSpace Kernel :: Additions and Local Customizations (org.dspace.modules:additions:5.1-SNAPSHOT - https://github.com/dspace/DSpace/modules/additions)
287 287 * Hamcrest All (org.hamcrest:hamcrest-all:1.3 - https://github.com/hamcrest/JavaHamcrest/hamcrest-all)
288 288 * Hamcrest Core (org.hamcrest:hamcrest-core:1.3 - https://github.com/hamcrest/JavaHamcrest/hamcrest-core)
289 289 * JBibTeX (org.jbibtex:jbibtex:1.0.10 - http://www.jbibtex.org)
... ...
build.properties
... ... @@ -31,7 +31,8 @@ dspace.hostname = localhost
31 31 dspace.baseUrl = http://localhost:8080
32 32  
33 33 # The user interface you will be using for DSpace. Common usage is either xmlui or jspui
34   -dspace.ui = xmlui
  34 +#dspace.ui = jspui
  35 +dspace.ui =
35 36  
36 37 # Full link your end users will use to access DSpace. In most cases, this will be the baseurl followed by
37 38 # the context path to the UI you are using.
... ... @@ -41,13 +42,13 @@ dspace.ui = xmlui
41 42 dspace.url = ${dspace.baseUrl}/${dspace.ui}
42 43  
43 44 # Name of the site
44   -dspace.name = DSpace at My University
  45 +dspace.name = DSpace
45 46  
46 47 # Solr server
47 48 solr.server=http://localhost:8080/solr
48 49  
49 50 # Default language for metadata values
50   -default.language = en_US
  51 +default.language = pt_PT
51 52  
52 53 ##########################
53 54 # DATABASE CONFIGURATION #
... ... @@ -56,15 +57,15 @@ default.language = en_US
56 57 # Uncomment the appropriate block below for your database.
57 58 # postgres
58 59 db.driver=org.postgresql.Driver
59   -db.url=jdbc:postgresql://localhost:5432/dspace
60   -db.username=dspace
61   -db.password=dspace
  60 +db.url = jdbc:postgresql://localhost:5432/dspace
  61 +db.username = dspace
  62 +db.password = dspace
62 63  
63 64 # oracle
64 65 #db.driver= oracle.jdbc.OracleDriver
65 66 #db.url=jdbc:oracle:thin:@//localhost:1521/xe
66 67 #db.username=dspace
67   -#db.password=dspace
  68 +#db.password = dspace
68 69  
69 70 # Schema name - if your database contains multiple schemas, you can avoid
70 71 # problems with retrieving the definitions of duplicate object names by
... ... @@ -95,7 +96,7 @@ db.poolname = dspacepool
95 96 #######################
96 97  
97 98 # SMTP mail server
98   -mail.server = smtp.example.com
  99 +default.language = pt_PT
99 100  
100 101 # SMTP mail server authentication username and password (if required)
101 102 # mail.server.username = myusername
... ... @@ -169,3 +170,14 @@ loglevel.other = INFO
169 170 loglevel.dspace = INFO
170 171 # loglevel.dspace: Log level for all DSpace-specific code (org.dspace.*)
171 172 # Possible values (from most to least info): DEBUG, INFO, WARN, ERROR, FATAL
  173 +
  174 +###################
  175 +# LAYOUT SETTINGS #
  176 +###################
  177 +template.name =
  178 +template.layout = layout1
  179 +
  180 +###################
  181 +# PIWIK SETTINGS #
  182 +###################
  183 +piwik.id =
... ...
dspace-api/pom.xml
... ... @@ -12,7 +12,7 @@
12 12 <parent>
13 13 <groupId>org.dspace</groupId>
14 14 <artifactId>dspace-parent</artifactId>
15   - <version>5.4</version>
  15 + <version>5.2</version>
16 16 <relativePath>..</relativePath>
17 17 </parent>
18 18  
... ... @@ -566,7 +566,38 @@
566 566 <artifactId>guava</artifactId>
567 567 <version>18.0</version>
568 568 </dependency>
569   -
  569 +
  570 + <!-- DEGOIS -->
  571 + <dependency>
  572 + <groupId>rcaap</groupId>
  573 + <artifactId>degois</artifactId>
  574 + <version>3.0</version>
  575 + </dependency>
  576 + <dependency>
  577 + <groupId>axis</groupId>
  578 + <artifactId>axis</artifactId>
  579 + <version>1.2-RC2</version>
  580 + </dependency>
  581 + <dependency>
  582 + <groupId>axis</groupId>
  583 + <artifactId>axis-jaxrpc</artifactId>
  584 + <version>1.2-RC2</version>
  585 + </dependency>
  586 + <dependency>
  587 + <groupId>axis</groupId>
  588 + <artifactId>axis-wsdl4j</artifactId>
  589 + <version>1.2-RC2</version>
  590 + </dependency>
  591 + <dependency>
  592 + <groupId>axis</groupId>
  593 + <artifactId>axis-saaj</artifactId>
  594 + <version>1.2-RC2</version>
  595 + </dependency>
  596 + <dependency>
  597 + <groupId>javax.xml.bind</groupId>
  598 + <artifactId>jaxb-api</artifactId>
  599 + <version>2.1</version>
  600 + </dependency>
570 601  
571 602 <dependency>
572 603 <groupId>postgresql</groupId>
... ... @@ -602,22 +633,28 @@
602 633 <dependency>
603 634 <groupId>com.google.apis</groupId>
604 635 <artifactId>google-api-services-analytics</artifactId>
  636 + <version>v3-rev103-1.19.0</version>
605 637 </dependency>
606 638 <dependency>
607 639 <groupId>com.google.api-client</groupId>
608 640 <artifactId>google-api-client</artifactId>
  641 + <version>1.19.1</version>
609 642 </dependency>
610 643 <dependency>
611 644 <groupId>com.google.http-client</groupId>
612 645 <artifactId>google-http-client</artifactId>
  646 + <version>1.19.0</version>
613 647 </dependency>
614 648 <dependency>
615 649 <groupId>com.google.http-client</groupId>
616 650 <artifactId>google-http-client-jackson2</artifactId>
  651 + <version>1.19.0</version>
617 652 </dependency>
618 653 <dependency>
619 654 <groupId>com.google.oauth-client</groupId>
  655 + <!--<artifactId>google-oauth-client-jetty</artifactId>-->
620 656 <artifactId>google-oauth-client</artifactId>
  657 + <version>1.19.0</version>
621 658 </dependency>
622 659 <!-- FindBugs -->
623 660 <dependency>
... ...
dspace-api/src/main/java/org/dspace/app/util/CollectionDropDown.java
... ... @@ -23,8 +23,8 @@ public class CollectionDropDown {
23 23 /**
24 24 * Get full path starting from a top-level community via subcommunities down to a collection.
25 25 * The full path will not be truncated.
26   - *
27   - * @param col
  26 + *
  27 + * @param col
28 28 * Get full path for this collection
29 29 * @return Full path to the collection
30 30 */
... ... @@ -32,14 +32,14 @@ public class CollectionDropDown {
32 32 {
33 33 return CollectionDropDown.collectionPath(col, 0);
34 34 }
35   -
  35 +
36 36 /**
37 37 * Get full path starting from a top-level community via subcommunities down to a collection.
38 38 * The full cat will be truncated to the specified number of characters and prepended with an ellipsis.
39   - *
40   - * @param col
  39 + *
  40 + * @param col
41 41 * Get full path for this collection
42   - * @param maxchars
  42 + * @param maxchars
43 43 * Truncate the full path to maxchar characters. 0 means do not truncate.
44 44 * @return Full path to the collection (truncated)
45 45 */
... ... @@ -50,15 +50,18 @@ public class CollectionDropDown {
50 50 {
51 51 separator = " > ";
52 52 }
53   -
54   - Community[] getCom = null;
  53 +
  54 + /* FR: Remove communities showing in the drop down box - request by repositories administrators*/
  55 + StringBuffer name = new StringBuffer("");
  56 + /*Community[] getCom = null;
55 57 StringBuffer name = new StringBuffer("");
56 58 getCom = col.getCommunities(); // all communities containing given collection
57 59 for (Community com : getCom)
58 60 {
59 61 name.insert(0, com.getMetadata("name") + separator);
60 62 }
61   -
  63 + //END OF REMOVING Communities
  64 + */
62 65 name.append(col.getMetadata("name"));
63 66  
64 67 if (maxchars != 0)
... ...
dspace-api/src/main/java/org/dspace/app/util/GoogleMetadata.java
... ... @@ -11,7 +11,6 @@ import java.sql.SQLException;
11 11  
12 12 import com.google.common.collect.ArrayListMultimap;
13 13 import com.google.common.collect.ListMultimap;
14   -
15 14 import org.dspace.authorize.AuthorizeManager;
16 15 import org.dspace.content.*;
17 16  
... ... @@ -23,7 +22,6 @@ import java.util.Enumeration;
23 22 import java.util.HashMap;
24 23 import java.util.Map;
25 24 import java.util.Properties;
26   -
27 25 import org.apache.log4j.Logger;
28 26 import org.dspace.core.ConfigurationManager;
29 27  
... ... @@ -35,10 +33,10 @@ import java.util.HashSet;
35 33 import java.util.List;
36 34 import java.util.Map.Entry;
37 35 import java.util.Set;
38   -
39 36 import org.dspace.core.Constants;
40 37 import org.dspace.core.Context;
41 38 import org.dspace.handle.HandleManager;
  39 +
42 40 import org.jdom.Element;
43 41  
44 42 /**
... ... @@ -760,9 +758,8 @@ public class GoogleMetadata
760 758 }
761 759  
762 760 /**
763   - * Fetch retaining the order of the values for any given key in which they
764   - * where added (like authors).
765   - *
  761 + * Fetch all metadata mappings
  762 + *
766 763 * Usage: GoogleMetadata gmd = new GoogleMetadata(item); for(Entry<String,
767 764 * String> mapping : googlemd.getMappings()) { ... }
768 765 *
... ... @@ -1045,6 +1042,7 @@ public class GoogleMetadata
1045 1042 */
1046 1043 private Bitstream findLinkableFulltext(Item item) throws SQLException {
1047 1044 Bitstream bestSoFar = null;
  1045 + int bitstreamCount = 0;
1048 1046 Bundle[] contentBundles = item.getBundles("ORIGINAL");
1049 1047 for (Bundle bundle : contentBundles) {
1050 1048 int primaryBitstreamId = bundle.getPrimaryBitstreamID();
... ... @@ -1053,16 +1051,16 @@ public class GoogleMetadata
1053 1051 if (candidate.getID() == primaryBitstreamId) { // is primary -> use this one
1054 1052 if (isPublic(candidate)) {
1055 1053 return candidate;
1056   - }
1057   - } else
1058   - {
1059   -
1060   - if (bestSoFar == null && isPublic(candidate)) { //if bestSoFar is null but the candidate is not public you don't use it and try to find another
1061   - bestSoFar = candidate;
1062   - }
1063 1054 }
  1055 + } else if (bestSoFar == null) {
  1056 + bestSoFar = candidate;
  1057 + }
  1058 + bitstreamCount++;
1064 1059 }
1065 1060 }
  1061 + if (bitstreamCount > 1 || !isPublic(bestSoFar)) {
  1062 + bestSoFar = null;
  1063 + }
1066 1064  
1067 1065 return bestSoFar;
1068 1066 }
... ...
dspace-api/src/main/java/org/dspace/authorize/AuthorizeManager.java
... ... @@ -20,7 +20,6 @@ import org.dspace.eperson.Group;
20 20 import org.dspace.storage.rdbms.DatabaseManager;
21 21 import org.dspace.storage.rdbms.TableRow;
22 22 import org.dspace.storage.rdbms.TableRowIterator;
23   -import org.dspace.workflow.WorkflowItem;
24 23  
25 24 /**
26 25 * AuthorizeManager handles all authorization checks for DSpace. For better
... ... @@ -296,43 +295,8 @@ public class AuthorizeManager
296 295 }
297 296 }
298 297  
299   - // In case the dso is an bundle or bitstream we must ignore custom
300   - // policies if it does not belong to at least one installed item (see
301   - // DS-2614).
302   - // In case the dso is an item and a corresponding workspace or workflow
303   - // item exist, we have to ignore custom policies (see DS-2614).
304   - boolean ignoreCustomPolicies = false;
305   - if (o instanceof Bitstream)
306   - {
307   - Bitstream b = (Bitstream) o;
308   -
309   - // Ensure that this is not a collection or community logo
310   - DSpaceObject parent = b.getParentObject();
311   - if (!(parent instanceof Collection) && !(parent instanceof Community))
312   - {
313   - ignoreCustomPolicies = !isAnyItemInstalled(c, b.getBundles());
314   - }
315   - }
316   - if (o instanceof Bundle)
317   - {
318   - ignoreCustomPolicies = !isAnyItemInstalled(c, new Bundle[] {(Bundle) o});
319   - }
320   - if (o instanceof Item)
321   - {
322   - if (WorkspaceItem.findByItem(c, (Item) o) != null ||
323   - WorkflowItem.findByItem(c, (Item) o) != null)
324   - {
325   - ignoreCustomPolicies = true;
326   - }
327   - }
328   -
329 298 for (ResourcePolicy rp : getPoliciesActionFilter(c, o, action))
330 299 {
331   - if (ignoreCustomPolicies
332   - && ResourcePolicy.TYPE_CUSTOM.equals(rp.getRpType()))
333   - {
334   - continue;
335   - }
336 300 // check policies for date validity
337 301 if (rp.isDateValid())
338 302 {
... ... @@ -354,26 +318,7 @@ public class AuthorizeManager
354 318 // default authorization is denial
355 319 return false;
356 320 }
357   -
358   - // check whether any bundle belongs to any item that passed submission
359   - // and workflow process
360   - protected static boolean isAnyItemInstalled(Context ctx, Bundle[] bundles)
361   - throws SQLException
362   - {
363   - for (Bundle bundle : bundles)
364   - {
365   - for (Item item : bundle.getItems())
366   - {
367   - if (WorkspaceItem.findByItem(ctx, item) == null
368   - && WorkflowItem.findByItem(ctx, item) == null)
369   - {
370   - return true;
371   - }
372   - }
373   - }
374   - return false;
375   - }
376   -
  321 +
377 322 ///////////////////////////////////////////////
378 323 // admin check methods
379 324 ///////////////////////////////////////////////
... ... @@ -892,7 +837,7 @@ public class AuthorizeManager
892 837 throws SQLException
893 838 {
894 839 DatabaseManager.updateQuery(c, "DELETE FROM resourcepolicy WHERE "
895   - + "resource_type_id= ? AND resource_id= ? AND (rptype <> ? OR rptype IS NULL)",
  840 + + "resource_type_id= ? AND resource_id= ? AND rptype <> ? ",
896 841 o.getType(), o.getID(), type);
897 842 }
898 843  
... ...
dspace-api/src/main/java/org/dspace/browse/SolrBrowseDAO.java
... ... @@ -361,7 +361,7 @@ public class SolrBrowseDAO implements BrowseDAO
361 361 else
362 362 {
363 363 query.setQuery("bi_" + column + "_sort" + ": {\"" + value + "\" TO *]");
364   - query.addFilterQueries("-(bi_" + column + "_sort" + ":" + value + "*)");
  364 + query.addFilterQueries("-(bi_" + column + "_sort" + ":" + value + "*)");
365 365 }
366 366 boolean includeUnDiscoverable = itemsWithdrawn || !itemsDiscoverable;
367 367 DiscoverResult resp = null;
... ...
dspace-api/src/main/java/org/dspace/content/WorkspaceItem.java
... ... @@ -29,7 +29,7 @@ import org.dspace.storage.rdbms.TableRowIterator;
29 29  
30 30 /**
31 31 * Class representing an item in the process of being submitted by a user
32   - *
  32 + *
33 33 * @author Robert Tansley
34 34 * @version $Revision$
35 35 */
... ... @@ -52,7 +52,7 @@ public class WorkspaceItem implements InProgressSubmission
52 52  
53 53 /**
54 54 * Construct a workspace item corresponding to the given database row
55   - *
  55 + *
56 56 * @param context
57 57 * the context this object exists in
58 58 * @param row
... ... @@ -74,12 +74,12 @@ public class WorkspaceItem implements InProgressSubmission
74 74 /**
75 75 * Get a workspace item from the database. The item, collection and
76 76 * submitter are loaded into memory.
77   - *
  77 + *
78 78 * @param context
79 79 * DSpace context object
80 80 * @param id
81 81 * ID of the workspace item
82   - *
  82 + *
83 83 * @return the workspace item, or null if the ID is invalid.
84 84 */
85 85 public static WorkspaceItem find(Context context, int id)
... ... @@ -121,7 +121,7 @@ public class WorkspaceItem implements InProgressSubmission
121 121 /**
122 122 * Create a new workspace item, with a new ID. An Item is also created. The
123 123 * submitter is the current user in the context.
124   - *
  124 + *
125 125 * @param c
126 126 * DSpace context object
127 127 * @param coll
... ... @@ -129,7 +129,7 @@ public class WorkspaceItem implements InProgressSubmission
129 129 * @param template
130 130 * if <code>true</code>, the workspace item starts as a copy
131 131 * of the collection's template item
132   - *
  132 + *
133 133 * @return the newly created workspace item
134 134 */
135 135 public static WorkspaceItem create(Context c, Collection coll,
... ... @@ -257,6 +257,17 @@ public class WorkspaceItem implements InProgressSubmission
257 257 row.setColumn("item_id", i.getID());
258 258 row.setColumn("collection_id", coll.getID());
259 259  
  260 +
  261 + //Adicionado como na versao 3.2
  262 + //Problema - Tem de se adicionar no dspace.cfg estes valores entre aspas
  263 + /*boolean multiple_files = ConfigurationManager.getBooleanProperty("deposit.default.multiple_files",false);
  264 + boolean multiple_titles = ConfigurationManager.getBooleanProperty("deposit.default.multiple_titles",false);
  265 + boolean published_before = ConfigurationManager.getBooleanProperty("deposit.default.published_before",false);
  266 +
  267 + row.setColumn("multiple_files",multiple_files);
  268 + row.setColumn("multiple_titles",multiple_titles);
  269 + row.setColumn("published_before",published_before);*/
  270 +
260 271 log.info(LogManager.getHeader(c, "create_workspace_item",
261 272 "workspace_item_id=" + row.getIntColumn("workspace_item_id")
262 273 + "item_id=" + i.getID() + "collection_id="
... ... @@ -273,12 +284,12 @@ public class WorkspaceItem implements InProgressSubmission
273 284 * Get all workspace items for a particular e-person. These are ordered by
274 285 * workspace item ID, since this should likely keep them in the order in
275 286 * which they were created.
276   - *
  287 + *
277 288 * @param context
278 289 * the context object
279 290 * @param ep
280 291 * the eperson
281   - *
  292 + *
282 293 * @return the corresponding workspace items
283 294 */
284 295 public static WorkspaceItem[] findByEPerson(Context context, EPerson ep)
... ... @@ -290,7 +301,7 @@ public class WorkspaceItem implements InProgressSubmission
290 301 "SELECT workspaceitem.* FROM workspaceitem, item WHERE " +
291 302 "workspaceitem.item_id=item.item_id AND " +
292 303 "item.submitter_id= ? " +
293   - "ORDER BY workspaceitem.workspace_item_id",
  304 + "ORDER BY workspaceitem.workspace_item_id",
294 305 ep.getID());
295 306  
296 307 try
... ... @@ -325,12 +336,12 @@ public class WorkspaceItem implements InProgressSubmission
325 336  
326 337 /**
327 338 * Get all workspace items for a particular collection.
328   - *
  339 + *
329 340 * @param context
330 341 * the context object
331 342 * @param c
332 343 * the collection
333   - *
  344 + *
334 345 * @return the corresponding workspace items
335 346 */
336 347 public static WorkspaceItem[] findByCollection(Context context, Collection c)
... ... @@ -445,13 +456,13 @@ public class WorkspaceItem implements InProgressSubmission
445 456 tri.close();
446 457 }
447 458 }
448   -
  459 +
449 460 return wsItems.toArray(new WorkspaceItem[wsItems.size()]);
450 461 }
451   -
  462 +
452 463 /**
453 464 * Get the internal ID of this workspace item
454   - *
  465 + *
455 466 * @return the internal identifier
456 467 */
457 468 public int getID()
... ... @@ -461,7 +472,7 @@ public class WorkspaceItem implements InProgressSubmission
461 472  
462 473 /**
463 474 * Get the value of the stage reached column
464   - *
  475 + *
465 476 * @return the value of the stage reached column
466 477 */
467 478 public int getStageReached()
... ... @@ -471,7 +482,7 @@ public class WorkspaceItem implements InProgressSubmission
471 482  
472 483 /**
473 484 * Set the value of the stage reached column
474   - *
  485 + *
475 486 * @param v
476 487 * the value of the stage reached column
477 488 */
... ... @@ -483,7 +494,7 @@ public class WorkspaceItem implements InProgressSubmission
483 494 /**
484 495 * Get the value of the page reached column (which represents the page
485 496 * reached within a stage/step)
486   - *
  497 + *
487 498 * @return the value of the page reached column
488 499 */
489 500 public int getPageReached()
... ... @@ -494,7 +505,7 @@ public class WorkspaceItem implements InProgressSubmission
494 505 /**
495 506 * Set the value of the page reached column (which represents the page
496 507 * reached within a stage/step)
497   - *
  508 + *
498 509 * @param v
499 510 * the value of the page reached column
500 511 */
... ... @@ -596,10 +607,10 @@ public class WorkspaceItem implements InProgressSubmission
596 607  
597 608 private void deleteEpersonGroup2WorkspaceItem() throws SQLException
598 609 {
599   -
  610 +
600 611 String removeSQL="DELETE FROM epersongroup2workspaceitem WHERE workspace_item_id = ?";
601 612 DatabaseManager.updateQuery(ourContext, removeSQL,getID());
602   -
  613 +
603 614 }
604 615  
605 616 public void deleteWrapper() throws SQLException, AuthorizeException,
... ...
dspace-api/src/main/java/org/dspace/content/authority/OpenAIREAuthority.java
... ... @@ -0,0 +1,189 @@
  1 +/*
  2 + * DCInputAuthority.java
  3 + *
  4 + * Version: $Revision: 1.1 $
  5 + *
  6 + * Date: $Date: 2009/07/23 05:07:01 $
  7 + *
  8 + * Copyright (c) 2002-2009, The DSpace Foundation. All rights reserved.
  9 + *
  10 + * Redistribution and use in source and binary forms, with or without
  11 + * modification, are permitted provided that the following conditions are
  12 + * met:
  13 + *
  14 + * - Redistributions of source code must retain the above copyright
  15 + * notice, this list of conditions and the following disclaimer.
  16 + *
  17 + * - Redistributions in binary form must reproduce the above copyright
  18 + * notice, this list of conditions and the following disclaimer in the
  19 + * documentation and/or other materials provided with the distribution.
  20 + *
  21 + * - Neither the name of the DSpace Foundation nor the names of its
  22 + * contributors may be used to endorse or promote products derived from
  23 + * this software without specific prior written permission.
  24 + *
  25 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  26 + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  27 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  28 + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  29 + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  30 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  31 + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  32 + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  33 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  34 + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  35 + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  36 + * DAMAGE.
  37 + */
  38 +package org.dspace.content.authority;
  39 +
  40 +import java.io.File;
  41 +import java.util.ArrayList;
  42 +import java.util.List;
  43 +
  44 +import javax.xml.parsers.DocumentBuilder;
  45 +import javax.xml.parsers.DocumentBuilderFactory;
  46 +
  47 +import org.apache.log4j.Logger;
  48 +import org.dspace.core.ConfigurationManager;
  49 +import org.w3c.dom.Document;
  50 +import org.w3c.dom.Element;
  51 +import org.w3c.dom.Node;
  52 +import org.w3c.dom.NodeList;
  53 +
  54 +/**
  55 + * ChoiceAuthority source that reads the same input-forms which drive
  56 + * configurable submission.
  57 + *
  58 + * Configuration:
  59 + * This MUST be configured aas a self-named plugin, e.g.:
  60 + * plugin.selfnamed.org.dspace.content.authority.ChoiceAuthority = \
  61 + * org.dspace.content.authority.DCInputAuthority
  62 + *
  63 + * It AUTOMATICALLY configures a plugin instance for each <value-pairs>
  64 + * element (within <form-value-pairs>) of the input-forms.xml. The name
  65 + * of the instance is the "value-pairs-name" attribute, e.g.
  66 + * the element: <value-pairs value-pairs-name="common_types" dc-term="type">
  67 + * defines a plugin instance "common_types".
  68 + *
  69 + * IMPORTANT NOTE: Since these value-pairs do NOT include authority keys,
  70 + * the choice lists derived from them do not include authority values.
  71 + * So you should not use them as the choice source for authority-controlled
  72 + * fields.
  73 + */
  74 +public class OpenAIREAuthority implements ChoiceAuthority
  75 +{
  76 + static {
  77 + try {
  78 + load();
  79 + } catch (Exception ex) {
  80 + OpenAIREAuthority.log.error("Error",ex);
  81 + OpenAIREAuthority.pairs = new ArrayList<Pair<String,String>>();
  82 + }
  83 + }
  84 +
  85 + private static Logger log = Logger.getLogger(OpenAIREAuthority.class);
  86 + private static final String FileProperty = "openaire.projects.filename";
  87 + private static final String MinimumChars = "openaire.projects.suggest.minchar";
  88 + private static final String MaxSuggests = "openaire.projects.suggest.max";
  89 + private static final int MaxSuggestionLength = 66;
  90 +
  91 +
  92 + private static List<Pair<String, String>> pairs = null;
  93 +
  94 + /**
  95 + * Loads the data, parsing the file defined at the 'openaire.projects.filename' dspace
  96 + * property.
  97 + */
  98 + @SuppressWarnings("unused")
  99 + private static void load () {
  100 + if (OpenAIREAuthority.pairs == null) {
  101 + OpenAIREAuthority.pairs = new ArrayList<Pair<String, String>>();
  102 + String defsFile = ConfigurationManager.getProperty(OpenAIREAuthority.FileProperty);
  103 + if (defsFile == null) OpenAIREAuthority.log.error("Configuration "+OpenAIREAuthority.FileProperty+" not found in dspace.cfg file.");
  104 + else {
  105 + try {
  106 + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  107 + DocumentBuilder builder = factory.newDocumentBuilder();
  108 + Document doc = builder.parse(new File(defsFile));
  109 + doc.getDocumentElement().normalize();
  110 +
  111 + NodeList nodes = doc.getElementsByTagName("pair");
  112 + for (int i = 0; i < nodes.getLength(); i++) {
  113 + Node node = nodes.item(i);
  114 + if (node.getNodeType() == Node.ELEMENT_NODE) {
  115 + // OK!
  116 + Element element = (Element) node;
  117 + Pair<String, String> pair = new Pair<String, String>();
  118 + pair.fst = element.getElementsByTagName("displayed-value").item(0).getFirstChild().getNodeValue();
  119 + pair.snd = element.getElementsByTagName("stored-value").item(0).getFirstChild().getNodeValue();
  120 + OpenAIREAuthority.pairs.add(pair);
  121 + } else
  122 + throw new Exception("Invalid Node readed");
  123 + }
  124 + } catch (Exception e) {
  125 + OpenAIREAuthority.log.error("Unable to parse file "+defsFile, e);
  126 + }
  127 + }
  128 + }
  129 + }
  130 +
  131 + private String getPrettyChoiceText (String text) {
  132 + if (text.length() > OpenAIREAuthority.MaxSuggestionLength) {
  133 + return text.substring(0, OpenAIREAuthority.MaxSuggestionLength - 3) + "...";
  134 + } else return text;
  135 + }
  136 +
  137 + public Choices getMatches(String field, String text, int collection, int start,
  138 + int limit, String locale) {
  139 + OpenAIREAuthority.load();
  140 + int minChars = ConfigurationManager.getIntProperty(OpenAIREAuthority.MinimumChars, 4);
  141 + int maxSuggests = ConfigurationManager.getIntProperty(OpenAIREAuthority.MaxSuggests, 10);
  142 +
  143 + List<Choice> result = new ArrayList<Choice>();
  144 + int dflt = -1;
  145 + int type = Choices.CF_NOTFOUND;
  146 + int added = 0;
  147 + if (text != null && text.length() >= minChars) {
  148 + for (int i = 0; i < OpenAIREAuthority.pairs.size() && added < maxSuggests; ++i)
  149 + {
  150 + if (OpenAIREAuthority.pairs.get(i).fst.toLowerCase().contains(text.toLowerCase()))
  151 + {
  152 + Choice cs = new Choice(String.valueOf(i), OpenAIREAuthority.pairs.get(i).snd, this.getPrettyChoiceText(OpenAIREAuthority.pairs.get(i).fst));
  153 + result.add(cs);
  154 + added++;
  155 + if (OpenAIREAuthority.pairs.get(i).fst.equalsIgnoreCase(text))
  156 + dflt = i;
  157 + }
  158 + }
  159 + if (added > 0) type = Choices.CF_AMBIGUOUS;
  160 + else type = Choices.CF_NOTFOUND;
  161 + }
  162 + return new Choices(result.toArray(new Choice[] {}), 0, result.size(), type, false, dflt);
  163 + }
  164 +
  165 + public Choices getBestMatch(String field, String text, int collection, String locale) {
  166 + OpenAIREAuthority.load();
  167 + for (int i = 0; i < OpenAIREAuthority.pairs.size(); ++i)
  168 + {
  169 + if (OpenAIREAuthority.pairs.get(i).fst.toLowerCase().equals(text.toLowerCase()))
  170 + {
  171 + Choice v[] = new Choice[1];
  172 + v[0] = new Choice(String.valueOf(i), OpenAIREAuthority.pairs.get(i).snd, this.getPrettyChoiceText(OpenAIREAuthority.pairs.get(i).fst));
  173 + return new Choices(v, 0, v.length, Choices.CF_UNCERTAIN, false, 0);
  174 + }
  175 + }
  176 + return new Choices(Choices.CF_NOTFOUND);
  177 + }
  178 +
  179 + public String getLabel(String field, String key, String locale) {
  180 + OpenAIREAuthority.load();
  181 + return OpenAIREAuthority.pairs.get(Integer.parseInt(key)).fst;
  182 + }
  183 +
  184 +}
  185 +
  186 +class Pair<T, V> {
  187 + public T fst;
  188 + public V snd;
  189 +}
... ...
dspace-api/src/main/java/org/dspace/core/Email.java
... ... @@ -474,18 +474,8 @@ public class Email
474 474 System.out.println(" - To: " + to);
475 475 System.out.println(" - Subject: " + subject);
476 476 System.out.println(" - Server: " + server);
477   - boolean disabled = ConfigurationManager.getBooleanProperty("mail.server.disabled", false);
478 477 try
479 478 {
480   - if( disabled)
481   - {
482   - System.err.println("\nError sending email:");
483   - System.err.println(" - Error: cannot test email because mail.server.disabled is set to true");
484   - System.err.println("\nPlease see the DSpace documentation for assistance.\n");
485   - System.err.println("\n");
486   - System.exit(1);
487   - return;
488   - }
489 479 e.send();
490 480 }
491 481 catch (MessagingException me)
... ...
dspace-api/src/main/java/org/dspace/discovery/DiscoverQuery.java
... ... @@ -228,10 +228,10 @@ public class DiscoverQuery {
228 228 this.searchFields.add(field);
229 229 }
230 230  
231   - /**
232   - * Get list of fields which Discovery will return in the search results
233   - * @return List of field names
234   - */
  231 + /**
  232 + * Get list of fields which Discovery will return in the search results
  233 + * @return List of field names
  234 + */
235 235 public List<String> getSearchFields() {
236 236 return searchFields;
237 237 }
... ...
dspace-api/src/main/java/org/dspace/discovery/SearchService.java
... ... @@ -29,7 +29,7 @@ public interface SearchService {
29 29 * Convenient method to call @see #search(Context, DSpaceObject,
30 30 * DiscoverQuery) with a null DSpace Object as scope (i.e. all the
31 31 * repository)
32   - *
  32 + *
33 33 * @param context
34 34 * DSpace Context object.
35 35 * @param query
... ... @@ -42,7 +42,7 @@ public interface SearchService {
42 42 /**
43 43 * Convenient method to call @see #search(Context, DSpaceObject,
44 44 * DiscoverQuery, boolean) with includeWithdrawn=false
45   - *
  45 + *
46 46 * @param context
47 47 * DSpace Context object
48 48 * @param dso
... ... @@ -56,7 +56,7 @@ public interface SearchService {
56 56 throws SearchServiceException;
57 57  
58 58 /**
59   - *
  59 + *
60 60 * @param context
61 61 * DSpace Context object.
62 62 * @param query
... ... @@ -70,7 +70,7 @@ public interface SearchService {
70 70 boolean includeWithdrawn) throws SearchServiceException;
71 71  
72 72 /**
73   - *
  73 + *
74 74 * @param context
75 75 * DSpace Context object
76 76 * @param dso
... ... @@ -81,12 +81,12 @@ public interface SearchService {
81 81 * @param includeWithdrawn
82 82 * use <code>true</code> to include in the results also withdrawn
83 83 * items that match the query
84   - *
  84 + *
85 85 * @throws SearchServiceException
86 86 */
87 87 DiscoverResult search(Context context, DSpaceObject dso, DiscoverQuery query, boolean includeWithdrawn) throws SearchServiceException;
88 88  
89   -
  89 +
90 90 InputStream searchJSON(Context context, DiscoverQuery query, String jsonIdentifier) throws SearchServiceException;
91 91  
92 92 InputStream searchJSON(Context context, DiscoverQuery query, DSpaceObject dso, String jsonIdentifier) throws SearchServiceException;
... ... @@ -114,10 +114,10 @@ public interface SearchService {
114 114 */
115 115 String toSortFieldIndex(String metadataField, String type);
116 116  
117   - /**
118   - * Utility method to escape any special characters in a user's query
119   - * @param query
120   - * @return query with any special characters escaped
121   - */
  117 + /**
  118 + * Utility method to escape any special characters in a user's query
  119 + * @param query
  120 + * @return query with any special characters escaped
  121 + */
122 122 String escapeQueryChars(String query);
123 123 }
... ...
dspace-api/src/main/java/org/dspace/discovery/SolrServiceImpl.java
... ... @@ -154,9 +154,12 @@ public class SolrServiceImpl implements SearchService, IndexingService {
154 154 solr.setUseMultiPartPost(true);
155 155 // Dummy/test query to search for Item (type=2) of ID=1
156 156 SolrQuery solrQuery = new SolrQuery()
  157 + //.setQuery("search.resourcetype:2 AND search.resourceid:1");
157 158 .setQuery(RESOURCE_TYPE_FIELD + ":2 AND " + RESOURCE_ID_FIELD + ":1");
158 159 // Only return obj identifier fields in result doc
159 160 solrQuery.setFields(RESOURCE_TYPE_FIELD, RESOURCE_ID_FIELD);
  161 +
  162 +
160 163 solr.query(solrQuery);
161 164  
162 165 // As long as Solr initialized, check with DatabaseUtils to see
... ... @@ -328,6 +331,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
328 331  
329 332 try {
330 333 if(getSolr() != null){
  334 + //getSolr().deleteByQuery("handle:\"" + handle + "\"");
331 335 getSolr().deleteByQuery(HANDLE_FIELD + ":\"" + handle + "\"");
332 336 if(commit)
333 337 {
... ... @@ -467,10 +471,12 @@ public class SolrServiceImpl implements SearchService, IndexingService {
467 471 }
468 472 if (force)
469 473 {
  474 + //getSolr().deleteByQuery("search.resourcetype:[2 TO 4]");
470 475 getSolr().deleteByQuery(RESOURCE_TYPE_FIELD + ":[2 TO 4]");
471 476 } else {
472 477 SolrQuery query = new SolrQuery();
473   - // Query for all indexed Items, Collections and Communities,
  478 + //query.setQuery("search.resourcetype:[2 TO 4]");
  479 + // Query for all indexed Items, Collections and Communities,
474 480 // returning just their handle
475 481 query.setFields(HANDLE_FIELD);
476 482 query.setQuery(RESOURCE_TYPE_FIELD + ":[2 TO 4]");
... ... @@ -483,6 +489,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
483 489  
484 490 SolrDocument doc = (SolrDocument) iter.next();
485 491  
  492 + //String handle = (String) doc.getFieldValue("handle");
486 493 String handle = (String) doc.getFieldValue(HANDLE_FIELD);
487 494  
488 495 DSpaceObject o = HandleManager.resolveToObject(context, handle);
... ... @@ -624,8 +631,9 @@ public class SolrServiceImpl implements SearchService, IndexingService {
624 631 boolean inIndex = false;
625 632  
626 633 SolrQuery query = new SolrQuery();
  634 + //query.setQuery("handle:" + handle);
627 635 query.setQuery(HANDLE_FIELD + ":" + handle);
628   - // Specify that we ONLY want the LAST_INDEXED_FIELD returned in the field list (fl)
  636 + // Specify that we ONLY want the LAST_INDEXED_FIELD returned in the field list (fl)
629 637 query.setFields(LAST_INDEXED_FIELD);
630 638 QueryResponse rsp;
631 639  
... ... @@ -1451,11 +1459,14 @@ public class SolrServiceImpl implements SearchService, IndexingService {
1451 1459 // (not tokenized, but it is indexed)
1452 1460 doc.addField(LAST_INDEXED_FIELD, new Date());
1453 1461  
  1462 +
1454 1463 // New fields to weaken the dependence on handles, and allow for faster
1455 1464 // list display
1456 1465 doc.addField("search.uniqueid", type+"-"+id);
  1466 + //doc.addField("search.resourcetype", Integer.toString(type));
1457 1467 doc.addField(RESOURCE_TYPE_FIELD, Integer.toString(type));
1458 1468  
  1469 + //doc.addField("search.resourceid", Integer.toString(id));
1459 1470 doc.addField(RESOURCE_ID_FIELD, Integer.toString(id));
1460 1471  
1461 1472 // want to be able to search for handle, so use keyword
... ... @@ -1464,6 +1475,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
1464 1475 {
1465 1476 // want to be able to search for handle, so use keyword
1466 1477 // (not tokenized, but it is indexed)
  1478 + //doc.addField("handle", handle);
1467 1479 doc.addField(HANDLE_FIELD, handle);
1468 1480 }
1469 1481  
... ... @@ -1594,7 +1606,8 @@ public class SolrServiceImpl implements SearchService, IndexingService {
1594 1606 discoveryQuery.addFilterQueries("location:l" + dso.getID());
1595 1607 } else if (dso instanceof Item)
1596 1608 {
1597   - discoveryQuery.addFilterQueries(HANDLE_FIELD + ":" + dso.getHandle());
  1609 + //discoveryQuery.addFilterQueries("handle:" + dso.getHandle());