Skip to content
Snippets Groups Projects
Commit 47fd2e0f authored by jakubs's avatar jakubs
Browse files

BIS-226 SP-341 add more layers of vocabularies dropbox updates

SVN: 27569
parent 62e85922
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialUpdateDTO;
import ch.systemsx.cisd.openbis.generic.shared.dto.MetaprojectUpdatesDTO;
import ch.systemsx.cisd.openbis.generic.shared.dto.NewExternalData;
import ch.systemsx.cisd.openbis.generic.shared.dto.SampleUpdatesDTO;
import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyUpdatesDTO;
public class DefaultEntityOperationService<T extends DataSetInformation> implements
IEntityOperationService<T>
......@@ -90,6 +91,7 @@ public class DefaultEntityOperationService<T extends DataSetInformation> impleme
List<DataSetBatchUpdatesDTO> dataSetUpdates = details.getDataSetUpdates();
List<NewMetaproject> metaprojectRegistrations = details.getMetaprojectRegistrations();
List<MetaprojectUpdatesDTO> metaprojectUpdates = details.getMetaprojectUpdates();
List<VocabularyUpdatesDTO> vocabularyUpdates = details.getVocabularyUpdates();
List<NewExternalData> dataSetRegistrations = new ArrayList<NewExternalData>();
for (DataSetRegistrationInformation<?> dsRegistration : details.getDataSetRegistrations())
......@@ -102,7 +104,7 @@ public class DefaultEntityOperationService<T extends DataSetInformation> impleme
details.getRegistrationId(), details.tryUserIdOrNull(), spaceRegistrations,
projectRegistrations, experimentRegistrations, experimentUpdates, sampleUpdates,
sampleRegistrations, materialRegistrations, materialUpdates, dataSetRegistrations,
dataSetUpdates, metaprojectRegistrations, metaprojectUpdates);
dataSetUpdates, metaprojectRegistrations, metaprojectUpdates, vocabularyUpdates);
}
}
\ No newline at end of file
......@@ -20,6 +20,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
......@@ -46,6 +47,7 @@ import ch.systemsx.cisd.etlserver.registrator.api.v1.IMetaproject;
import ch.systemsx.cisd.etlserver.registrator.api.v1.IProject;
import ch.systemsx.cisd.etlserver.registrator.api.v1.ISample;
import ch.systemsx.cisd.etlserver.registrator.api.v1.ISpace;
import ch.systemsx.cisd.etlserver.registrator.api.v1.IVocabularyTerm;
import ch.systemsx.cisd.etlserver.registrator.api.v1.SecondaryTransactionFailure;
import ch.systemsx.cisd.etlserver.registrator.api.v1.impl.RollbackStack.IRollbackStackDelegate;
import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService;
......@@ -69,7 +71,9 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetBatchUpdatesDTO;
import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentUpdatesDTO;
import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialUpdateDTO;
import ch.systemsx.cisd.openbis.generic.shared.dto.MetaprojectUpdatesDTO;
import ch.systemsx.cisd.openbis.generic.shared.dto.NewVocabularyTerm;
import ch.systemsx.cisd.openbis.generic.shared.dto.SampleUpdatesDTO;
import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyUpdatesDTO;
import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier;
import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifierFactory;
import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier;
......@@ -744,7 +748,9 @@ public abstract class AbstractTransactionState<T extends DataSetInformation>
openBisService.tryGetVocabulary(code);
if (vocabulary != null)
{
return new Vocabulary(vocabulary);
Vocabulary apiVocabulary = new Vocabulary(vocabulary);
vocabulariesToBeUpdated.add(apiVocabulary);
return apiVocabulary;
}
return null;
}
......@@ -1003,13 +1009,15 @@ public abstract class AbstractTransactionState<T extends DataSetInformation>
List<DataSetBatchUpdatesDTO> dataSetUpdates = convertDataSetsToBeUpdated();
List<NewMetaproject> metaprojectRegistrations = convertMetaprojectsToBeRegistered();
List<MetaprojectUpdatesDTO> metaprojectUpdates = convertMetaprojectsToBeUpdated();
List<VocabularyUpdatesDTO> vocabularyUpdates = covertVocabulariesToBeUpdated();
AtomicEntityOperationDetails<T> registrationDetails =
new AtomicEntityOperationDetails<T>(registrationId, getUserId(),
spaceRegistrations, projectRegistrations, experimentUpdates,
experimentRegistrations, sampleUpdates, sampleRegistrations,
materialRegistrations, materialUpdates, dataSetRegistrations,
dataSetUpdates, metaprojectRegistrations, metaprojectUpdates);
dataSetUpdates, metaprojectRegistrations, metaprojectUpdates,
vocabularyUpdates);
return registrationDetails;
}
......@@ -1132,6 +1140,32 @@ public abstract class AbstractTransactionState<T extends DataSetInformation>
return result;
}
private List<VocabularyUpdatesDTO> covertVocabulariesToBeUpdated()
{
List<VocabularyUpdatesDTO> result = new ArrayList<VocabularyUpdatesDTO>();
for (Vocabulary v : vocabulariesToBeUpdated)
{
List<NewVocabularyTerm> newTerms = new LinkedList<NewVocabularyTerm>();
for (IVocabularyTerm t : v.getNewTerms())
{
NewVocabularyTerm newTerm =
new NewVocabularyTerm(t.getCode(), t.getDescription(), t.getLabel(),
t.getOrdinal());
newTerms.add(newTerm);
}
VocabularyUpdatesDTO updates =
new VocabularyUpdatesDTO(v.getVocabulary().getId(), v.getCode(),
v.getDescription(), v.isManagedInternally(),
v.isInternalNamespace(), v.isChosenFromList(), v.getUrlTemplate(),
newTerms);
result.add(updates);
}
return result;
}
@Override
public boolean isCommitted()
{
......
......@@ -54,14 +54,12 @@ public class Vocabulary extends VocabularyImmutable implements IVocabulary
public void setInternalNamespace(boolean isInternalNamespace)
{
getVocabulary().setInternalNamespace(isInternalNamespace);
}
@Override
public void setChosenFromList(boolean isChosenFromList)
{
getVocabulary().setChosenFromList(isChosenFromList);
}
@Override
......@@ -76,4 +74,9 @@ public class Vocabulary extends VocabularyImmutable implements IVocabulary
newTerms.add(term);
}
List<IVocabularyTerm> getNewTerms()
{
return newTerms;
}
}
......@@ -33,7 +33,7 @@ public class VocabularyTerm extends VocabularyTermImmutable implements IVocabula
@Override
public void setCode(String code)
{
getVocabularyTerm().setCode(getCode());
getVocabularyTerm().setCode(code);
}
@Override
......
......@@ -34,6 +34,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentUpdatesDTO;
import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialUpdateDTO;
import ch.systemsx.cisd.openbis.generic.shared.dto.MetaprojectUpdatesDTO;
import ch.systemsx.cisd.openbis.generic.shared.dto.SampleUpdatesDTO;
import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyUpdatesDTO;
/**
* An object that captures the state for performing the registration of one or many openBIS entities
......@@ -75,6 +76,8 @@ public class AtomicEntityOperationDetails<T extends DataSetInformation> implemen
private final List<MetaprojectUpdatesDTO> metaprojectUpdates;
private final List<VocabularyUpdatesDTO> vocabularyUpdates;
public AtomicEntityOperationDetails(TechId registrationId, String userIdOrNull,
List<NewSpace> spaceRegistrations, List<NewProject> projectRegistrations,
List<ExperimentUpdatesDTO> experimentUpdates,
......@@ -85,7 +88,8 @@ public class AtomicEntityOperationDetails<T extends DataSetInformation> implemen
List<DataSetRegistrationInformation<T>> dataSetRegistrations,
List<DataSetBatchUpdatesDTO> dataSetUpdates,
List<NewMetaproject> metaprojectRegistrations,
List<MetaprojectUpdatesDTO> metaprojectUpdates)
List<MetaprojectUpdatesDTO> metaprojectUpdates,
List<VocabularyUpdatesDTO> vocabularyUpdates)
{
this.registrationId = registrationId;
this.userIdOrNull = userIdOrNull;
......@@ -102,6 +106,7 @@ public class AtomicEntityOperationDetails<T extends DataSetInformation> implemen
this.materialUpdates = new ArrayList<MaterialUpdateDTO>(materialUpdates);
this.metaprojectRegistrations = new ArrayList<NewMetaproject>(metaprojectRegistrations);
this.metaprojectUpdates = new ArrayList<MetaprojectUpdatesDTO>(metaprojectUpdates);
this.vocabularyUpdates = new ArrayList<VocabularyUpdatesDTO>(vocabularyUpdates);
}
public TechId getRegistrationId()
......@@ -174,4 +179,9 @@ public class AtomicEntityOperationDetails<T extends DataSetInformation> implemen
return metaprojectUpdates;
}
public List<VocabularyUpdatesDTO> getVocabularyUpdates()
{
return vocabularyUpdates;
}
}
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