當前位置: 首頁>>代碼示例>>Java>>正文


Java FileDescriptor.setCreateDate方法代碼示例

本文整理匯總了Java中com.haulmont.cuba.core.entity.FileDescriptor.setCreateDate方法的典型用法代碼示例。如果您正苦於以下問題:Java FileDescriptor.setCreateDate方法的具體用法?Java FileDescriptor.setCreateDate怎麽用?Java FileDescriptor.setCreateDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.haulmont.cuba.core.entity.FileDescriptor的用法示例。


在下文中一共展示了FileDescriptor.setCreateDate方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: loadImageFromFileStorage

import com.haulmont.cuba.core.entity.FileDescriptor; //導入方法依賴的package包/類
private void loadImageFromFileStorage() {
    // A file descriptor entity is usually stored in the database and referenced by an attribute of your data
    // model entity. Here we simply create it for the purpose of the example.
    FileDescriptor imageFile = metadata.create(FileDescriptor.class);
    imageFile.setId(UUID.fromString("61a6a1ee-f13a-f44f-0201-c2f9b3288305"));
    imageFile.setName("platform-logo.png");
    imageFile.setCreateDate(new Date(1427857200503L));
    imageFile.setExtension("png");

    byte[] bytes = null;
    try {
        bytes = fileStorageService.loadFile(imageFile);
    } catch (FileStorageException e) {
        showNotification("Unable to load image file", NotificationType.HUMANIZED);
    }
    if (bytes != null) {
        imageFromFileStorage.setSource(imageFile.getName(), new ByteArrayInputStream(bytes));
        imageFromFileStorage.setType(Embedded.Type.IMAGE);
    } else {
        imageFromFileStorage.setVisible(false);
    }
}
 
開發者ID:cuba-platform,項目名稱:sampler,代碼行數:23,代碼來源:ImageEmbeddedFrame.java

示例2: getFileDescriptor

import com.haulmont.cuba.core.entity.FileDescriptor; //導入方法依賴的package包/類
@Override
public FileDescriptor getFileDescriptor(UUID fileId, String name) {
    File file = getFile(fileId);
    if (file == null) {
        return null;
    }
    Metadata metadata = AppBeans.get(Metadata.NAME);

    FileDescriptor fDesc = metadata.create(FileDescriptor.class);

    fDesc.setSize(file.length());
    fDesc.setExtension(FilenameUtils.getExtension(name));
    fDesc.setName(name);
    fDesc.setCreateDate(timeSource.currentTimestamp());

    return fDesc;
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:18,代碼來源:FileUploading.java

示例3: setUp

import com.haulmont.cuba.core.entity.FileDescriptor; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    fileDescr = new FileDescriptor();
    fileDescr.setCreateDate(new Date());
    fileDescr.setSize((long) FILE_CONTENT.length());
    fileDescr.setName("AmazonFileStorageTest");
    fileDescr.setExtension("txt");

    fileDescr2 = new FileDescriptor();
    fileDescr2.setCreateDate(new Date());
    fileDescr2.setSize((long) FILE_CONTENT.length());
    fileDescr2.setName("AmazonFileStorageTest");

    fileStorageAPI = new AmazonS3FileStorage();
    fileStorageAPI.amazonS3Config = AppBeans.get(Configuration.class).getConfig(AmazonS3Config.class);
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:17,代碼來源:AmazonS3FileStorageTest.java

示例4: createFileDescriptor

import com.haulmont.cuba.core.entity.FileDescriptor; //導入方法依賴的package包/類
protected FileDescriptor createFileDescriptor(@Nullable String fileName, long size) {
    FileDescriptor fd = metadata.create(FileDescriptor.class);
    if (Strings.isNullOrEmpty(fileName)) {
        fileName = fd.getId().toString();
    }
    fd.setName(fileName);
    fd.setExtension(FilenameUtils.getExtension(fileName));
    fd.setSize(size);
    fd.setCreateDate(timeSource.currentTimestamp());
    return fd;
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:12,代碼來源:FileUploadController.java

示例5: getFileDescriptor

import com.haulmont.cuba.core.entity.FileDescriptor; //導入方法依賴的package包/類
protected FileDescriptor getFileDescriptor(HttpServletRequest request, HttpServletResponse response) throws IOException {
    String name = request.getParameter("name");
    if (name == null) {
        log.error("'name' request parameter is not specified");
        response.sendError(HttpServletResponse.SC_BAD_REQUEST);
        return null;
    }

    String ext = request.getParameter("ext");
    if (ext == null) {
        log.error("'ext' request parameter is not specified");
        response.sendError(HttpServletResponse.SC_BAD_REQUEST);
        return null;
    }

    String size = request.getParameter("size");

    FileDescriptor fd = metadata.create(FileDescriptor.class);
    fd.setName(name);
    fd.setExtension(ext);
    fd.setCreateDate(timeSource.currentTimestamp());
    if (size != null) {
        fd.setSize(Long.parseLong(size));
    }

    return fd;
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:28,代碼來源:FileUploadController.java

示例6: createAttachmentFileDescriptor

import com.haulmont.cuba.core.entity.FileDescriptor; //導入方法依賴的package包/類
protected FileDescriptor createAttachmentFileDescriptor(SendingAttachment attachment) {
    FileDescriptor contentFile = metadata.create(FileDescriptor.class);
    contentFile.setCreateDate(timeSource.currentTimestamp());
    contentFile.setName(attachment.getName());
    contentFile.setExtension(FilenameUtils.getExtension(attachment.getName()));
    contentFile.setSize((long) attachment.getContent().length);
    return contentFile;
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:9,代碼來源:Emailer.java

示例7: createBodyFileDescriptor

import com.haulmont.cuba.core.entity.FileDescriptor; //導入方法依賴的package包/類
protected FileDescriptor createBodyFileDescriptor(SendingMessage message, byte[] bodyBytes) {
    FileDescriptor contentTextFile = metadata.create(FileDescriptor.class);
    contentTextFile.setCreateDate(timeSource.currentTimestamp());
    contentTextFile.setName("Email_" + message.getId() + "." + BODY_FILE_EXTENSION);
    contentTextFile.setExtension(BODY_FILE_EXTENSION);
    contentTextFile.setSize((long) bodyBytes.length);
    return contentTextFile;
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:9,代碼來源:Emailer.java

示例8: fileUploadSucceed

import com.haulmont.cuba.core.entity.FileDescriptor; //導入方法依賴的package包/類
@Override
public void fileUploadSucceed(FileUploadField.FileUploadSucceedEvent e) {
    FileDescriptor fd = getItem();

    fd.setName(uploadField.getFileName());
    fd.setCreateDate(timeSource.currentTimestamp());
    fd.setExtension(FilenameUtils.getExtension(uploadField.getFileName()));

    FileUploadingAPI fileUploading = AppBeans.get(FileUploadingAPI.NAME);
    File file = fileUploading.getFile(uploadField.getFileId());

    fd.setSize(file.length());

    okBtn.setEnabled(true);

    nameField.requestFocus();

    needSave = true;
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:20,代碼來源:FileEditor.java


注:本文中的com.haulmont.cuba.core.entity.FileDescriptor.setCreateDate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。