Class FileAttribute

All Implemented Interfaces:
Viewable, Cacheable, Observed, Retrievable, Serializable, ColumnAccessByName, ObjectModel, Persistent
Direct Known Subclasses:
AudioAttribute, ParentsStoreAttribute, PreBuildAttribute, PreBuildScheduleAttribute, TestSheetFileAttribute

public class FileAttribute extends FreeFormAttribute
Author:
Youngho Cho
See Also:
  • Field Details

    • GET_DATA

      protected static final String GET_DATA
      method results cache key
      See Also:
    • bt

      protected transient byte[] bt
      DOCUMENT ME!
  • Constructor Details

    • FileAttribute

      public FileAttribute()
      Creates a new FileAttribute object.
  • Method Details

    • setByte

      public void setByte(byte[] bt)
      DOCUMENT ME!
      Parameters:
      bt - DOCUMENT ME!
    • getByte

      public byte[] getByte()
      DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • getFileItem

      public org.apache.commons.fileupload.FileItem getFileItem()
      업로드된 FileItem 을 구한다.
      Returns:
      value of fileItem.
    • setFileItem

      public void setFileItem(org.apache.commons.fileupload.FileItem v)
      Set the value of file.
      Parameters:
      v - Value to assign to file.
    • getActivityDescription

      public String getActivityDescription() throws TorqueException
      extra info to save description in activity record and save File into filesystem
      Overrides:
      getActivityDescription in class AttributeValue
      Returns:
      activity 설명
      Throws:
      TorqueException - 조회 중 오류가 발생한 경우
    • saveFile

      public String saveFile() throws Exception
      속성에 따라 File 을 저장하는 Mechenism 을 달리 구현한다.
      Returns:
      saved location
      Throws:
      Exception - DOCUMENT ME!
    • hasFile

      public boolean hasFile() throws Exception
      DOCUMENT ME!
      Returns:
      DOCUMENT ME!
      Throws:
      Exception - DOCUMENT ME!
    • getFullPath

      public String getFullPath() throws Exception
      Deprecated.
      please use getResource(getValue()).getPath() instead
      Prepends the base repository path to the path returned by getRelativePath().
      Returns:
      DOCUMENT ME!
      Throws:
      Exception - DOCUMENT ME!
    • getRelativePath

      public String getRelativePath() throws Exception
      Repository 에 대한 첨부 파일의 상대 경로를 구한다.

      The path to an attachment file relative to the base file repository. Files are saved according to: moduleId/(item_IdCount/100)/itemID_attID_filename where moduleId and attId are primary keys of the related module and this attachment. itemID is the unique id generally used to specify the item within the ui. item_IdCount is the numerical suffix of the unique id. So if the pk of module PACS is 201 and this attachment pk is 123 the path would be: 201/0/PACS5_123_diff.txt or if the item count were higher: 201/2/PACS2115_123_diff.txt. The first two directories are used to keep the number of files per directory reasonable while the item unique id and the final textual filename allow someone browsing the file system to be better able to pick out relevant files.

      Returns:
      relativePath String
      Throws:
      Exception - 경로를 구하는 중 오류가 발생한 경우
    • copyFileTo

      public void copyFileTo(String path) throws Exception
      DOCUMENT ME!
      Parameters:
      path - DOCUMENT ME!
      Throws:
      Exception - DOCUMENT ME!
    • copyFileTo

      public void copyFileTo(File toFile) throws Exception
      Repository 의 파일을 주어진 파일로 복사한다.
      Parameters:
      toFile - 복사할 대상 파일
      Throws:
      Exception - 복사 중 오류가 발생한 경우
    • getData

      public String getData() throws Exception
      File Data 를 UTF-8 로 읽어서 구한다.
      Returns:
      파일 내용
      Throws:
      Exception - 파일을 읽는 중 오류가 발생한 경우
    • getData

      public String getData(Charset encoding) throws Exception
      File Data 를 구한다.
      Parameters:
      encoding - 파일의 문자 인코딩
      Returns:
      파일 내용
      Throws:
      Exception - 파일을 읽는 중 오류가 발생한 경우
    • getData

      public String getData(File file, Charset encoding) throws Exception
      File Data 를 구한다. TODO : UTF-8 로 고정
      Parameters:
      file - 읽을 파일
      encoding - 파일의 문자 인코딩
      Returns:
      파일 내용
      Throws:
      Exception - 파일을 읽는 중 오류가 발생한 경우
    • copy

      public AttributeValue copy() throws TorqueException
      copy 시 file 도 같이 복사.
      Overrides:
      copy in class BaseAttributeValue
      Returns:
      복사된 AttributeValue
      Throws:
      TorqueException - 복사 중 오류가 발생한 경우
    • setProperties

      public void setProperties(AttributeValue attVal1) throws TorqueException
      Sets the properties of one attribute value based on another NOTE: Does not copy the deleted field
      Overrides:
      setProperties in class AttributeValue
      Parameters:
      attVal1 - DOCUMENT ME!
      Throws:
      TorqueException - DOCUMENT ME!
    • getFile

      public File getFile() throws Exception
      Repository 의 File 을 구한다.
      Returns:
      File
      Throws:
      Exception - 파일을 구하는 중 오류가 발생한 경우
    • getExtension

      public String getExtension() throws Exception
      이 속성과 연관된 파일의 Extension 을 구한다.
      Returns:
      파일 확장자
      Throws:
      Exception - 파일을 구하는 중 오류가 발생한 경우
    • setRandomValue

      public void setRandomValue() throws Exception
      random 값으로 value 를 설정한다.
      Throws:
      Exception - 값 설정 중 오류가 발생한 경우
    • getDisplayedValue

      public CharSequence getDisplayedValue(String type) throws Exception
      기본 locale(아이템의 locale)로 화면에 표시할 값을 구한다.
      Overrides:
      getDisplayedValue in class FreeFormAttribute
      Parameters:
      type - 표시 형식
      Returns:
      화면에 표시할 값
      Throws:
      Exception - 값을 구하는 중 오류가 발생한 경우
    • getDisplayedValue

      public CharSequence getDisplayedValue(String type, Locale locale) throws Exception
      지정한 locale 로 화면에 표시할 값을 구한다. 기본 구현은 저장된 값을 그대로 반환한다.
      Overrides:
      getDisplayedValue in class FreeFormAttribute
      Parameters:
      type - 표시 형식
      locale - 표시에 사용할 locale
      Returns:
      화면에 표시할 값
      Throws:
      Exception - 값을 구하는 중 오류가 발생한 경우
    • getFormatter

      public Object getFormatter(Locale locale) throws Exception
      formatter 를 구한다. 기본 구현은 value 를 그대로 반환한다.
      Overrides:
      getFormatter in class FreeFormAttribute
      Parameters:
      locale - 표시에 사용할 locale
      Returns:
      object
      Throws:
      Exception - 값을 구하는 중 오류가 발생한 경우
    • getDocument

      public Document getDocument()
      일단 FileAttribute 는 indexing 을 하지 않는다. 추후 FileAttribute 의 특성에 맞게 indexing 을 처리한다.
      Returns:
      document
    • hasValue

      public boolean hasValue(Object checkValue) throws Exception
      DOCUMENT ME!
      Specified by:
      hasValue in class AttributeValue
      Parameters:
      checkValue - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
      Throws:
      Exception - DOCUMENT ME!