use of com.epam.pipeline.entity.metadata.MetadataEntity in project cloud-pipeline by epam.
the class MetadataEntityDao method batchInsert.
@Transactional(propagation = Propagation.MANDATORY)
@SuppressWarnings("unchecked")
public Collection<MetadataEntity> batchInsert(List<MetadataEntity> entitiesToCreate) {
for (int i = 0; i < entitiesToCreate.size(); i += BATCH_SIZE) {
final List<MetadataEntity> batchList = entitiesToCreate.subList(i, i + BATCH_SIZE > entitiesToCreate.size() ? entitiesToCreate.size() : i + BATCH_SIZE);
List<Long> ids = daoHelper.createIds(metadataEntitySequence, batchList.size());
Map<String, Object>[] batchValues = new Map[batchList.size()];
for (int j = 0; j < batchList.size(); j++) {
MetadataEntity entity = batchList.get(j);
entity.setId(ids.get(j));
batchValues[j] = MetadataEntityParameters.getParameters(entity).getValues();
}
getNamedParameterJdbcTemplate().batchUpdate(this.createMetadataEntityQuery, batchValues);
}
return entitiesToCreate;
}
use of com.epam.pipeline.entity.metadata.MetadataEntity in project cloud-pipeline by epam.
the class MetadataEntityConverterTest method shouldFailIfPairSetWithoutPairs.
@Test(expected = IllegalStateException.class)
public void shouldFailIfPairSetWithoutPairs() {
Map<String, PipeConfValue> pairSetData = new HashMap<>();
pairSetData.put(TEST_ARGUMENT1, new PipeConfValue(STRING_TYPE, TEST_VALUE_2));
MetadataEntity pairSet = getEntity(pairSetClass, "HCC_pairs", pairSetData);
MetadataEntityConverter.convert(Collections.singletonList(pairSet));
}
use of com.epam.pipeline.entity.metadata.MetadataEntity in project cloud-pipeline by epam.
the class MetadataEntityConverterTest method getEntity.
private static MetadataEntity getEntity(MetadataClass entityClass, String externalName, Map<String, PipeConfValue> data) {
MetadataEntity entity = new MetadataEntity();
entity.setClassEntity(entityClass);
entity.setExternalId(externalName);
entity.setData(data);
return entity;
}
use of com.epam.pipeline.entity.metadata.MetadataEntity in project cloud-pipeline by epam.
the class MetadataEntityConverterTest method shouldFailIfSampleSetWithoutSamples.
@Test(expected = IllegalStateException.class)
public void shouldFailIfSampleSetWithoutSamples() {
Map<String, PipeConfValue> sampleSetData = new HashMap<>();
sampleSetData.put(TEST_ARGUMENT1, new PipeConfValue(STRING_TYPE, TEST_VALUE_2));
MetadataEntity sampleSet = getEntity(sampleSetClass, "HCC_samples", sampleSetData);
MetadataEntityConverter.convert(Collections.singletonList(sampleSet));
}
use of com.epam.pipeline.entity.metadata.MetadataEntity in project cloud-pipeline by epam.
the class MetadataEntityConverterTest method shouldFailIfPairWithoutControlSampleAttribute.
@Test(expected = IllegalArgumentException.class)
public void shouldFailIfPairWithoutControlSampleAttribute() {
Map<String, PipeConfValue> pairData = new HashMap<>();
pairData.put(PARTICIPANT_TYPE_NAME, new PipeConfValue(PARTICIPANT_TYPE_NAME, PARTICIPANT_ENTITY_ID1));
pairData.put(CASE_SAMPLE_ARGUMENT, new PipeConfValue(SAMPLE_ATTRIBUTE_TYPE, SAMPLE_ENTITY_ID2));
MetadataEntity pair = getEntity(pairClass, PAIR_ENTITY_ID1, pairData);
MetadataEntityConverter.convert(Collections.singletonList(pair));
}
Aggregations