@@ -51,32 +51,6 @@ public class SolrIndexServiceBean {
5151 public static String numRowsClearedByClearAllIndexTimes = "numRowsClearedByClearAllIndexTimes" ;
5252 public static String messageString = "message" ;
5353
54- /**
55- * @deprecated Now that MyData has shipped in 4.1 we have no plans to change
56- * the unpublishedDataRelatedToMeModeEnabled boolean to false. We should
57- * probably remove the boolean altogether to simplify the code.
58- *
59- * This non-default mode changes the behavior of the "Data Related To Me"
60- * feature to be more like "**Unpublished** Data Related to Me" after you
61- * have changed this boolean to true and run "index all".
62- *
63- * The "Data Related to Me" feature relies on *always* indexing permissions
64- * regardless of if the DvObject is published or not.
65- *
66- * In "Unpublished Data Related to Me" mode, we first check if the DvObject
67- * is published. If it's published, we set the search permissions to *only*
68- * contain "group_public", which is quick and cheap to do. If the DvObject
69- * in question is *not* public, we perform the expensive operation of
70- * rooting around in the system to determine who should be able to
71- * "discover" the unpublished version of DvObject. By default this mode is
72- * *not* enabled. If you want to enable it, change the boolean to true and
73- * run "index all".
74- *
75- * See also https://github.com/IQSS/dataverse/issues/50
76- */
77- @ Deprecated
78- private final boolean unpublishedDataRelatedToMeModeEnabled = true ;
79-
8054 public List <DvObjectSolrDoc > determineSolrDocs (DvObject dvObject ) {
8155 List <DvObjectSolrDoc > emptyList = new ArrayList <>();
8256 if (dvObject == null ) {
@@ -123,12 +97,8 @@ private List<DvObjectSolrDoc> determineSolrDocsForFilesFromDataset(Map.Entry<Lon
12397 */
12498 private DvObjectSolrDoc constructDataverseSolrDoc (Dataverse dataverse ) {
12599 List <String > perms = new ArrayList <>();
126- if (unpublishedDataRelatedToMeModeEnabled ) {
127- if (dataverse .isReleased ()) {
128- perms .add (IndexServiceBean .getPublicGroupString ());
129- } else {
130- perms = searchPermissionsService .findDataversePerms (dataverse );
131- }
100+ if (dataverse .isReleased ()) {
101+ perms .add (IndexServiceBean .getPublicGroupString ());
132102 } else {
133103 perms = searchPermissionsService .findDataversePerms (dataverse );
134104 }
@@ -175,24 +145,19 @@ private List<DvObjectSolrDoc> constructDatafileSolrDocs(DataFile dataFile, Map<L
175145 String solrId = solrIdStart + solrIdEnd ;
176146 List <String > perms = new ArrayList <>();
177147
178- if (unpublishedDataRelatedToMeModeEnabled ) {
179- List <String > cachedPerms = null ;
180- if (permStringByDatasetVersion != null ) {
181- cachedPerms = permStringByDatasetVersion .get (datasetVersionFileIsAttachedTo .getId ());
182- }
183- if (cachedPerms != null ) {
184- logger .finest ("reusing cached perms for file " + dataFile .getId ());
185- perms = cachedPerms ;
186- } else if (datasetVersionFileIsAttachedTo .isReleased ()) {
187- logger .finest ("no cached perms, file is public/discoverable/searchable for file " + dataFile .getId ());
188- perms .add (IndexServiceBean .getPublicGroupString ());
189- } else {
190- // go to the well (slow)
191- logger .finest ("no cached perms, file is not public, finding perms for file " + dataFile .getId ());
192- perms = searchPermissionsService .findDatasetVersionPerms (datasetVersionFileIsAttachedTo );
193- }
148+ List <String > cachedPerms = null ;
149+ if (permStringByDatasetVersion != null ) {
150+ cachedPerms = permStringByDatasetVersion .get (datasetVersionFileIsAttachedTo .getId ());
151+ }
152+ if (cachedPerms != null ) {
153+ logger .finest ("reusing cached perms for file " + dataFile .getId ());
154+ perms = cachedPerms ;
155+ } else if (datasetVersionFileIsAttachedTo .isReleased ()) {
156+ logger .finest ("no cached perms, file is public/discoverable/searchable for file " + dataFile .getId ());
157+ perms .add (IndexServiceBean .getPublicGroupString ());
194158 } else {
195- // This should never be executed per the deprecation notice on the boolean.
159+ // go to the well (slow)
160+ logger .finest ("no cached perms, file is not public, finding perms for file " + dataFile .getId ());
196161 perms = searchPermissionsService .findDatasetVersionPerms (datasetVersionFileIsAttachedTo );
197162 }
198163 DvObjectSolrDoc dataFileSolrDoc = new DvObjectSolrDoc (dataFile .getId ().toString (), solrId , datasetVersionFileIsAttachedTo .getId (), dataFile .getDisplayName (), perms , ftperms );
@@ -210,12 +175,8 @@ private List<DvObjectSolrDoc> constructDatafileSolrDocsFromDataset(Dataset datas
210175 boolean cardShouldExist = desiredCards .get (datasetVersionFileIsAttachedTo .getVersionState ());
211176 if (cardShouldExist ) {
212177 List <String > perms = new ArrayList <>();
213- if (unpublishedDataRelatedToMeModeEnabled ) {
214- if (datasetVersionFileIsAttachedTo .isReleased ()) {
215- perms .add (IndexServiceBean .getPublicGroupString ());
216- } else {
217- perms = searchPermissionsService .findDatasetVersionPerms (datasetVersionFileIsAttachedTo );
218- }
178+ if (datasetVersionFileIsAttachedTo .isReleased ()) {
179+ perms .add (IndexServiceBean .getPublicGroupString ());
219180 } else {
220181 perms = searchPermissionsService .findDatasetVersionPerms (datasetVersionFileIsAttachedTo );
221182 }
@@ -257,12 +218,8 @@ private DvObjectSolrDoc makeDatasetSolrDoc(DatasetVersion version) {
257218 String solrId = solrIdStart + solrIdEnd ;
258219 String name = version .getTitle ();
259220 List <String > perms = new ArrayList <>();
260- if (unpublishedDataRelatedToMeModeEnabled ) {
261- if (version .isReleased ()) {
262- perms .add (IndexServiceBean .getPublicGroupString ());
263- } else {
264- perms = searchPermissionsService .findDatasetVersionPerms (version );
265- }
221+ if (version .isReleased ()) {
222+ perms .add (IndexServiceBean .getPublicGroupString ());
266223 } else {
267224 perms = searchPermissionsService .findDatasetVersionPerms (version );
268225 }
0 commit comments