From 33c7cebff78d36f6d8e97f13a67d1a6ce988ad19 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Tue, 15 Dec 2015 13:45:10 +0000
Subject: [PATCH] SSDM-2718: API extension for generic services. No
 implementations yet.

SVN: 35333
---
 .../server/api/v3/ApplicationServerApi.java   |  24 ++++
 .../api/v3/ApplicationServerApiLogger.java    |  18 +++
 .../method/IServiceMethodsExecutor.java       |  38 +++++++
 .../method/ServiceMethodsExecutor.java        |  65 +++++++++++
 .../api/v3/helper/generators/Generator.java   |  14 +++
 .../as/api/v3/IApplicationServerApi.java      |   8 ++
 .../generic/as/api/v3/IServiceExecutor.java   |  32 ++++++
 .../as/api/v3/dto/service/Service.java        | 106 ++++++++++++++++++
 .../fetchoptions/ServiceFetchOptions.java     |  52 +++++++++
 .../fetchoptions/ServiceSortOptions.java      |  32 ++++++
 .../as/api/v3/dto/service/id/IServiceId.java  |  31 +++++
 .../api/v3/dto/service/id/ServicePermId.java  |  44 ++++++++
 12 files changed, 464 insertions(+)
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IServiceMethodsExecutor.java
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/ServiceMethodsExecutor.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/IServiceExecutor.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/Service.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/fetchoptions/ServiceFetchOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/fetchoptions/ServiceSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/id/IServiceId.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/id/ServicePermId.java

diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApi.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApi.java
index e49844486bf..dbd32afcd49 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApi.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApi.java
@@ -16,6 +16,7 @@
 
 package ch.ethz.sis.openbis.generic.server.api.v3;
 
+import java.io.Serializable;
 import java.util.List;
 import java.util.Map;
 
@@ -68,6 +69,9 @@ import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.ISampleId;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.SamplePermId;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.search.SampleSearchCriteria;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.update.SampleUpdate;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions.ServiceFetchOptions;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.space.Space;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.space.create.SpaceCreation;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.space.delete.SpaceDeletionOptions;
@@ -103,6 +107,7 @@ import ch.ethz.sis.openbis.generic.server.api.v3.executor.method.ISearchMaterial
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.method.ISearchProjectMethodExecutor;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.method.ISearchSampleMethodExecutor;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.method.ISearchSpaceMethodExecutor;
+import ch.ethz.sis.openbis.generic.server.api.v3.executor.method.IServiceMethodsExecutor;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.method.IUpdateDataSetMethodExecutor;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.method.IUpdateExperimentMethodExecutor;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.method.IUpdateMaterialMethodExecutor;
@@ -236,6 +241,9 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
 
     @Autowired
     private IConfirmDeletionMethodExecutor confirmDeletionExecutor;
+    
+    @Autowired
+    private IServiceMethodsExecutor serviceMethodsExecutor; 
 
     // Default constructor needed by Spring
     public ApplicationServerApi()
@@ -578,6 +586,22 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
         confirmDeletionExecutor.confirm(sessionToken, deletionIds);
     }
 
+    @Override
+    @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER })
+    @Capability("LIST_SERVICES")
+    public List<Service> listServices(String sessionToken, ServiceFetchOptions fetchOptions)
+    {
+        return serviceMethodsExecutor.listServices(sessionToken, fetchOptions);
+    }
+
+    @Override
+    @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER })
+    @Capability("EXECUTE_SERVICE")
+    public Serializable executeService(String sessionToken, IServiceId serviceId, Map<String, String> parameters)
+    {
+        return serviceMethodsExecutor.executeService(sessionToken, serviceId, parameters);
+    }
+
     @Override
     public IApplicationServerApi createLogger(IInvocationLoggerContext context)
     {
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApiLogger.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApiLogger.java
index 89a3d9f669d..64ac8f70265 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApiLogger.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApiLogger.java
@@ -16,6 +16,7 @@
 
 package ch.ethz.sis.openbis.generic.server.api.v3;
 
+import java.io.Serializable;
 import java.util.List;
 import java.util.Map;
 
@@ -64,6 +65,9 @@ import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.ISampleId;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.SamplePermId;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.search.SampleSearchCriteria;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.update.SampleUpdate;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions.ServiceFetchOptions;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.space.Space;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.space.create.SpaceCreation;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.space.delete.SpaceDeletionOptions;
@@ -336,4 +340,18 @@ public class ApplicationServerApiLogger extends AbstractServerLogger implements
         logAccess(sessionToken, "confirm-deletions", "DELETION_IDS(%s)", abbreviate(deletionIds));
     }
 
+    @Override
+    public List<Service> listServices(String sessionToken, ServiceFetchOptions fetchOptions)
+    {
+        logAccess(sessionToken, "list-services", "FETCH_OPTIONS(%s)", fetchOptions);
+        return null;
+    }
+
+    @Override
+    public Serializable executeService(String sessionToken, IServiceId serviceId, Map<String, String> parameters)
+    {
+        logAccess(sessionToken, "execute-service", "SERVICE_ID(%s) PARAMETERS(%)", serviceId, parameters);
+        return null;
+    }
+
 }
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IServiceMethodsExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IServiceMethodsExecutor.java
new file mode 100644
index 00000000000..f2d5c228e3c
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IServiceMethodsExecutor.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.api.v3.executor.method;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions.ServiceFetchOptions;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public interface IServiceMethodsExecutor
+{
+    public List<Service> listServices(String sessionToken, ServiceFetchOptions fetchOptions);
+    
+    public Serializable executeService(String sessionToken, IServiceId serviceId, Map<String, String> parameters);
+
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/ServiceMethodsExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/ServiceMethodsExecutor.java
new file mode 100644
index 00000000000..a5489ca1f85
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/ServiceMethodsExecutor.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2015 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.api.v3.executor.method;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.annotation.Resource;
+
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.stereotype.Component;
+
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions.ServiceFetchOptions;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId;
+import ch.systemsx.cisd.common.spring.ExposablePropertyPlaceholderConfigurer;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+@Component
+public class ServiceMethodsExecutor extends AbstractMethodExecutor implements IServiceMethodsExecutor, InitializingBean
+{
+    @Resource(name = ExposablePropertyPlaceholderConfigurer.PROPERTY_CONFIGURER_BEAN_NAME)
+    protected ExposablePropertyPlaceholderConfigurer configurer;
+
+    @Override
+    public void afterPropertiesSet() throws Exception
+    {
+        Properties props = configurer == null ? new Properties() : configurer.getResolvedProps();
+    }
+    
+    @Override
+    public List<Service> listServices(String sessionToken, ServiceFetchOptions fetchOptions)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Serializable executeService(String sessionToken, IServiceId serviceId, Map<String, String> parameters)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/generators/Generator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/generators/Generator.java
index eed9a8a4bc8..eea05601572 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/generators/Generator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/generators/Generator.java
@@ -59,6 +59,7 @@ import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.fetchoptions.SampleFetch
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.fetchoptions.SampleTypeFetchOptions;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.SampleIdentifier;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.SamplePermId;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions.ServiceFetchOptions;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.space.fetchoptions.SpaceFetchOptions;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.space.id.SpacePermId;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.tag.fetchoptions.TagFetchOptions;
@@ -542,6 +543,18 @@ public class Generator extends AbstractGenerator
         return gen;
     }
 
+    private static DtoGenerator createServiceGenerator()
+    {
+        DtoGenerator gen = new DtoGenerator("service", "Service", ServiceFetchOptions.class);
+        addCode(gen);
+        gen.addStringField("label");
+        gen.addStringField("description");
+        
+        gen.setToStringMethod("\"Service code: \" + code");
+        
+        return gen;
+    }
+    
     public static void main(String[] args) throws FileNotFoundException
     {
         List<DtoGenerator> list = new LinkedList<DtoGenerator>();
@@ -569,6 +582,7 @@ public class Generator extends AbstractGenerator
         list.add(createDeletion());
         list.add(createDataStoreGenerator());
         list.add(createExternalDmsGenerator());
+        list.add(createServiceGenerator());
 
         for (DtoGenerator gen : list)
         {
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/IApplicationServerApi.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/IApplicationServerApi.java
index bad2e4c3dd7..9f54e83d141 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/IApplicationServerApi.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/IApplicationServerApi.java
@@ -16,6 +16,7 @@
 
 package ch.ethz.sis.openbis.generic.as.api.v3;
 
+import java.io.Serializable;
 import java.util.List;
 import java.util.Map;
 
@@ -63,6 +64,9 @@ import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.ISampleId;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.SamplePermId;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.search.SampleSearchCriteria;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.update.SampleUpdate;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions.ServiceFetchOptions;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.space.Space;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.space.create.SpaceCreation;
 import ch.ethz.sis.openbis.generic.as.api.v3.dto.space.delete.SpaceDeletionOptions;
@@ -165,5 +169,9 @@ public interface IApplicationServerApi extends IRpcService
     public void revertDeletions(String sessionToken, List<? extends IDeletionId> deletionIds);
 
     public void confirmDeletions(String sessionToken, List<? extends IDeletionId> deletionIds);
+    
+    public List<Service> listServices(String sessionToken, ServiceFetchOptions fetchOptions);
+    
+    public Serializable executeService(String sessionToken, IServiceId serviceId, Map<String, String> parameters);
 
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/IServiceExecutor.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/IServiceExecutor.java
new file mode 100644
index 00000000000..1f0f0bd36f2
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/IServiceExecutor.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2015 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.as.api.v3;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service;
+
+/**
+ * Executor of a {@link Service}.
+ *
+ * @author Franz-Josef Elmer
+ */
+public interface IServiceExecutor
+{
+    public Serializable executeService(Map<String, String> parameters);
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/Service.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/Service.java
new file mode 100644
index 00000000000..7da8d84ebb2
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/Service.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2014 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.ethz.sis.openbis.generic.as.api.v3.dto.service;
+
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.common.interfaces.ICodeHolder;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions.ServiceFetchOptions;
+import ch.ethz.sis.openbis.generic.as.api.v3.exceptions.NotFetchedException;
+import ch.systemsx.cisd.base.annotation.JsonObject;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+
+/*
+ * Class automatically generated with DtoGenerator
+ */
+@JsonObject("dto.service.Service")
+public class Service implements Serializable, ICodeHolder
+{
+    private static final long serialVersionUID = 1L;
+
+    @JsonProperty
+    private ServiceFetchOptions fetchOptions;
+
+    @JsonProperty
+    private String code;
+
+    @JsonProperty
+    private String label;
+
+    @JsonProperty
+    private String description;
+
+    // Method automatically generated with DtoGenerator
+    @JsonIgnore
+    public ServiceFetchOptions getFetchOptions()
+    {
+        return fetchOptions;
+    }
+
+    // Method automatically generated with DtoGenerator
+    public void setFetchOptions(ServiceFetchOptions fetchOptions)
+    {
+        this.fetchOptions = fetchOptions;
+    }
+
+    // Method automatically generated with DtoGenerator
+    @JsonIgnore
+    @Override
+    public String getCode()
+    {
+        return code;
+    }
+
+    // Method automatically generated with DtoGenerator
+    public void setCode(String code)
+    {
+        this.code = code;
+    }
+
+    // Method automatically generated with DtoGenerator
+    @JsonIgnore
+    public String getLabel()
+    {
+        return label;
+    }
+
+    // Method automatically generated with DtoGenerator
+    public void setLabel(String label)
+    {
+        this.label = label;
+    }
+
+    // Method automatically generated with DtoGenerator
+    @JsonIgnore
+    public String getDescription()
+    {
+        return description;
+    }
+
+    // Method automatically generated with DtoGenerator
+    public void setDescription(String description)
+    {
+        this.description = description;
+    }
+
+    // Method automatically generated with DtoGenerator
+    @Override
+    public String toString()
+    {
+        return "Service code: " + code;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/fetchoptions/ServiceFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/fetchoptions/ServiceFetchOptions.java
new file mode 100644
index 00000000000..681764bf87e
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/fetchoptions/ServiceFetchOptions.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2014 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.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions;
+
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.common.fetchoptions.FetchOptions;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service;
+import ch.systemsx.cisd.base.annotation.JsonObject;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+
+/*
+ * Class automatically generated with DtoGenerator
+ */
+@JsonObject("dto.service.fetchoptions.ServiceFetchOptions")
+public class ServiceFetchOptions extends FetchOptions<Service> implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    @JsonProperty
+    private ServiceSortOptions sort;
+
+    // Method automatically generated with DtoGenerator
+    @Override
+    public ServiceSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new ServiceSortOptions();
+        }
+        return sort;
+    }
+
+    // Method automatically generated with DtoGenerator
+    @Override
+    public ServiceSortOptions getSortBy()
+    {
+        return sort;
+    }
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/fetchoptions/ServiceSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/fetchoptions/ServiceSortOptions.java
new file mode 100644
index 00000000000..bbecc46e36e
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/fetchoptions/ServiceSortOptions.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2015 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions;
+
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.common.fetchoptions.SortOptions;
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service;
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+@JsonObject("dto.service.fetchoptions.ServiceSortOptions")
+public class ServiceSortOptions extends SortOptions<Service>
+{
+    private static final long serialVersionUID = 1L;
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/id/IServiceId.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/id/IServiceId.java
new file mode 100644
index 00000000000..d91f7a54feb
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/id/IServiceId.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2015 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.as.api.v3.dto.service.id;
+
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.common.id.IObjectId;
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * Holds information that uniquely identifies a generic service in openBIS.
+ *
+ * @author Franz-Josef Elmer
+ */
+@JsonObject("dto.service.id.IServiceId")
+public interface IServiceId extends IObjectId
+{
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/id/ServicePermId.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/id/ServicePermId.java
new file mode 100644
index 00000000000..e9b9a115ea5
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/as/api/v3/dto/service/id/ServicePermId.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2015 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.as.api.v3.dto.service.id;
+
+import ch.ethz.sis.openbis.generic.as.api.v3.dto.common.id.ObjectPermId;
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * Generic service perm id. This is the core plugin name.
+ *
+ * @author Franz-Josef Elmer
+ */
+@JsonObject("dto.service.id.ServicePermId")
+public class ServicePermId extends ObjectPermId implements IServiceId
+{
+    private static final long serialVersionUID = 1L;
+
+    public ServicePermId(String permId)
+    {
+        super(permId);
+    }
+    //
+    // JSON-RPC
+    //
+
+    @SuppressWarnings("unused")
+    private ServicePermId()
+    {
+    }
+}
-- 
GitLab