Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • app/services/SchedulerService.scala

    Code Block
    languagescala
    collapsetrue
    def getJobByTime(minute: Integer, hour: Integer, day_of_week: Integer, day_of_month: Integer): List[TimerJob]
  • app/services/mongoldb/MongoDBSchedulerService.scala

    Code Block
    languagescala
    collapsetrue
    def getJobByTime(minute: Integer, hour: Integer, day_of_week: Integer, day_of_month: Integer): List[TimerJob] ={
        val jobs = Jobs.find(
          $and(
            // either day_of_month exists AND the value is 'day_of_month' OR day_of_month does not exist
            $or($and("day_of_month" $exists true, MongoDBObject("day" -> day_of_month)), "day_of_month" $exists false),
            // either day_of_week exists AND the value is 'day_of_week' OR day_of_week does not exist
            $or($and("day_of_week" $exists true, MongoDBObject("day_of_week" -> day_of_week)), "day_of_week" $exists false),
            // either hour exists AND the value is 'hour' OR hour does not exist
            $or($and("hour" $exists true, MongoDBObject("hour" -> hour)), "hour" $exists false),
            // either minute exists AND the value is 'minute' OR minute does not exist
            $or($and("minute" $exists true, MongoDBObject("minute" -> minute)), "minute" $exists false)
          )
        )
    Code Block
    languagescala
    collapsetrue
    def updateJobTime(name: String, minute: Option[Integer], hour: Option[Integer], day_of_week: Option[Integer], day_of_month: Option[Integer], freq: Option[String]) = {
        if (minute == None){
          Jobs.dao.update(MongoDBObject("name" -> name), $unset("minute"))
        }
        else {
          Jobs.dao.update(MongoDBObject("name" -> name), $set("minute" -> minute))
        }
    
        if (hour == None){
          Jobs.dao.update(MongoDBObject("name" -> name), $unset("hour"))
        }
        else {
          Jobs.dao.update(MongoDBObject("name" -> name), $set("hour" -> hour))
        }
    
        if (day_of_week == None){
          Jobs.dao.update(MongoDBObject("name" -> name), $unset("day_of_week"))
        }
        else {
          Jobs.dao.update(MongoDBObject("name" -> name), $set("day_of_week" -> day_of_week))
        }
    
        if (day_of_month == None){
          Jobs.dao.update(MongoDBObject("name" -> name), $unset("day_of_month"))
        }
        else {
          Jobs.dao.update(MongoDBObject("name" -> name), $set("day_of_month" -> day_of_month))
        }
    
        Jobs.dao.update(MongoDBObject("name" -> name), $set("frequency" -> freq))
      }
  • add extra parameter (None) to updateEmailJob()

Testing

...

  1. Add functioning e-mail in app/util/Mail.scala if you use a 'fake' e-mail in your local Clowder developmental branch

    Code Block
    languagescala
    collapsetrue
    def sendEmail(subject: String, user: Option[User], recipient: User, body: Html) {
    	if (recipient.email.isDefined) {
        	Logger.debug("Subject:" + subject + ", From:" + emailAddress(user) + ", Recipient: " + emailAddress(Some(recipient)) + ", Body:")
    		//sendEmail(subject, emailAddress(user), emailAddress(Some(recipient))::Nil, body)
    		sendEmail(subject, emailAddress(user), List("yourEMail@illinois.edu"), body)
    	}
    }

...

  1. Use functioning smtp in securesocial.conf

...

  1. or override it by setting smtp.host and (optional) smtp.from in your custom.conf

...

  1. Code Block
    languagescala
    smtp.host=smtp.ncsa.illinois.edu

...

  1. 
    smtp.from="

...

  1. ondrejce@illinois.edu"

...

  1. Note that the host above can be used only within the NCSA's network.

     

 

 

...