From 3885fb1a0bbc427b850ad095935a49957082df69 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Tue, 15 Feb 2011 12:56:48 +0000
Subject: [PATCH] LMS-2040 DTO builder framework extended

SVN: 19975
---
 .../basic/dto/builders/DataSetBuilder.java    |  7 +++
 .../basic/dto/builders/DataStoreBuilder.java  | 52 +++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/DataStoreBuilder.java

diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/DataSetBuilder.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/DataSetBuilder.java
index ac6d7e32068..186d8f4a392 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/DataSetBuilder.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/DataSetBuilder.java
@@ -19,6 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto.builders;
 import java.util.ArrayList;
 
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStore;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty;
@@ -75,6 +76,12 @@ public class DataSetBuilder
         return this;
     }
     
+    public DataSetBuilder store(DataStore dataStore)
+    {
+        dataSet.setDataStore(dataStore);
+        return this;
+    }
+    
     public final ExternalData getDataSet()
     {
         return dataSet;
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/DataStoreBuilder.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/DataStoreBuilder.java
new file mode 100644
index 00000000000..4c0c9eb24a2
--- /dev/null
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/DataStoreBuilder.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2011 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.generic.shared.basic.dto.builders;
+
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStore;
+
+/**
+ * Builder class for creating an instance of {@link DataStore}.
+ *
+ * @author Franz-Josef Elmer
+ */
+public class DataStoreBuilder
+{
+    private DataStore store = new DataStore();
+    
+    public DataStoreBuilder(String dataStoreCode)
+    {
+        store.setCode(dataStoreCode);
+    }
+    
+    public DataStoreBuilder hostUrl(String hostUrl)
+    {
+        store.setHostUrl(hostUrl);
+        return this;
+    }
+
+    public DataStoreBuilder downloadUrl(String downloadUrl)
+    {
+        store.setDownloadUrl(downloadUrl);
+        return this;
+    }
+    
+    public DataStore getStore()
+    {
+        return store;
+    }
+    
+}
-- 
GitLab