Skip to content
Snippets Groups Projects
Commit 20565a41 authored by cramakri's avatar cramakri
Browse files

MINOR: Refactored and extracted shared code.

SVN: 16271
parent fcd437f2
No related merge requests found
/*
* Copyright 2010 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.systemsx.cisd.openbis.dss.generic.shared.api.v1;
import static ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants.DATA_STORE_SERVER_WEB_APPLICATION_NAME;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStore;
/**
* @author Chandrasekhar Ramakrishnan
*/
public class DataStoreApiUrlUtilities
{
/**
* Converts the download url to a server url.
*/
public static String getDataStoreUrlFromDataStore(DataStore dataStore)
{
String datastoreUrl = dataStore.getDownloadUrl();
System.out.println("Data store url : " + datastoreUrl);
// The url objained form a DataStore object is the *download* url. Convert this to the
// datastore URL
if (datastoreUrl.endsWith(DATA_STORE_SERVER_WEB_APPLICATION_NAME))
{
datastoreUrl =
datastoreUrl.substring(0, datastoreUrl.length()
- DATA_STORE_SERVER_WEB_APPLICATION_NAME.length());
}
if (datastoreUrl.endsWith("/"))
{
datastoreUrl = datastoreUrl.substring(0, datastoreUrl.length() - 1);
}
return datastoreUrl;
}
}
package ch.systemsx.cisd.openbis.plugin.screening.server.logic; package ch.systemsx.cisd.openbis.plugin.screening.server.logic;
import static ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants.DATA_STORE_SERVER_WEB_APPLICATION_NAME;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.common.exceptions.UserFailureException;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.DataStoreApiUrlUtilities;
import ch.systemsx.cisd.openbis.generic.server.business.bo.datasetlister.IDatasetLister; import ch.systemsx.cisd.openbis.generic.server.business.bo.datasetlister.IDatasetLister;
import ch.systemsx.cisd.openbis.generic.server.business.bo.samplelister.ISampleLister; import ch.systemsx.cisd.openbis.generic.server.business.bo.samplelister.ISampleLister;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStore; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStore;
...@@ -230,21 +229,7 @@ class PlateDatasetLoader ...@@ -230,21 +229,7 @@ class PlateDatasetLoader
protected String getDataStoreUrlFromDataStore(DataStore dataStore) protected String getDataStoreUrlFromDataStore(DataStore dataStore)
{ {
String datastoreUrl = dataStore.getDownloadUrl(); return DataStoreApiUrlUtilities.getDataStoreUrlFromDataStore(dataStore);
// The url objained form a DataStore object is the *download* url. Convert this to the
// datastore URL
if (datastoreUrl.endsWith(DATA_STORE_SERVER_WEB_APPLICATION_NAME))
{
datastoreUrl =
datastoreUrl.substring(0, datastoreUrl.length()
- DATA_STORE_SERVER_WEB_APPLICATION_NAME.length());
}
if (datastoreUrl.endsWith("/"))
{
datastoreUrl = datastoreUrl.substring(0, datastoreUrl.length() - 1);
}
return datastoreUrl;
} }
protected static SampleIdentifier createSampleIdentifier(PlateIdentifier plate) protected static SampleIdentifier createSampleIdentifier(PlateIdentifier plate)
......
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