Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove obsolete functions from StringFormatter #1640

Merged
merged 3 commits into from May 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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