org.apache.isis.applib.value.Blob.getName()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中org.apache.isis.applib.value.Blob.getName()方法的一些代码示例,展示了Blob.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Blob.getName()方法的具体详情如下:
包路径:org.apache.isis.applib.value.Blob
类名称:Blob
方法名:getName

Blob.getName介绍

暂无

代码示例

代码示例来源:origin: org.incode.module.document/incode-module-document-dom

private static String determineName(
    final Blob document,
    final String fileName) {
  String name = fileName != null ? fileName : document.getName();
  if(!name.toLowerCase().endsWith(".pdf")) {
    name = name + ".pdf";
  }
  return name;
}

代码示例来源:origin: org.incode.example.document/incode-example-document-dom

private static String determineName(
    final Blob document,
    final String fileName) {
  String name = fileName != null ? fileName : document.getName();
  if(!name.toLowerCase().endsWith(".pdf")) {
    name = name + ".pdf";
  }
  return name;
}

代码示例来源:origin: org.apache.isis.core/isis-core-runtime

public Object getValueForDatastoreMapping(NucleusContext nucleusCtx, int index, Object value)
{
  Blob blob = ((Blob)value);
  switch (index) {
    case 0: return blob.getName();
    case 1: return blob.getMimeType().getBaseType();
    case 2: return blob.getBytes();
  }
  throw new IndexOutOfBoundsException();
}

代码示例来源:origin: org.apache.isis.core/isis-core-applib

@Override
public String toString() {
  return getName() + " [" + getMimeType().getBaseType() + "]: " + getBytes().length + " bytes";
}

代码示例来源:origin: org.incode.module.document/incode-module-document-dom

@Programmatic
public void modifyBlob(Blob blob) {
  setName(blob.getName());
  setMimeType(blob.getMimeType().toString());
  setBlobBytes(blob.getBytes());
  setSort(DocumentSort.BLOB);
}
public boolean hideBlob() {

代码示例来源:origin: org.incode.example.document/incode-example-document-dom

@Programmatic
public void modifyBlob(Blob blob) {
  setName(blob.getName());
  setMimeType(blob.getMimeType().toString());
  setBlobBytes(blob.getBytes());
  setSort(DocumentSort.BLOB);
}
public boolean hideBlob() {

代码示例来源:origin: org.apache.isis.core/isis-core-applib

@Test
public void when_blob_is_not_null() {
  final Blob val = new Blob("image.png", "image/png", new byte[]{1,2,3,4,5});
  CommonDtoUtils.setValueOn(valueDto, ValueType.BLOB, val, mockBookmarkService);
  final BlobDto blobDto = valueDto.getBlob();
  Assert.assertThat(blobDto, is(notNullValue()));
  Assert.assertThat(blobDto.getBytes(), is(val.getBytes()));
  Assert.assertThat(blobDto.getName(), is(val.getName()));
  Assert.assertThat(blobDto.getMimeType(), is(val.getMimeType().toString()));
}

代码示例来源:origin: org.apache.isis.core/isis-core-metamodel

@Test
public void testEncode_and_decode() {
  String encoded = value.toEncodedString(blob);
  assertEquals("myfile1.docx:application/vnd.ms-word:AQIDBA==", encoded);
  Blob decoded = value.fromEncodedString(encoded);
  assertThat(decoded.getName(), is("myfile1.docx"));
  assertThat(decoded.getMimeType().getPrimaryType(), is("application"));
  assertThat(decoded.getMimeType().getSubType(), is("vnd.ms-word"));
  assertThat(decoded.getBytes().length, is(4));
}

代码示例来源:origin: org.incode.example.document/incode-example-document-dom

/**
 * @param documentName - override the name of the blob (if null, then uses the blob's name)
 */
@Programmatic
public Document createForBlob(
    final DocumentType documentType,
    final String documentAtPath,
    String documentName,
    final Blob blob) {
  documentName = documentName != null? documentName: blob.getName();
  final Document document = documentRepository.create(
      documentType, documentAtPath, documentName, blob.getMimeType().getBaseType());
  document.setRenderedAt(clockService.nowAsDateTime());
  document.setState(DocumentState.RENDERED);
  document.setSort(DocumentSort.BLOB);
  document.setBlobBytes(blob.getBytes());
  return document;
}

代码示例来源:origin: org.apache.isis.core/isis-core-runtime

public void setObject(ExecutionContext ec, PreparedStatement preparedStmt, int[] exprIndex, Object value)
{
  Blob blob = ((Blob)value);
  if (blob == null) {
    getDatastoreMapping(0).setString(preparedStmt, exprIndex[0], null);
    getDatastoreMapping(1).setString(preparedStmt, exprIndex[1], null);
    // using:
    // getDatastoreMapping(2).setObject(preparedStmt, exprIndex[2], null);
    // fails for PostgreSQL, as interprets as a reference to an oid (pointer to offline blob)
    // rather than a bytea (inline blob)
    try {
      preparedStmt.setBytes(exprIndex[2], null);
    } catch (SQLException e) {
      // ignore
    }
  } else {
    getDatastoreMapping(0).setString(preparedStmt, exprIndex[0], blob.getName());
    getDatastoreMapping(1).setString(preparedStmt, exprIndex[1], blob.getMimeType().getBaseType());
    getDatastoreMapping(2).setObject(preparedStmt, exprIndex[2], blob.getBytes());
  }
}

代码示例来源:origin: org.incode.module.document/incode-module-document-dom

/**
 * @param documentName - override the name of the blob (if null, then uses the blob's name)
 */
@Programmatic
public Document createForBlob(
    final DocumentType documentType,
    final String documentAtPath,
    String documentName,
    final Blob blob) {
  documentName = documentName != null? documentName: blob.getName();
  final Document document = documentRepository.create(
      documentType, documentAtPath, documentName, blob.getMimeType().getBaseType());
  document.setRenderedAt(clockService.nowAsDateTime());
  document.setState(DocumentState.RENDERED);
  document.setSort(DocumentSort.BLOB);
  document.setBlobBytes(blob.getBytes());
  return document;
}

代码示例来源:origin: org.apache.isis.core/isis-core-applib

if(blob != null) {
  final BlobDto blobDto = new BlobDto();
  blobDto.setName(blob.getName());
  blobDto.setBytes(blob.getBytes());
  blobDto.setMimeType(blob.getMimeType().toString());

相关文章