Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ If any files are returned, you should check to see if these files affected and a
- Updated swagger documentation
- Return 404 not found when calling file/dataset/space api endpoints with an invalid ID [#251](https://github.com/clowder-framework/clowder/issues/251)
- Line breaks in welcome message breaks swagger build [#187](https://github.com/clowder-framework/clowder/issues/187)
- Collections created using api route are now indexed upon creation. [#257](https://github.com/clowder-framework/clowder/issues/257)

### Changed
- Added more information when writing files to make sure files are written correctly
Expand Down
49 changes: 30 additions & 19 deletions app/api/Collections.scala
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
package api

import java.io.{ByteArrayInputStream, InputStream, ByteArrayOutputStream}
import java.security.{DigestInputStream, MessageDigest}
import java.text.SimpleDateFormat
import java.util.zip.{ZipEntry, ZipOutputStream, Deflater}

import Iterators.RootCollectionIterator
import _root_.util.JSONLD
import util.SearchUtils
import api.Permission.Permission
import org.apache.commons.codec.binary.Hex
import controllers.Utils
import models._
import play.api.Logger
import play.api.Play.current
import models._
import play.api.libs.concurrent.Execution.Implicits._
import play.api.libs.iteratee.Enumerator
import services._
import play.api.libs.json._
import play.api.libs.json.{JsObject, JsValue}
import play.api.libs.json.Json.toJson
import javax.inject.{ Singleton, Inject}
import scala.collection.mutable.ListBuffer
import scala.concurrent.{Future, ExecutionContext}
import play.api.libs.concurrent.Execution.Implicits._
import scala.util.parsing.json.JSONArray
import scala.util.{Try, Success, Failure}
import java.util.{Calendar, Date}
import controllers.Utils
import play.api.libs.json.{JsObject, JsValue, _}
import services._


import java.io.ByteArrayOutputStream
import java.security.MessageDigest
import java.util.zip.{Deflater, ZipOutputStream}
import java.util.{Calendar, Date}
import javax.inject.{Inject, Singleton}
import scala.collection.immutable.List
import scala.collection.mutable.ListBuffer
import scala.concurrent.{ExecutionContext, Future}
import scala.util.{Failure, Success, Try}


/**
Expand Down Expand Up @@ -72,6 +68,13 @@ class Collections @Inject() (datasets: DatasetService,
collections.addToRootSpaces(c.id, s.id)
events.addSourceEvent(request.user, c.id, c.name, s.id, s.name, EventType.ADD_COLLECTION_SPACE.toString)
})
// index collection
current.plugin[ElasticsearchPlugin].foreach{
_.index(SearchUtils.getElasticsearchObject(c))
}
//Add to Events Table
val option_user = userService.findByIdentity(identity)
events.addObjectEvent(option_user, c.id, c.name, EventType.CREATE_COLLECTION.toString)
Ok(toJson(Map("id" -> id)))
}
case None => Ok(toJson(Map("status" -> "error")))
Expand Down Expand Up @@ -598,6 +601,14 @@ class Collections @Inject() (datasets: DatasetService,
events.addSourceEvent(request.user, c.id, c.name, s.id, s.name, EventType.ADD_COLLECTION_SPACE.toString)
}

// index collection
current.plugin[ElasticsearchPlugin].foreach{
_.index(SearchUtils.getElasticsearchObject(c))
}
//Add to Events Table
val option_user = userService.findByIdentity(identity)
events.addObjectEvent(option_user, c.id, c.name, EventType.CREATE_COLLECTION.toString)

//do stuff with parent here
(request.body \"parentId").asOpt[String] match {
case Some(parentId) => {
Expand Down