use of org.apache.airavata.model.data.replica.DataProductModel in project airavata by apache.
the class ReplicaCatalogImpl method getChildDataProducts.
@Override
public List<DataProductModel> getChildDataProducts(String productUri) throws ReplicaCatalogException {
EntityManager em = null;
try {
em = ReplicaCatalogJPAUtils.getEntityManager();
DataProduct dataProduct = em.find(DataProduct.class, productUri);
Collection<DataProduct> childProducts = dataProduct.getChildDataProducts();
ArrayList<DataProductModel> returnModels = new ArrayList<>();
childProducts.stream().forEach(cp -> {
returnModels.add(ThriftDataModelConversion.getDataProductModel(cp));
});
return returnModels;
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new ReplicaCatalogException(e);
} finally {
if (em != null && em.isOpen()) {
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
em.close();
}
}
}
use of org.apache.airavata.model.data.replica.DataProductModel in project airavata by apache.
the class RegistryServerHandler method getChildDataProducts.
@Override
public List<DataProductModel> getChildDataProducts(String productUri) throws RegistryServiceException, TException {
try {
dataCatalog = RegistryFactory.getReplicaCatalog();
List<DataProductModel> dataProductModels = dataCatalog.getChildDataProducts(productUri);
return dataProductModels;
} catch (RegistryException e) {
String msg = "Error in retreiving the child products for " + productUri + ".";
logger.error(msg, e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage(msg + " More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.model.data.replica.DataProductModel in project airavata by apache.
the class RegistryServerHandler method searchDataProductsByName.
@Override
public List<DataProductModel> searchDataProductsByName(String gatewayId, String userId, String productName, int limit, int offset) throws RegistryServiceException, TException {
try {
dataCatalog = RegistryFactory.getReplicaCatalog();
List<DataProductModel> dataProductModels = dataCatalog.searchDataProductsByName(gatewayId, userId, productName, limit, offset);
return dataProductModels;
} catch (RegistryException e) {
String msg = "Error in searching the data products for name " + productName + ".";
logger.error(msg, e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage(msg + " More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.model.data.replica.DataProductModel in project airavata by apache.
the class AiravataServerHandler method getParentDataProduct.
@Override
@SecurityCheck
public DataProductModel getParentDataProduct(AuthzToken authzToken, String productUri) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
RegistryService.Client regClient = registryClientPool.getResource();
try {
DataProductModel result = regClient.getParentDataProduct(productUri);
registryClientPool.returnResource(regClient);
return result;
} catch (Exception e) {
String msg = "Error in retreiving the parent data product for " + productUri + ".";
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
Aggregations