diff --git a/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/create/SampleCreation.java b/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/create/SampleCreation.java index 808b41f2279f2776fdd09e160b485f3484976fee..3000bb1ce985c4f3f630eeb0cf707be2574ca9d3 100644 --- a/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/create/SampleCreation.java +++ b/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/create/SampleCreation.java @@ -60,6 +60,8 @@ public class SampleCreation implements ICreation, ICreationIdHolder, IProperties private boolean autoGeneratedCode; + private boolean codeBeatsAutoGeneratedCode; + private List<? extends ITagId> tagIds; private Map<String, String> properties = new HashMap<String, String>(); @@ -139,6 +141,16 @@ public class SampleCreation implements ICreation, ICreationIdHolder, IProperties this.autoGeneratedCode = autoGeneratedCode; } + public boolean isCodeBeatsAutoGeneratedCode() + { + return codeBeatsAutoGeneratedCode; + } + + public void setCodeBeatsAutoGeneratedCode(boolean codeBeatsAutoGeneratedCode) + { + this.codeBeatsAutoGeneratedCode = codeBeatsAutoGeneratedCode; + } + public List<? extends ITagId> getTagIds() { return tagIds; diff --git a/api-openbis-javascript/src/v3/as/dto/sample/create/SampleCreation.js b/api-openbis-javascript/src/v3/as/dto/sample/create/SampleCreation.js index 61e717b3f8ecc226262cbc8ccbe9befcbb11f9cb..daeb9d993a6f35b3159b6f02f1baaa1f056dc3c4 100644 --- a/api-openbis-javascript/src/v3/as/dto/sample/create/SampleCreation.js +++ b/api-openbis-javascript/src/v3/as/dto/sample/create/SampleCreation.js @@ -24,6 +24,7 @@ define([ "stjs", "as/dto/common/Relationship" ], function(stjs, Relationship) { prototype.attachments = null; prototype.creationId = null; prototype.autoGeneratedCode = null; + prototype.codeBeatsAutoGeneratedCode = null; prototype.getTypeId = function() { return this.typeId; }; @@ -60,6 +61,12 @@ define([ "stjs", "as/dto/common/Relationship" ], function(stjs, Relationship) { prototype.setAutoGeneratedCode = function(autoGeneratedCode) { this.autoGeneratedCode = autoGeneratedCode; }; + prototype.isCodeBeatsAutoGeneratedCode = function() { + return this.codeBeatsAutoGeneratedCode; + } + prototype.setCodeBeatsAutoGeneratedCode = function(codeBeatsAutoGeneratedCode) { + this.codeBeatsAutoGeneratedCode = codeBeatsAutoGeneratedCode; + }; prototype.getTagIds = function() { return this.tagIds; }; diff --git a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/sample/CreateSampleExecutor.java b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/sample/CreateSampleExecutor.java index e7776a266067a1f70733b138798f2f7af2d17a06..73b1f7f94f8383fc9d8ab486e16ee8dd64d8f1ab 100644 --- a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/sample/CreateSampleExecutor.java +++ b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/sample/CreateSampleExecutor.java @@ -191,7 +191,9 @@ public class CreateSampleExecutor extends AbstractCreateEntityExecutor<SampleCre } else if (type == null) { throw new ObjectNotFoundException(creation.getTypeId()); - } else if (false == StringUtils.isEmpty(creation.getCode()) && (type.isAutoGeneratedCode() || creation.isAutoGeneratedCode())) + } else if (false == StringUtils.isEmpty(creation.getCode()) + && (type.isAutoGeneratedCode() || creation.isAutoGeneratedCode()) + && creation.isCodeBeatsAutoGeneratedCode() == false) { throw new UserFailureException("Code should be empty when auto generated code is selected."); } else if (StringUtils.isEmpty(creation.getCode()) && false == type.isAutoGeneratedCode()