Skip to content

Commit

Permalink
chore: Remove obsolete functions from StringFormatter. (#1640)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Geer committed May 4, 2020
1 parent 683a3ed commit 5fa6de4
Showing 1 changed file with 0 additions and 48 deletions.
48 changes: 0 additions & 48 deletions webapi/src/main/scala/org/knora/webapi/util/StringFormatter.scala
Expand Up @@ -2345,25 +2345,6 @@ class StringFormatter private(val maybeSettings: Option[SettingsImpl] = None, ma
}
}

/**
* Checks that a string represents a valid path for a `knora-base:Map`. A valid path must be a sequence of names
* separated by slashes (`/`). Each name must be a valid XML
* [[https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName NCName]].
*
* @param mapPath the path to be checked.
* @param errorFun a function that throws an exception. It will be called if the path is invalid.
* @return the same path.
*/
def validateMapPath(mapPath: String, errorFun: => Nothing): String = {
val splitPath: Array[String] = mapPath.split('/')

for (name <- splitPath) {
validateNCName(name, errorFun)
}

mapPath
}

/**
* Determines whether a URL path refers to a built-in API v2 ontology (simple or complex).
*
Expand Down Expand Up @@ -3021,35 +3002,6 @@ class StringFormatter private(val maybeSettings: Option[SettingsImpl] = None, ma
s"http://$IriDomain/permissions/$shortcode/$knoraPermissionUuid"
}

/**
* Creates an IRI for a `knora-base:Map`.
*
* @param mapPath the map's path, which must be a sequence of names separated by slashes (`/`). Each name must
* be a valid XML [[https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName NCName]].
* @return the IRI of the map.
*/
def makeMapIri(mapPath: String): IRI = {
s"http://$IriDomain/maps/$mapPath"
}

/**
* Extracts the path of a persistent map from the IRI of a `knora-base:Map`.
*
* @param mapIri the IRI of the `knora-base:Map`.
* @return the map's path.
*/
def mapIriToMapPath(mapIri: IRI): String = {
mapIri.stripPrefix(s"http://$IriDomain/maps/")
}

/**
* Creates a random IRI for a `knora-base:MapEntry`.
*/
def makeRandomMapEntryIri: IRI = {
val mapEntryUuid = makeRandomBase64EncodedUuid
s"http://$IriDomain/map-entries/$mapEntryUuid"
}

/**
* Converts a camel-case string like `FooBar` into a string like `foo-bar`.
*
Expand Down

0 comments on commit 5fa6de4

Please sign in to comment.