use of com.google.android.exoplayer2.metadata.Metadata in project dhis2-core by dhis2.
the class DefaultGmlImportService method importGml.
// -------------------------------------------------------------------------
// GmlImportService implementation
// -------------------------------------------------------------------------
@Transactional
@Override
public void importGml(InputStream inputStream, MetadataImportParams importParams) {
if (!importParams.getImportStrategy().isUpdate()) {
importParams.setImportStrategy(ImportStrategy.UPDATE);
log.warn("Changed GML import strategy to update. Only updates are supported.");
}
PreProcessingResult preProcessed = preProcessGml(inputStream);
if (preProcessed.isSuccess && preProcessed.dxf2MetaData != null) {
Metadata metadata = dxf2ToMetaData(preProcessed.dxf2MetaData);
importParams.addMetadata(schemaService.getMetadataSchemas(), metadata);
importService.importMetadata(importParams);
} else {
Throwable throwable = preProcessed.throwable;
notifier.notify(importParams.getTaskId(), NotificationLevel.ERROR, createNotifierErrorMessage(throwable), false);
log.error("GML import failed: ", throwable);
}
}
use of com.google.android.exoplayer2.metadata.Metadata in project dhis2-core by dhis2.
the class MetadataImportController method postXmlMetadata.
@RequestMapping(value = "", method = RequestMethod.POST, consumes = MediaType.APPLICATION_XML_VALUE)
public void postXmlMetadata(HttpServletRequest request, HttpServletResponse response) throws IOException {
MetadataImportParams params = metadataImportService.getParamsFromMap(contextService.getParameterValuesMap());
Metadata metadata = renderService.fromXml(StreamUtils.wrapAndCheckCompressionFormat(request.getInputStream()), Metadata.class);
params.addMetadata(schemaService.getMetadataSchemas(), metadata);
if (params.hasTaskId()) {
startAsync(params);
response.setStatus(HttpServletResponse.SC_NO_CONTENT);
} else {
ImportReport importReport = metadataImportService.importMetadata(params);
renderService.toXml(response.getOutputStream(), importReport);
}
}
use of com.google.android.exoplayer2.metadata.Metadata in project dhis2-core by dhis2.
the class FilledOrganisationUnitLevelController method setList.
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.CREATED)
public void setList(HttpServletRequest request, HttpServletResponse response) throws Exception {
Metadata metadata = DefaultRenderService.getJsonMapper().readValue(request.getInputStream(), Metadata.class);
List<OrganisationUnitLevel> levels = metadata.getOrganisationUnitLevels();
for (OrganisationUnitLevel level : levels) {
if (level.getLevel() <= 0) {
throw new WebMessageException(WebMessageUtils.conflict("Level must be greater than zero"));
}
if (StringUtils.isBlank(level.getName())) {
throw new WebMessageException(WebMessageUtils.conflict("Name must be specified"));
}
organisationUnitService.addOrUpdateOrganisationUnitLevel(new OrganisationUnitLevel(level.getLevel(), level.getName(), level.getOfflineLevels()));
}
}
use of com.google.android.exoplayer2.metadata.Metadata in project ExoPlayer by google.
the class Id3DecoderTest method testDecodeTextInformationFrame.
public void testDecodeTextInformationFrame() throws MetadataDecoderException {
byte[] rawId3 = new byte[] { 73, 68, 51, 4, 0, 0, 0, 0, 0, 23, 84, 73, 84, 50, 0, 0, 0, 13, 0, 0, 3, 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 0 };
Id3Decoder decoder = new Id3Decoder();
Metadata metadata = decoder.decode(rawId3, rawId3.length);
assertEquals(1, metadata.length());
TextInformationFrame textInformationFrame = (TextInformationFrame) metadata.get(0);
assertEquals("TIT2", textInformationFrame.id);
assertNull(textInformationFrame.description);
assertEquals("Hello World", textInformationFrame.value);
}
use of com.google.android.exoplayer2.metadata.Metadata in project ExoPlayer by google.
the class Id3DecoderTest method testDecodePrivFrame.
public void testDecodePrivFrame() throws MetadataDecoderException {
byte[] rawId3 = new byte[] { 73, 68, 51, 4, 0, 0, 0, 0, 0, 19, 80, 82, 73, 86, 0, 0, 0, 9, 0, 0, 116, 101, 115, 116, 0, 1, 2, 3, 4 };
Id3Decoder decoder = new Id3Decoder();
Metadata metadata = decoder.decode(rawId3, rawId3.length);
assertEquals(1, metadata.length());
PrivFrame privFrame = (PrivFrame) metadata.get(0);
assertEquals("test", privFrame.owner);
MoreAsserts.assertEquals(new byte[] { 1, 2, 3, 4 }, privFrame.privateData);
}
Aggregations