Search in sources :

Example 16 with MetadataEntity

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;
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) HashMap(java.util.HashMap) Map(java.util.Map) Transactional(org.springframework.transaction.annotation.Transactional)

Example 17 with MetadataEntity

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));
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue) Test(org.junit.Test)

Example 18 with MetadataEntity

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;
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity)

Example 19 with MetadataEntity

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));
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue) Test(org.junit.Test)

Example 20 with MetadataEntity

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));
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue) Test(org.junit.Test)

Aggregations

MetadataEntity (com.epam.pipeline.entity.metadata.MetadataEntity)48 PipeConfValue (com.epam.pipeline.entity.metadata.PipeConfValue)22 Test (org.junit.Test)22 Transactional (org.springframework.transaction.annotation.Transactional)14 MetadataClass (com.epam.pipeline.entity.metadata.MetadataClass)12 Folder (com.epam.pipeline.entity.pipeline.Folder)10 HashMap (java.util.HashMap)9 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)7 List (java.util.List)7 Map (java.util.Map)6 MetadataEntityVO (com.epam.pipeline.controller.vo.metadata.MetadataEntityVO)5 IOException (java.io.IOException)5 MetadataReadingException (com.epam.pipeline.exception.MetadataReadingException)4 FolderManager (com.epam.pipeline.manager.pipeline.FolderManager)4 InputStream (java.io.InputStream)4 ArrayList (java.util.ArrayList)4 Autowired (org.springframework.beans.factory.annotation.Autowired)4 Propagation (org.springframework.transaction.annotation.Propagation)4 AclClass (com.epam.pipeline.entity.security.acl.AclClass)3 com.epam.pipeline.manager.metadata.parser (com.epam.pipeline.manager.metadata.parser)3