From 42d02fcf058f225146a0d8243395d98e4bfb5f0e Mon Sep 17 00:00:00 2001
From: fedoreno <fedoreno>
Date: Sat, 19 Mar 2016 00:52:53 +0000
Subject: [PATCH] SSDM-3348: fixing js-dto inconsistencies: avoiding npe with
 null fetch options

SVN: 35948
---
 .../v3/helper/generators/DtoGenerator.java    |  4 +--
 .../api/v3/as/dto/attachment/Attachment.js    |  6 ++--
 .../api/v3/as/dto/dataset/DataSet.js          | 32 +++++++++----------
 .../api/v3/as/dto/dataset/LinkedData.js       |  2 +-
 .../api/v3/as/dto/dataset/PhysicalData.js     |  6 ++--
 .../api/v3/as/dto/deletion/Deletion.js        |  2 +-
 .../api/v3/as/dto/experiment/Experiment.js    | 22 ++++++-------
 .../create/CreateExperimentsOperation.js      |  5 ++-
 .../CreateExperimentsOperationResult.js       | 10 ++++--
 .../v3/as/dto/global/GlobalSearchObject.js    |  8 ++---
 .../api/v3/as/dto/history/HistoryEntry.js     |  2 +-
 .../api/v3/as/dto/material/Material.js        | 12 +++----
 .../resources/api/v3/as/dto/person/Person.js  |  4 +--
 .../api/v3/as/dto/project/Project.js          | 14 ++++----
 .../resources/api/v3/as/dto/sample/Sample.js  | 30 ++++++++---------
 ...ult.js => CreateSamplesOperationResult.js} |  8 ++---
 .../resources/api/v3/as/dto/space/Space.js    |  6 ++--
 .../public/resources/api/v3/as/dto/tag/Tag.js |  2 +-
 .../api/v3/as/dto/vocabulary/Vocabulary.js    |  2 +-
 .../v3/as/dto/vocabulary/VocabularyTerm.js    |  4 +--
 20 files changed, 94 insertions(+), 87 deletions(-)
 rename openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/sample/create/{CreateSamplesResult.js => CreateSamplesOperationResult.js} (54%)

diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/DtoGenerator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/DtoGenerator.java
index 4d9d4c6ab77..798d1f0cb0c 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/DtoGenerator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/DtoGenerator.java
@@ -526,7 +526,7 @@ public class DtoGenerator
         printGetterAnnotation(field);
         print("public %s get%s()", field.definitionClassName, field.getCapitalizedName());
         startBlock();
-        print("if (getFetchOptions().has%s())", field.getCapitalizedName());
+        print("if (getFetchOptions() != null && getFetchOptions().has%s())", field.getCapitalizedName());
         startBlock();
         print("return %s;", field.getPersistentName());
         endBlock();
@@ -549,7 +549,7 @@ public class DtoGenerator
     {
         print("this.get%s = function()", field.getCapitalizedName());
         startBlock();
-        print("if (this.getFetchOptions().has%s())", field.getCapitalizedName());
+        print("if (getFetchOptions() != null && this.getFetchOptions().has%s())", field.getCapitalizedName());
         startBlock();
         print("return %s;", field.getPersistentName());
         endBlock();
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/attachment/Attachment.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/attachment/Attachment.js
index e17b870c439..cc2cc4c65b3 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/attachment/Attachment.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/attachment/Attachment.js
@@ -68,7 +68,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.registrationDate = registrationDate;
 		};
 		prototype.getRegistrator = function() {
-			if (this.getFetchOptions().hasRegistrator()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasRegistrator()) {
 				return this.registrator;
 			} else {
 				throw new exceptions.NotFetchedException("Registrator has not been fetched.");
@@ -78,7 +78,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.registrator = registrator;
 		};
 		prototype.getPreviousVersion = function() {
-			if (this.getFetchOptions().hasPreviousVersion()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasPreviousVersion()) {
 				return this.previousVersion;
 			} else {
 				throw new exceptions.NotFetchedException("Previous version of attachment  has not been fetched.");
@@ -88,7 +88,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.previousVersion = previousVersion;
 		};
 		prototype.getContent = function() {
-			if (this.getFetchOptions().hasContent()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasContent()) {
 				return this.content;
 			} else {
 				throw new exceptions.NotFetchedException("Content has not been fetched.");
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/DataSet.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/DataSet.js
index f3e1bd3af42..6d80215b9db 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/DataSet.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/DataSet.js
@@ -72,7 +72,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.postRegistered = postRegistered;
 		};
 		prototype.getParents = function() {
-			if (this.getFetchOptions().hasParents()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasParents()) {
 				return this.parents;
 			} else {
 				throw new exceptions.NotFetchedException("Parents has not been fetched.");
@@ -82,7 +82,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.parents = parents;
 		};
 		prototype.getChildren = function() {
-			if (this.getFetchOptions().hasChildren()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasChildren()) {
 				return this.children;
 			} else {
 				throw new exceptions.NotFetchedException("Children has not been fetched.");
@@ -92,7 +92,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.children = children;
 		};
 		prototype.getContainers = function() {
-			if (this.getFetchOptions().hasContainers()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasContainers()) {
 				return this.containers;
 			} else {
 				throw new exceptions.NotFetchedException("Container data sets has not been fetched.");
@@ -102,7 +102,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.containers = containers;
 		};
 		prototype.getComponents = function() {
-			if (this.getFetchOptions().hasComponents()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasComponents()) {
 				return this.components;
 			} else {
 				throw new exceptions.NotFetchedException("Component data sets has not been fetched.");
@@ -112,7 +112,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.components = components;
 		};
 		prototype.getPhysicalData = function() {
-			if (this.getFetchOptions().hasPhysicalData()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasPhysicalData()) {
 				return this.physicalData;
 			} else {
 				throw new exceptions.NotFetchedException("Physical data has not been fetched.");
@@ -122,7 +122,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.physicalData = physicalData;
 		};
 		prototype.getLinkedData = function() {
-			if (this.getFetchOptions().hasLinkedData()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasLinkedData()) {
 				return this.linkedData;
 			} else {
 				throw new exceptions.NotFetchedException("Linked data has not been fetched.");
@@ -132,7 +132,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.linkedData = linkedData;
 		};
 		prototype.getTags = function() {
-			if (this.getFetchOptions().hasTags()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasTags()) {
 				return this.tags;
 			} else {
 				throw new exceptions.NotFetchedException("Tags has not been fetched.");
@@ -142,7 +142,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.tags = tags;
 		};
 		prototype.getType = function() {
-			if (this.getFetchOptions().hasType()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasType()) {
 				return this.type;
 			} else {
 				throw new exceptions.NotFetchedException("Data Set type has not been fetched.");
@@ -152,7 +152,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.type = type;
 		};
 		prototype.getDataStore = function() {
-			if (this.getFetchOptions().hasDataStore()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasDataStore()) {
 				return this.dataStore;
 			} else {
 				throw new exceptions.NotFetchedException("Data store has not been fetched.");
@@ -162,7 +162,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.dataStore = dataStore;
 		};
 		prototype.getHistory = function() {
-			if (this.getFetchOptions().hasHistory()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasHistory()) {
 				return this.history;
 			} else {
 				throw new exceptions.NotFetchedException("History has not been fetched.");
@@ -178,7 +178,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.modificationDate = modificationDate;
 		};
 		prototype.getModifier = function() {
-			if (this.getFetchOptions().hasModifier()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasModifier()) {
 				return this.modifier;
 			} else {
 				throw new exceptions.NotFetchedException("Modifier has not been fetched.");
@@ -194,7 +194,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.registrationDate = registrationDate;
 		};
 		prototype.getRegistrator = function() {
-			if (this.getFetchOptions().hasRegistrator()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasRegistrator()) {
 				return this.registrator;
 			} else {
 				throw new exceptions.NotFetchedException("Registrator has not been fetched.");
@@ -204,7 +204,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.registrator = registrator;
 		};
 		prototype.getExperiment = function() {
-			if (this.getFetchOptions().hasExperiment()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasExperiment()) {
 				return this.experiment;
 			} else {
 				throw new exceptions.NotFetchedException("Experiment has not been fetched.");
@@ -214,7 +214,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.experiment = experiment;
 		};
 		prototype.getSample = function() {
-			if (this.getFetchOptions().hasSample()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasSample()) {
 				return this.sample;
 			} else {
 				throw new exceptions.NotFetchedException("Sample has not been fetched.");
@@ -228,7 +228,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			return properties ? properties[propertyName] : null;
 		};
 		prototype.getProperties = function() {
-			if (this.getFetchOptions().hasProperties()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasProperties()) {
 				return this.properties;
 			} else {
 				throw new exceptions.NotFetchedException("Properties has not been fetched.");
@@ -242,7 +242,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			return properties ? properties[propertyName] : null;
 		};
 		prototype.getMaterialProperties = function() {
-			if (this.getFetchOptions().hasMaterialProperties()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasMaterialProperties()) {
 				return this.materialProperties;
 			} else {
 				throw new exceptions.NotFetchedException("Material properties has not been fetched.");
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/LinkedData.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/LinkedData.js
index 00e35f441c9..e8117920f40 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/LinkedData.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/LinkedData.js
@@ -25,7 +25,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.externalCode = externalCode;
 		};
 		prototype.getExternalDms = function() {
-			if (this.getFetchOptions().hasExternalDms()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasExternalDms()) {
 				return this.externalDms;
 			} else {
 				throw new exceptions.NotFetchedException("External data management system has not been fetched.");
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/PhysicalData.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/PhysicalData.js
index d6c43cfdfd7..65019d7b586 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/PhysicalData.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/PhysicalData.js
@@ -46,7 +46,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.size = size;
 		};
 		prototype.getStorageFormat = function() {
-			if (this.getFetchOptions().hasStorageFormat()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasStorageFormat()) {
 				return this.storageFormat;
 			} else {
 				throw new exceptions.NotFetchedException("Storage format has not been fetched.");
@@ -56,7 +56,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.storageFormat = storageFormat;
 		};
 		prototype.getFileFormatType = function() {
-			if (this.getFetchOptions().hasFileFormatType()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasFileFormatType()) {
 				return this.fileFormatType;
 			} else {
 				throw new exceptions.NotFetchedException("File format type has not been fetched.");
@@ -66,7 +66,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.fileFormatType = fileFormatType;
 		};
 		prototype.getLocatorType = function() {
-			if (this.getFetchOptions().hasLocatorType()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasLocatorType()) {
 				return this.locatorType;
 			} else {
 				throw new exceptions.NotFetchedException("Locator type has not been fetched.");
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/deletion/Deletion.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/deletion/Deletion.js
index 5001e13ee17..21a4188f58f 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/deletion/Deletion.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/deletion/Deletion.js
@@ -31,7 +31,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.reason = reason;
 		};
 		prototype.getDeletedObjects = function() {
-			if (this.getFetchOptions().hasDeletedObjects()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasDeletedObjects()) {
 				return this.deletedObjects;
 			} else {
 				throw new exceptions.NotFetchedException("Deleted objects have not been fetched.");
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/experiment/Experiment.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/experiment/Experiment.js
index c048d805bd6..4fc4c2dce9c 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/experiment/Experiment.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/experiment/Experiment.js
@@ -62,7 +62,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.modificationDate = modificationDate;
 		};
 		prototype.getType = function() {
-			if (this.getFetchOptions().hasType()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasType()) {
 				return this.type;
 			} else {
 				throw new exceptions.NotFetchedException("Experiment type has not been fetched.");
@@ -72,7 +72,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.type = type;
 		};
 		prototype.getProject = function() {
-			if (this.getFetchOptions().hasProject()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasProject()) {
 				return this.project;
 			} else {
 				throw new exceptions.NotFetchedException("Project has not been fetched.");
@@ -82,7 +82,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.project = project;
 		};
 		prototype.getDataSets = function() {
-			if (this.getFetchOptions().hasDataSets()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasDataSets()) {
 				return this.dataSets;
 			} else {
 				throw new exceptions.NotFetchedException("Data sets have not been fetched.");
@@ -92,7 +92,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.dataSets = dataSets;
 		};
 		prototype.getSamples = function() {
-			if (this.getFetchOptions().hasSamples()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasSamples()) {
 				return this.samples;
 			} else {
 				throw new exceptions.NotFetchedException("Samples have not been fetched.");
@@ -102,7 +102,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.samples = samples;
 		};
 		prototype.getHistory = function() {
-			if (this.getFetchOptions().hasHistory()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasHistory()) {
 				return this.history;
 			} else {
 				throw new exceptions.NotFetchedException("History has not been fetched.");
@@ -116,7 +116,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			return properties ? properties[propertyName] : null;
 		};
 		prototype.getProperties = function() {
-			if (this.getFetchOptions().hasProperties()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasProperties()) {
 				return this.properties;
 			} else {
 				throw new exceptions.NotFetchedException("Properties have not been fetched.");
@@ -130,7 +130,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			return properties ? properties[propertyName] : null;
 		};
 		prototype.getMaterialProperties = function() {
-			if (this.getFetchOptions().hasMaterialProperties()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasMaterialProperties()) {
 				return this.materialProperties;
 			} else {
 				throw new exceptions.NotFetchedException("Material properties have not been fetched.");
@@ -140,7 +140,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.materialProperties = materialProperties;
 		};
 		prototype.getTags = function() {
-			if (this.getFetchOptions().hasTags()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasTags()) {
 				return this.tags;
 			} else {
 				throw new exceptions.NotFetchedException("Tags has not been fetched.");
@@ -150,7 +150,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.tags = tags;
 		};
 		prototype.getRegistrator = function() {
-			if (this.getFetchOptions().hasRegistrator()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasRegistrator()) {
 				return this.registrator;
 			} else {
 				throw new exceptions.NotFetchedException("Registrator has not been fetched.");
@@ -160,7 +160,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.registrator = registrator;
 		};
 		prototype.getModifier = function() {
-			if (this.getFetchOptions().hasModifier()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasModifier()) {
 				return this.modifier;
 			} else {
 				throw new exceptions.NotFetchedException("Modifier has not been fetched.");
@@ -170,7 +170,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.modifier = modifier;
 		};
 		prototype.getAttachments = function() {
-			if (this.getFetchOptions().hasAttachments()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasAttachments()) {
 				return this.attachments;
 			} else {
 				throw new exceptions.NotFetchedException("Attachments has not been fetched.");
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/experiment/create/CreateExperimentsOperation.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/experiment/create/CreateExperimentsOperation.js
index 432626079c1..8e089226193 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/experiment/create/CreateExperimentsOperation.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/experiment/create/CreateExperimentsOperation.js
@@ -6,7 +6,10 @@ define([ "stjs", "as/dto/common/operations/IOperation" ], function(stjs, IOperat
 	};
 	stjs.extend(CreateExperimentsOperation, null, [ IOperation ], function(constructor, prototype) {
 		prototype['@type'] = 'as.dto.experiment.create.CreateExperimentsOperation';
-		prototype.newExperiments = null;
+		prototype.creations = null;
+		prototype.getCreations = function() {
+			return this.creations;
+		};
 	}, {
 		newExperiments : {
 			name : "List",
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/experiment/create/CreateExperimentsOperationResult.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/experiment/create/CreateExperimentsOperationResult.js
index 0313243cf30..42581c5bb00 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/experiment/create/CreateExperimentsOperationResult.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/experiment/create/CreateExperimentsOperationResult.js
@@ -2,13 +2,17 @@
  * @author pkupczyk
  */
 define([ "stjs", "as/dto/common/operations/IOperationResult" ], function(stjs, IOperationResult) {
-	var CreateExperimentsOperationResult = function() {
+	var CreateExperimentsOperationResult = function(permIds) {
+		this.permIds = permIds;
 	};
 	stjs.extend(CreateExperimentsOperationResult, null, [ IOperationResult ], function(constructor, prototype) {
 		prototype['@type'] = 'as.dto.experiment.create.CreateExperimentsOperationResult';
-		prototype.newExperimentIds = null;
+		prototype.permIds = null;
+		prototype.getPermIds = function() {
+			return this.permIds;
+		};
 	}, {
-		newExperimentIds : {
+		permIds : {
 			name : "List",
 			arguments : [ "ExperimentPermId" ]
 		}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/global/GlobalSearchObject.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/global/GlobalSearchObject.js
index 189c3ecc012..77b04a23392 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/global/GlobalSearchObject.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/global/GlobalSearchObject.js
@@ -52,7 +52,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.score = score;
 		};
 		prototype.getExperiment = function() {
-			if (this.getFetchOptions().hasExperiment()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasExperiment()) {
 				return this.experiment;
 			} else {
 				throw new exceptions.NotFetchedException("Experiment has not been fetched.");
@@ -62,7 +62,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.experiment = experiment;
 		};
 		prototype.getSample = function() {
-			if (this.getFetchOptions().hasSample()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasSample()) {
 				return this.sample;
 			} else {
 				throw new exceptions.NotFetchedException("Sample has not been fetched.");
@@ -72,7 +72,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.sample = sample;
 		};
 		prototype.getDataSet = function() {
-			if (this.getFetchOptions().hasDataSet()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasDataSet()) {
 				return this.dataSet;
 			} else {
 				throw new exceptions.NotFetchedException("Data set has not been fetched.");
@@ -82,7 +82,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.dataSet = dataSet;
 		};
 		prototype.getMaterial = function() {
-			if (this.getFetchOptions().hasMaterial()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasMaterial()) {
 				return this.material;
 			} else {
 				throw new exceptions.NotFetchedException("Material has not been fetched.");
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/history/HistoryEntry.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/history/HistoryEntry.js
index 8e308de16ff..62a5e06d610 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/history/HistoryEntry.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/history/HistoryEntry.js
@@ -28,7 +28,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.validTo = validTo;
 		};
 		prototype.getAuthor = function() {
-			if (this.getFetchOptions().hasAuthor()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasAuthor()) {
 				return this.author;
 			} else {
 				throw new exceptions.NotFetchedException("Author has not been fetched.");
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/material/Material.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/material/Material.js
index 1f68493396a..f2b1503cb57 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/material/Material.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/material/Material.js
@@ -38,7 +38,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.code = code;
 		};
 		prototype.getType = function() {
-			if (this.getFetchOptions().hasType()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasType()) {
 				return this.type;
 			} else {
 				throw new exceptions.NotFetchedException("Material type has not been fetched.");
@@ -48,7 +48,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.type = type;
 		};
 		prototype.getHistory = function() {
-			if (this.getFetchOptions().hasHistory()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasHistory()) {
 				return this.history;
 			} else {
 				throw new exceptions.NotFetchedException("History has not been fetched.");
@@ -64,7 +64,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.registrationDate = registrationDate;
 		};
 		prototype.getRegistrator = function() {
-			if (this.getFetchOptions().hasRegistrator()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasRegistrator()) {
 				return this.registrator;
 			} else {
 				throw new exceptions.NotFetchedException("Registrator has not been fetched.");
@@ -84,7 +84,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			return properties ? properties[propertyName] : null;
 		};
 		prototype.getProperties = function() {
-			if (this.getFetchOptions().hasProperties()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasProperties()) {
 				return this.properties;
 			} else {
 				throw new exceptions.NotFetchedException("Properties has not been fetched.");
@@ -98,7 +98,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			return properties ? properties[propertyName] : null;
 		};
 		prototype.getMaterialProperties = function() {
-			if (this.getFetchOptions().hasMaterialProperties()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasMaterialProperties()) {
 				return this.materialProperties;
 			} else {
 				throw new exceptions.NotFetchedException("Material properties has not been fetched.");
@@ -108,7 +108,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.materialProperties = materialProperties;
 		};
 		prototype.getTags = function() {
-			if (this.getFetchOptions().hasTags()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasTags()) {
 				return this.tags;
 			} else {
 				throw new exceptions.NotFetchedException("Tags has not been fetched.");
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/person/Person.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/person/Person.js
index 6b1bf5e0db5..6ac8de9b00d 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/person/Person.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/person/Person.js
@@ -67,7 +67,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.active = active;
 		};
 		prototype.getSpace = function() {
-			if (this.getFetchOptions().hasSpace()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasSpace()) {
 				return this.space;
 			} else {
 				throw new exceptions.NotFetchedException("Space has not been fetched.");
@@ -77,7 +77,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.space = space;
 		};
 		prototype.getRegistrator = function() {
-			if (this.getFetchOptions().hasRegistrator()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasRegistrator()) {
 				return this.registrator;
 			} else {
 				throw new exceptions.NotFetchedException("Registrator has not been fetched.");
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/project/Project.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/project/Project.js
index c68ee466105..49c4f03d0fc 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/project/Project.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/project/Project.js
@@ -65,7 +65,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.modificationDate = modificationDate;
 		};
 		prototype.getExperiments = function() {
-			if (this.getFetchOptions().hasExperiments()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasExperiments()) {
 				return this.experiments;
 			} else {
 				throw new exceptions.NotFetchedException("Experiments have not been fetched.");
@@ -75,7 +75,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.experiments = experiments;
 		};
 		prototype.getHistory = function() {
-			if (this.getFetchOptions().hasHistory()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasHistory()) {
 				return this.history;
 			} else {
 				throw new exceptions.NotFetchedException("History have not been fetched.");
@@ -85,7 +85,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.history = history;
 		};
 		prototype.getSpace = function() {
-			if (this.getFetchOptions().hasSpace()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasSpace()) {
 				return this.space;
 			} else {
 				throw new exceptions.NotFetchedException("Space has not been fetched.");
@@ -95,7 +95,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.space = space;
 		};
 		prototype.getRegistrator = function() {
-			if (this.getFetchOptions().hasRegistrator()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasRegistrator()) {
 				return this.registrator;
 			} else {
 				throw new exceptions.NotFetchedException("Registrator has not been fetched.");
@@ -105,7 +105,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.registrator = registrator;
 		};
 		prototype.getModifier = function() {
-			if (this.getFetchOptions().hasModifier()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasModifier()) {
 				return this.modifier;
 			} else {
 				throw new exceptions.NotFetchedException("Modifier has not been fetched.");
@@ -115,7 +115,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.modifier = modifier;
 		};
 		prototype.getLeader = function() {
-			if (this.getFetchOptions().hasLeader()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasLeader()) {
 				return this.leader;
 			} else {
 				throw new exceptions.NotFetchedException("Leader has not been fetched.");
@@ -125,7 +125,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.leader = leader;
 		};
 		prototype.getAttachments = function() {
-			if (this.getFetchOptions().hasAttachments()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasAttachments()) {
 				return this.attachments;
 			} else {
 				throw new exceptions.NotFetchedException("Attachments have not been fetched.");
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/sample/Sample.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/sample/Sample.js
index 33813d46205..21e7a718381 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/sample/Sample.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/sample/Sample.js
@@ -66,7 +66,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.modificationDate = modificationDate;
 		};
 		prototype.getType = function() {
-			if (this.getFetchOptions().hasType()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasType()) {
 				return this.type;
 			} else {
 				throw new exceptions.NotFetchedException("Sample type has not been fetched.");
@@ -76,7 +76,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.type = type;
 		};
 		prototype.getSpace = function() {
-			if (this.getFetchOptions().hasSpace()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasSpace()) {
 				return this.space;
 			} else {
 				throw new exceptions.NotFetchedException("Space has not been fetched.");
@@ -86,7 +86,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.space = space;
 		};
 		prototype.getExperiment = function() {
-			if (this.getFetchOptions().hasExperiment()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasExperiment()) {
 				return this.experiment;
 			} else {
 				throw new exceptions.NotFetchedException("Experiment has not been fetched.");
@@ -100,7 +100,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			return properties ? properties[propertyName] : null;
 		};
 		prototype.getProperties = function() {
-			if (this.getFetchOptions().hasProperties()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasProperties()) {
 				return this.properties;
 			} else {
 				throw new exceptions.NotFetchedException("Properties have not been fetched.");
@@ -114,7 +114,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			return properties ? properties[propertyName] : null;
 		};
 		prototype.getMaterialProperties = function() {
-			if (this.getFetchOptions().hasMaterialProperties()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasMaterialProperties()) {
 				return this.materialProperties;
 			} else {
 				throw new exceptions.NotFetchedException("Material properties have not been fetched.");
@@ -124,7 +124,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.materialProperties = materialProperties;
 		};
 		prototype.getParents = function() {
-			if (this.getFetchOptions().hasParents()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasParents()) {
 				return this.parents;
 			} else {
 				throw new exceptions.NotFetchedException("Parents has not been fetched.");
@@ -134,7 +134,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.parents = parents;
 		};
 		prototype.getChildren = function() {
-			if (this.getFetchOptions().hasChildren()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasChildren()) {
 				return this.children;
 			} else {
 				throw new exceptions.NotFetchedException("Children has not been fetched.");
@@ -144,7 +144,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.children = children;
 		};
 		prototype.getContainer = function() {
-			if (this.getFetchOptions().hasContainer()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasContainer()) {
 				return this.container;
 			} else {
 				throw new exceptions.NotFetchedException("Container sample has not been fetched.");
@@ -154,7 +154,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.container = container;
 		};
 		prototype.getComponents = function() {
-			if (this.getFetchOptions().hasComponents()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasComponents()) {
 				return this.components;
 			} else {
 				throw new exceptions.NotFetchedException("Component samples has not been fetched.");
@@ -164,7 +164,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.components = components;
 		};
 		prototype.getDataSets = function() {
-			if (this.getFetchOptions().hasDataSets()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasDataSets()) {
 				return this.dataSets;
 			} else {
 				throw new exceptions.NotFetchedException("Data sets have not been fetched.");
@@ -174,7 +174,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.dataSets = dataSets;
 		};
 		prototype.getHistory = function() {
-			if (this.getFetchOptions().hasHistory()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasHistory()) {
 				return this.history;
 			} else {
 				throw new exceptions.NotFetchedException("History has not been fetched.");
@@ -184,7 +184,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.history = history;
 		};
 		prototype.getTags = function() {
-			if (this.getFetchOptions().hasTags()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasTags()) {
 				return this.tags;
 			} else {
 				throw new exceptions.NotFetchedException("Tags has not been fetched.");
@@ -194,7 +194,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.tags = tags;
 		};
 		prototype.getRegistrator = function() {
-			if (this.getFetchOptions().hasRegistrator()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasRegistrator()) {
 				return this.registrator;
 			} else {
 				throw new exceptions.NotFetchedException("Registrator has not been fetched.");
@@ -204,7 +204,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.registrator = registrator;
 		};
 		prototype.getModifier = function() {
-			if (this.getFetchOptions().hasModifier()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasModifier()) {
 				return this.modifier;
 			} else {
 				throw new exceptions.NotFetchedException("Modifier has not been fetched.");
@@ -214,7 +214,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.modifier = modifier;
 		};
 		prototype.getAttachments = function() {
-			if (this.getFetchOptions().hasAttachments()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasAttachments()) {
 				return this.attachments;
 			} else {
 				throw new exceptions.NotFetchedException("Attachments has not been fetched.");
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/sample/create/CreateSamplesResult.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/sample/create/CreateSamplesOperationResult.js
similarity index 54%
rename from openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/sample/create/CreateSamplesResult.js
rename to openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/sample/create/CreateSamplesOperationResult.js
index 4ff3ff425d6..09e76c97e73 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/sample/create/CreateSamplesResult.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/sample/create/CreateSamplesOperationResult.js
@@ -2,11 +2,11 @@
  * @author pkupczyk
  */
 define([ "stjs", "as/dto/common/operations/IOperationResult" ], function(stjs, IOperationResult) {
-	var CreateSamplesResult = function(permIds) {
+	var CreateSamplesOperationResult = function(permIds) {
 		this.permIds = permIds;
 	};
-	stjs.extend(CreateSamplesResult, null, [ IOperationResult ], function(constructor, prototype) {
-		prototype['@type'] = 'as.dto.sample.create.CreateSamplesResult';
+	stjs.extend(CreateSamplesOperationResult, null, [ IOperationResult ], function(constructor, prototype) {
+		prototype['@type'] = 'as.dto.sample.create.CreateSamplesOperationResult';
 		prototype.permIds = null;
 		prototype.getPermIds = function() {
 			return this.permIds;
@@ -17,5 +17,5 @@ define([ "stjs", "as/dto/common/operations/IOperationResult" ], function(stjs, I
 			arguments : [ "SamplePermId" ]
 		}
 	});
-	return CreateSamplesResult;
+	return CreateSamplesOperationResult;
 })
\ No newline at end of file
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/space/Space.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/space/Space.js
index 9062fe6cac3..05b3bfa5c90 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/space/Space.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/space/Space.js
@@ -55,7 +55,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.modificationDate = modificationDate;
 		};
 		prototype.getRegistrator = function() {
-			if (this.getFetchOptions().hasRegistrator()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasRegistrator()) {
 				return this.registrator;
 			} else {
 				throw new exceptions.NotFetchedException("Registrator has not been fetched.");
@@ -65,7 +65,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.registrator = registrator;
 		};
 		prototype.getSamples = function() {
-			if (this.getFetchOptions().hasSamples()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasSamples()) {
 				return this.samples;
 			} else {
 				throw new exceptions.NotFetchedException("Samples have not been fetched.");
@@ -75,7 +75,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.samples = samples;
 		};
 		prototype.getProjects = function() {
-			if (this.getFetchOptions().hasProjects()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasProjects()) {
 				return this.projects;
 			} else {
 				throw new exceptions.NotFetchedException("Projects have not been fetched.");
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/tag/Tag.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/tag/Tag.js
index 0dfc48068cb..1f0644819e8 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/tag/Tag.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/tag/Tag.js
@@ -52,7 +52,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.registrationDate = registrationDate;
 		};
 		prototype.getOwner = function() {
-			if (this.getFetchOptions().hasOwner()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasOwner()) {
 				return this.owner;
 			} else {
 				throw new exceptions.NotFetchedException("Owner has not been fetched.");
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/Vocabulary.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/Vocabulary.js
index 7f12bc0190e..324023c5c55 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/Vocabulary.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/Vocabulary.js
@@ -40,7 +40,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.registrationDate = registrationDate;
 		};
 		prototype.getRegistrator = function() {
-			if (this.getFetchOptions().hasRegistrator()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasRegistrator()) {
 				return this.registrator;
 			} else {
 				throw new exceptions.NotFetchedException("Registrator has not been fetched.");
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/VocabularyTerm.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/VocabularyTerm.js
index 27e4dc762d8..d383d57e092 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/VocabularyTerm.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/VocabularyTerm.js
@@ -56,7 +56,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.official = official;
 		};
 		prototype.getVocabulary = function() {
-			if (this.getFetchOptions().hasVocabulary()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasVocabulary()) {
 				return this.vocabulary;
 			} else {
 				throw new exceptions.NotFetchedException("Vocabulary has not been fetched.");
@@ -72,7 +72,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 			this.registrationDate = registrationDate;
 		};
 		prototype.getRegistrator = function() {
-			if (this.getFetchOptions().hasRegistrator()) {
+			if (this.getFetchOptions() && this.getFetchOptions().hasRegistrator()) {
 				return this.registrator;
 			} else {
 				throw new exceptions.NotFetchedException("Registrator has not been fetched.");
-- 
GitLab