Skip to content
Snippets Groups Projects
Commit 9b69461b authored by cramakri's avatar cramakri
Browse files

BIS-67 SP-105 : Make ShareId more robust by checking with the AS if a data set is not found

SVN: 28649
parent 83e929b0
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,8 @@ import ch.systemsx.cisd.common.logging.LogFactory; ...@@ -34,6 +34,8 @@ import ch.systemsx.cisd.common.logging.LogFactory;
import ch.systemsx.cisd.openbis.dss.generic.shared.Constants; import ch.systemsx.cisd.openbis.dss.generic.shared.Constants;
import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService; import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService;
import ch.systemsx.cisd.openbis.dss.generic.shared.IShareIdManager; import ch.systemsx.cisd.openbis.dss.generic.shared.IShareIdManager;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AbstractExternalData;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PhysicalDataSet;
import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetShareId; import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetShareId;
/** /**
...@@ -317,6 +319,13 @@ public class ShareIdManager implements IShareIdManager ...@@ -317,6 +319,13 @@ public class ShareIdManager implements IShareIdManager
GuardedShareID shareId = getDataSetCodeToShareIdMap().get(dataSetCode); GuardedShareID shareId = getDataSetCodeToShareIdMap().get(dataSetCode);
if (shareId == null) if (shareId == null)
{ {
updateValueForDataSet(dataSetCode);
shareId = getDataSetCodeToShareIdMap().get(dataSetCode);
}
if (shareId == null)
{
throw new IllegalArgumentException("Unknown data set: " + dataSetCode); throw new IllegalArgumentException("Unknown data set: " + dataSetCode);
} }
return shareId; return shareId;
...@@ -343,4 +352,17 @@ public class ShareIdManager implements IShareIdManager ...@@ -343,4 +352,17 @@ public class ShareIdManager implements IShareIdManager
} }
} }
private void updateValueForDataSet(String dataSetCode)
{
// We assume that the dataSetCodeToShareIdMap is already initialized -- otherwise we
// wouldn't be here.
AbstractExternalData abstractDataSet = service.tryGetDataSet(dataSetCode);
if (null == abstractDataSet || false == abstractDataSet instanceof PhysicalDataSet)
{
return;
}
PhysicalDataSet dataSet = (PhysicalDataSet) abstractDataSet;
String shareId = dataSet.getShareId();
addShareId(dataSetCodeToShareIdMap, dataSetCode, shareId);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment