Search in sources :

Example 1 with DtsRegistry

use of com.epam.pipeline.entity.dts.DtsRegistry in project cloud-pipeline by epam.

the class DtsRegistryManager method create.

/**
 * Creates a new {@link DtsRegistry}.
 * @param dtsRegistryVO a {@link DtsRegistryVO} to create
 * @return created {@link DtsRegistry}
 */
@Transactional(propagation = Propagation.REQUIRED)
public DtsRegistry create(DtsRegistryVO dtsRegistryVO) {
    validateDtsRegistryVO(dtsRegistryVO);
    DtsRegistry dtsRegistry = dtsRegistryMapper.toDtsRegistry(dtsRegistryVO);
    return dtsRegistryDao.create(dtsRegistry);
}
Also used : DtsRegistry(com.epam.pipeline.entity.dts.DtsRegistry) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with DtsRegistry

use of com.epam.pipeline.entity.dts.DtsRegistry in project cloud-pipeline by epam.

the class DtsListingManager method getDtsBaseUrl.

private String getDtsBaseUrl(String path, Long dtsId) {
    DtsRegistry registry = dtsRegistryManager.load(dtsId);
    Assert.isTrue(registry.getPrefixes().stream().anyMatch(prefix -> path.startsWith(trimTrailingDelimiter(prefix))), String.format("Required path %s does not satisfy DTS registry with id %d", path, dtsId));
    return registry.getUrl();
}
Also used : DtsDataStorageListing(com.epam.pipeline.entity.dts.DtsDataStorageListing) Service(org.springframework.stereotype.Service) RequiredArgsConstructor(lombok.RequiredArgsConstructor) AuthManager(com.epam.pipeline.manager.security.AuthManager) Result(com.epam.pipeline.controller.Result) DtsRegistry(com.epam.pipeline.entity.dts.DtsRegistry) Assert(org.springframework.util.Assert) DtsRegistry(com.epam.pipeline.entity.dts.DtsRegistry)

Example 3 with DtsRegistry

use of com.epam.pipeline.entity.dts.DtsRegistry in project cloud-pipeline by epam.

the class DtsRegistryManager method delete.

/**
 * Deletes a {@link DtsRegistry} specified by ID. If required {@link DtsRegistry} does not exist an error will be
 * thrown.
 * @param registryId a {@link DtsRegistry} ID to delete
 * @return deleted {@link DtsRegistry}
 */
@Transactional(propagation = Propagation.REQUIRED)
public DtsRegistry delete(Long registryId) {
    validateDtsRegistryId(registryId);
    DtsRegistry dtsRegistry = loadOrThrow(registryId);
    dtsRegistryDao.delete(registryId);
    return dtsRegistry;
}
Also used : DtsRegistry(com.epam.pipeline.entity.dts.DtsRegistry) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with DtsRegistry

use of com.epam.pipeline.entity.dts.DtsRegistry in project cloud-pipeline by epam.

the class DtsRegistryManager method update.

/**
 * Updates a {@link DtsRegistry} specified by ID. If required {@link DtsRegistry} does not exist an error will be
 * thrown.
 * @param registryId a {@link DtsRegistry} ID to update
 * @param dtsRegistryVO a {@link DtsRegistryVO} to update
 * @return updated {@link DtsRegistry}
 */
@Transactional(propagation = Propagation.REQUIRED)
public DtsRegistry update(Long registryId, DtsRegistryVO dtsRegistryVO) {
    validateDtsRegistryId(registryId);
    validateDtsRegistryVO(dtsRegistryVO);
    loadOrThrow(registryId);
    DtsRegistry dtsRegistry = dtsRegistryMapper.toDtsRegistry(dtsRegistryVO);
    dtsRegistry.setId(registryId);
    dtsRegistryDao.update(dtsRegistry);
    return dtsRegistry;
}
Also used : DtsRegistry(com.epam.pipeline.entity.dts.DtsRegistry) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with DtsRegistry

use of com.epam.pipeline.entity.dts.DtsRegistry in project cloud-pipeline by epam.

the class DtsConfigurationProviderImpl method validateEntry.

@Override
public void validateEntry(DtsRunConfigurationEntry entry) {
    DtsRegistry dts = dtsRegistryManager.load(entry.getDtsId());
    Assert.isTrue(dts.isSchedulable(), messageHelper.getMessage(MessageConstants.ERROR_DTS_NOT_SCHEDULABLE, dts.getName()));
    if (entry.getPipelineId() != null) {
        pipelineManager.load(entry.getPipelineId());
    }
}
Also used : DtsRegistry(com.epam.pipeline.entity.dts.DtsRegistry)

Aggregations

DtsRegistry (com.epam.pipeline.entity.dts.DtsRegistry)8 Transactional (org.springframework.transaction.annotation.Transactional)3 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)1 Result (com.epam.pipeline.controller.Result)1 DtsDataStorageListing (com.epam.pipeline.entity.dts.DtsDataStorageListing)1 DtsRequestException (com.epam.pipeline.exception.DtsRequestException)1 AuthManager (com.epam.pipeline.manager.security.AuthManager)1 RequiredArgsConstructor (lombok.RequiredArgsConstructor)1 Test (org.junit.Test)1 Service (org.springframework.stereotype.Service)1 Assert (org.springframework.util.Assert)1