All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openurp.degree.thesis.service.DefaultModule.scala Maven / Gradle / Ivy

/*
 * Copyright (C) 2014, The OpenURP Software.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see .
 */

package org.openurp.degree.thesis.service

import org.beangle.commons.cdi.BindModule
import org.beangle.ems.app.EmsApp
import org.openurp.degree.thesis.service.impl.*
import org.openurp.edu.grade.service.impl.GradeRateServiceImpl

import java.io.FileInputStream

class DefaultModule extends BindModule {

  protected override def binding(): Unit = {
    bind(classOf[DefenseGroupServiceImpl])
    bind(classOf[ThesisPlanServiceImpl])
    bind(classOf[DeferServiceImpl])
    bind(classOf[ThesisCheckServiceImpl])
    bind(classOf[SubjectServiceImpl])
    bind(classOf[AdvisorServiceImpl])

    bind(classOf[ThesisGradeSyncServiceImpl])
    bind(classOf[GradeRateServiceImpl])

    EmsApp.getAppFile foreach { file =>
      val is = new FileInputStream(file)
      val app = scala.xml.XML.load(is)
      var base: String = null
      var appId: String = null
      var appPassword: String = null
      (app \\ "sms") foreach { e =>
        base = (e \ "@base").text.trim
        appId = (e \ "@appId").text.trim
        appPassword = (e \ "@appPassword").text.trim
      }
      is.close()
      if (base != null && null != appId && null != appPassword)
        bind(classOf[EcuplSmsServiceImpl]).constructor(base, appId, appPassword)
    }
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy