Alfresco webscript scala控制器未被执行

时间:2014-12-20 10:52:28

标签: scala maven alfresco

我正在尝试在露天编写scala webscript控制器,我有以下maven依赖项:

        <!--scala dependencies -->
    <dependency>
        <groupId>org.scala-lang</groupId>
        <artifactId>scala-compiler</artifactId>
        <version>LATEST</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.scala-lang</groupId>
        <artifactId>scala-library</artifactId>
        <version>LATEST</version>
    </dependency>

    <dependency>
        <groupId>com.typesafe.scala-logging</groupId>
        <artifactId>scala-logging-slf4j_2.11</artifactId>
        <version>2.1.2</version>
    </dependency>

以下个人资料(已启用)

<!--Scala profile-->
<profile>
    <id>include-scala</id>
    <build>
        <plugins>
            <plugin>
                <groupId>org.scala-tools</groupId>
                <artifactId>maven-scala-plugin</artifactId>
                <version>2.14.3</version>
                <configuration>
                    <charset>UTF-8</charset>
                    <jvmArgs>
                        <jvmArg>-Xmx1024m</jvmArg>
                    </jvmArgs>
                </configuration>
                <executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <phase>compile</phase>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <phase>test-compile</phase>
                    </execution>
                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</profile>

控制器:

import org.slf4j.LoggerFactory
import com.typesafe.scalalogging.slf4j.Logger
import dk.openesdh.repo.services.cases.CaseService
import dk.openesdh.repo.services.documents.DocumentService
import org.alfresco.service.cmr.repository.{InvalidNodeRefException, NodeRef}
import org.springframework.extensions.webscripts.{Cache, DeclarativeWebScript, Status, WebScriptRequest}

class DocumentCaseContainers(val caseService: CaseService, val documentService:DocumentService) extends DeclarativeWebScript{
   protected override def executeImpl(req: WebScriptRequest, status: Status, cache: Cache) :  java.util.Map[String, Object] = {

     val templateArgs = req.getServiceMatch.getTemplateVars
     val logger = Logger(LoggerFactory.getLogger(classOf[DocumentCaseContainers]))

     try {
       val storeType: String = templateArgs.get ("store_type")
       val storeId: String = templateArgs.get ("store_id")
       val id: String = templateArgs.get ("id")
       val docNodeRefStr = s"$storeType://$storeId/$id"
       val documentNode: NodeRef = new NodeRef (docNodeRefStr)
       val caseNodeRef = documentService.getCaseNodeRef(documentNode)
       val caseDocumentNodeRef = caseService.getDocumentsFolder(caseNodeRef)
       val model: Map[java.lang.String, java.lang.Object] = new HashMap[java.lang.String, java.lang.Object] ()
   model.put("caseNodeRef", caseNodeRef)
   model.put("caseDocumentNodeRef", caseDocumentNodeRef)

       model
     }
     catch {
       case inre: InvalidNodeRefException => {
         logger.error(inre.getMessage)
         null
       }
     }
   }
}

结果是我对返回的映射中的变量得到null,更多的是,logger语句不会打印在日志中。
我目前正在使用maven 2.0 sdk beta-4版本并在intelliJ IDEA中运行它。

0 个答案:

没有答案