@@ -28,12 +28,12 @@ import com.linkedplanet.kotlininsightclient.api.model.AttachmentId
2828import com.linkedplanet.kotlininsightclient.api.model.InsightAttachment
2929import com.linkedplanet.kotlininsightclient.api.model.InsightObjectId
3030import com.linkedplanet.kotlininsightclient.sdk.services.ReverseEngineeredAttachmentUrlResolver
31- import com.linkedplanet.kotlininsightclient.sdk.services.ReverseEngineeredFileManager
3231import com.linkedplanet.kotlininsightclient.sdk.util.catchAsInsightClientError
3332import com.linkedplanet.kotlininsightclient.sdk.util.getOSGiComponent
3433import com.linkedplanet.kotlininsightclient.sdk.util.toISOString
3534import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade
3635import com.riadalabs.jira.plugins.insight.services.model.AttachmentBean
36+ import java.io.ByteArrayInputStream
3737import java.io.InputStream
3838import java.io.PipedInputStream
3939import java.io.PipedOutputStream
@@ -47,12 +47,9 @@ import java.util.zip.ZipEntry
4747import java.util.zip.ZipOutputStream
4848import kotlin.io.path.createTempFile
4949
50-
5150object SdkInsightAttachmentOperator : InsightAttachmentOperator {
5251
5352 private val objectFacade: ObjectFacade by getOSGiComponent()
54-
55- private val fileManager = ReverseEngineeredFileManager ()
5653 private val attachmentUrlResolver = ReverseEngineeredAttachmentUrlResolver ()
5754
5855 override suspend fun getAttachments (objectId : InsightObjectId ): Either <InsightClientError , List <InsightAttachment >> =
@@ -66,7 +63,9 @@ object SdkInsightAttachmentOperator : InsightAttachmentOperator {
6663 catchAsInsightClientError {
6764 val attachmentId = attachmentUrlResolver.parseAttachmentIdFromPathInformation(url)
6865 val attachmentBean = objectFacade.loadAttachmentBeanById(attachmentId)
69- fileManager.getObjectAttachmentContent(attachmentBean.objectId, attachmentBean.nameInFileSystem)
66+ // TODO: Replace with REST-based retrieval
67+ // val url = "/rest/insight/1.0/object/${objectId}/attachment/${attachmentId}/download"
68+ ByteArrayInputStream (ByteArray (0 ))
7069 }.mapLeft { OtherNotFoundError (" Attachment download failed for url:$url " ) }
7170
7271 override suspend fun downloadAttachmentZip (objectId : InsightObjectId ): Either <InsightClientError , InputStream > =
@@ -79,7 +78,8 @@ object SdkInsightAttachmentOperator : InsightAttachmentOperator {
7978 catchAsInsightClientError {
8079 val attachmentBeans = objectFacade.findAttachmentBeans(objectId.raw)
8180 attachmentBeans.map { bean ->
82- val attachmentContent = fileManager.getObjectAttachmentContent(bean.objectId, bean.nameInFileSystem)
81+ // TODO: Replace with REST-based retrieval
82+ val attachmentContent = ByteArrayInputStream (ByteArray (0 ))
8383 bean.filename to attachmentContent
8484 }.toMap()
8585 }
0 commit comments