<commit_before>package com.nulabinc.backlog.migration.common.service

import java.io.InputStream
import javax.inject.Inject

import com.nulabinc.backlog.migration.common.client.BacklogAPIClient
import com.nulabinc.backlog.migration.common.client.params.{
  ImportDeleteAttachmentParams,
  ImportIssueParams
}
import com.nulabinc.backlog.migration.common.convert.Convert
import com.nulabinc.backlog.migration.common.convert.writes.IssueWrites
import com.nulabinc.backlog.migration.common.domain._
import com.nulabinc.backlog.migration.common.utils.{DateUtil, Logging, StringUtil}
import com.nulabinc.backlog4j.CustomField.FieldType
import com.nulabinc.backlog4j.Issue.PriorityType
import com.nulabinc.backlog4j._
import com.nulabinc.backlog4j.api.option._
import com.osinka.i18n.Messages
import io.lemonlabs.uri._

import scala.jdk.CollectionConverters._

/**
 * @author uchida
 */
class IssueServiceImpl @Inject() (implicit
    issueWrites: IssueWrites,
    backlog: BacklogAPIClient
) extends IssueService
    with Logging {

  override def issueOfId(id: Long): BacklogIssue =
    Convert.toBacklog(backlog.getIssue(id))

  override def optIssueOfId(id: Long): Option[Issue] =
    try {
      Some(backlog.getIssue(id))
    } catch {
      case _: Throwable => None
    }

  override def optIssueOfKey(key: String): Option[BacklogIssue] =
    try {
      Some(issueOfKey(key))
    } catch {
      case _: Throwable => None
    }

  override def issueOfKey(key: String): BacklogIssue =
    Convert.toBacklog(backlog.getIssue(key))

  override def optIssueOfParams(
      projectId: Long,
      backlogIssue: BacklogIssue
  ): Option[BacklogIssue] = {
    val params: GetIssuesParams = new GetIssuesParams(List(projectId).asJava)
    for { created <- backlogIssue.operation.optCreated } yield {
      if (created.nonEmpty) {
        params.createdSince(DateUtil.isoToDateFormat(created))
      }
    }<commit_msg>BLGMIGRATION-985 remove: remove createdSince from GetIssuesParams<commit_after>package com.nulabinc.backlog.migration.common.service

import java.io.InputStream
import javax.inject.Inject

import com.nulabinc.backlog.migration.common.client.BacklogAPIClient
import com.nulabinc.backlog.migration.common.client.params.{
  ImportDeleteAttachmentParams,
  ImportIssueParams
}
import com.nulabinc.backlog.migration.common.convert.Convert
import com.nulabinc.backlog.migration.common.convert.writes.IssueWrites
import com.nulabinc.backlog.migration.common.domain._
import com.nulabinc.backlog.migration.common.utils.{DateUtil, Logging, StringUtil}
import com.nulabinc.backlog4j.CustomField.FieldType
import com.nulabinc.backlog4j.Issue.PriorityType
import com.nulabinc.backlog4j._
import com.nulabinc.backlog4j.api.option._
import com.osinka.i18n.Messages
import io.lemonlabs.uri._

import scala.jdk.CollectionConverters._

/**
 * @author uchida
 */
class IssueServiceImpl @Inject() (implicit
    issueWrites: IssueWrites,
    backlog: BacklogAPIClient
) extends IssueService
    with Logging {

  override def issueOfId(id: Long): BacklogIssue =
    Convert.toBacklog(backlog.getIssue(id))

  override def optIssueOfId(id: Long): Option[Issue] =
    try {
      Some(backlog.getIssue(id))
    } catch {
      case _: Throwable => None
    }

  override def optIssueOfKey(key: String): Option[BacklogIssue] =
    try {
      Some(issueOfKey(key))
    } catch {
      case _: Throwable => None
    }

  override def issueOfKey(key: String): BacklogIssue =
    Convert.toBacklog(backlog.getIssue(key))

  override def optIssueOfParams(
      projectId: Long,
      backlogIssue: BacklogIssue
  ): Option[BacklogIssue] = {
    val params: GetIssuesParams = new GetIssuesParams(List(projectId).asJava)
{'fraction_non_alphanumeric': 0.099622030237581, 'fraction_numerical': 0.004049676025917927, 'mean_word_length': 4.440528634361233, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5329807', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1238, 'n_words': 206}