|
|
@ -160,6 +160,37 @@ public class MetadataManagementServiceImpl implements MetadataManagementService
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public PaginationResult retrieveAllMetadataWithFilter(PaginationRequest request, String filter) throws MetadataManagementException {
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug("Retrieving Metadata entries for given PaginationRequest [rowCount:" +
|
|
|
|
|
|
|
|
request.getRowCount() + ", startIndex:" + request.getStartIndex() + "]");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
PaginationResult paginationResult = new PaginationResult();
|
|
|
|
|
|
|
|
request = DeviceManagerUtil.validateMetadataListPageSize(request);
|
|
|
|
|
|
|
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
MetadataManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
List<Metadata> metadata = metadataDAO.getAllMetadataWithFilter(request, tenantId, filter);
|
|
|
|
|
|
|
|
int count = metadataDAO.getMetadataCountWithFilter(tenantId, filter);
|
|
|
|
|
|
|
|
paginationResult.setData(metadata);
|
|
|
|
|
|
|
|
paginationResult.setRecordsFiltered(count);
|
|
|
|
|
|
|
|
paginationResult.setRecordsTotal(count);
|
|
|
|
|
|
|
|
return paginationResult;
|
|
|
|
|
|
|
|
} catch (MetadataManagementDAOException e) {
|
|
|
|
|
|
|
|
String msg = "Error occurred while retrieving metadata entries for given PaginationRequest [rowCount:" +
|
|
|
|
|
|
|
|
request.getRowCount() + ", startIndex:" + request.getStartIndex() + "]";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new MetadataManagementException(msg, e);
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
String msg = "Error occurred while opening a connection to the data source";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new MetadataManagementException(msg, e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
MetadataManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Metadata updateMetadata(Metadata metadata) throws MetadataManagementException {
|
|
|
|
public Metadata updateMetadata(Metadata metadata) throws MetadataManagementException {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|