Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
97a65114
Commit
97a65114
authored
Sep 10, 2024
by
Riegel
Browse files
Merge branch 'dev' into 'master'
Version 3.15.0 See merge request
!8
parents
99c8f6a8
5950ea5f
Pipeline
#10106
passed with stage
in 3 minutes and 15 seconds
Changes
589
Pipelines
1
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/model/FeatureValidationStatusReturnValue.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.model
;
public
class
FeatureValidationStatusReturnValue
{
private
int
featureId
;
private
boolean
hasError
;
public
FeatureValidationStatusReturnValue
()
{
}
public
FeatureValidationStatusReturnValue
(
int
featureId
,
boolean
hasError
)
{
super
();
this
.
featureId
=
featureId
;
this
.
hasError
=
hasError
;
}
public
int
getFeatureId
()
{
return
featureId
;
}
public
void
setFeatureId
(
int
featureId
)
{
this
.
featureId
=
featureId
;
}
public
boolean
isHasError
()
{
return
hasError
;
}
public
void
setHasError
(
boolean
hasError
)
{
this
.
hasError
=
hasError
;
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/model/LoginSuccessfulReturnType.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.model
;
import
java.time.LocalDateTime
;
public
class
LoginSuccessfulReturnType
{
private
String
token
;
private
LocalDateTime
expires
;
private
int
userId
;
public
LoginSuccessfulReturnType
(
String
token
,
LocalDateTime
expires
,
int
userId
)
{
this
.
token
=
token
;
this
.
expires
=
expires
;
this
.
userId
=
userId
;
}
public
int
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
int
userId
)
{
this
.
userId
=
userId
;
}
public
String
getToken
()
{
return
token
;
}
public
void
setToken
(
String
token
)
{
this
.
token
=
token
;
}
public
LocalDateTime
getExpires
()
{
return
expires
;
}
public
void
setExpires
(
LocalDateTime
expires
)
{
this
.
expires
=
expires
;
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/model/ModelReference.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.model
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
ModelReference
{
private
int
id
;
private
String
name
;
private
ParseStatus
status
;
private
List
<
ValidationReference
>
validations
=
new
ArrayList
<>();
public
ModelReference
(
int
id
,
String
name
,
ParseStatus
status
)
{
super
();
this
.
id
=
id
;
this
.
name
=
name
;
this
.
status
=
status
;
}
public
List
<
ValidationReference
>
getValidations
()
{
return
validations
;
}
public
void
setValidations
(
List
<
ValidationReference
>
validations
)
{
this
.
validations
=
validations
;
}
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
ParseStatus
getStatus
()
{
return
status
;
}
public
void
setStatus
(
ParseStatus
status
)
{
this
.
status
=
status
;
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/model/ParseStatus.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.model
;
public
enum
ParseStatus
{
PARSING
,
ERROR
,
OK
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/model/ValidationReference.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.model
;
import
de.hft.stuttgart.citydoctor2.webservice.model.entities.Validation
;
public
class
ValidationReference
{
private
int
id
;
private
String
name
;
private
ValidationStatus
status
;
public
static
ValidationReference
of
(
Validation
valid
)
{
return
new
ValidationReference
(
valid
.
getId
(),
valid
.
getName
(),
valid
.
getStatus
());
}
public
ValidationReference
(
int
id
,
String
name
,
ValidationStatus
status
)
{
super
();
this
.
id
=
id
;
this
.
name
=
name
;
this
.
status
=
status
;
}
public
ValidationStatus
getStatus
()
{
return
status
;
}
public
void
setStatus
(
ValidationStatus
status
)
{
this
.
status
=
status
;
}
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/model/ValidationStatus.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.model
;
public
enum
ValidationStatus
{
PARSING
,
VALIDATING
,
OK
,
ERROR
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/model/entities/FeatureValidationStatus.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.model.entities
;
import
javax.persistence.Access
;
import
javax.persistence.AccessType
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.Table
;
import
javax.validation.constraints.NotNull
;
@Entity
@Table
(
name
=
"feature_validation_status"
)
public
class
FeatureValidationStatus
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Access
(
AccessType
.
PROPERTY
)
private
int
id
;
@JoinColumn
(
name
=
"feature_id"
)
@NotNull
@ManyToOne
private
WebBuilding
feature
;
@JoinColumn
(
name
=
"validation_id"
)
@NotNull
@ManyToOne
private
Validation
validation
;
@Column
(
name
=
"has_error"
)
private
boolean
hasError
;
@Column
(
name
=
"was_validated"
)
private
boolean
wasValidated
;
public
WebBuilding
getFeature
()
{
return
feature
;
}
public
void
setFeature
(
WebBuilding
feature
)
{
this
.
feature
=
feature
;
}
public
Validation
getValidation
()
{
return
validation
;
}
public
void
setValidation
(
Validation
validation
)
{
this
.
validation
=
validation
;
}
public
boolean
isHasError
()
{
return
hasError
;
}
public
void
setHasError
(
boolean
hasError
)
{
this
.
hasError
=
hasError
;
}
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
boolean
isWasValidated
()
{
return
wasValidated
;
}
public
void
setWasValidated
(
boolean
wasValidated
)
{
this
.
wasValidated
=
wasValidated
;
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/model/entities/GmlFile.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.model.entities
;
import
javax.persistence.Access
;
import
javax.persistence.AccessType
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
@Entity
@Table
(
name
=
"gml_files"
)
public
class
GmlFile
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Access
(
AccessType
.
PROPERTY
)
private
int
id
;
@Column
(
name
=
"file_path"
,
length
=
1024
)
private
String
filePath
;
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
String
getFilePath
()
{
return
filePath
;
}
public
void
setFilePath
(
String
filePath
)
{
this
.
filePath
=
filePath
;
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/model/entities/Token.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.model.entities
;
import
java.time.LocalDateTime
;
import
javax.persistence.Access
;
import
javax.persistence.AccessType
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.Table
;
import
javax.validation.constraints.NotNull
;
@Entity
@Table
(
name
=
"token"
)
public
class
Token
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Access
(
AccessType
.
PROPERTY
)
private
int
id
;
@ManyToOne
@JoinColumn
(
name
=
"user_id"
)
@NotNull
private
User
user
;
@NotNull
private
String
address
;
@NotNull
@Column
(
name
=
"token"
)
private
String
tokenString
;
@NotNull
private
LocalDateTime
expires
;
@Override
public
String
toString
()
{
return
"Token [id="
+
id
+
", user="
+
user
+
", address="
+
address
+
", token="
+
tokenString
+
", expires="
+
expires
+
"]"
;
}
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
User
getUser
()
{
return
user
;
}
public
void
setUser
(
User
user
)
{
this
.
user
=
user
;
}
public
String
getAddress
()
{
return
address
;
}
public
void
setAddress
(
String
address
)
{
this
.
address
=
address
;
}
public
String
getTokenString
()
{
return
tokenString
;
}
public
void
setTokenString
(
String
tokenString
)
{
this
.
tokenString
=
tokenString
;
}
public
LocalDateTime
getExpires
()
{
return
expires
;
}
public
void
setExpires
(
LocalDateTime
expires
)
{
this
.
expires
=
expires
;
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/model/entities/User.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.model.entities
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.persistence.Access
;
import
javax.persistence.AccessType
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.OneToMany
;
import
javax.persistence.Table
;
import
javax.validation.constraints.NotNull
;
@Entity
@Table
(
name
=
"users"
)
public
class
User
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Access
(
AccessType
.
PROPERTY
)
private
int
id
;
@Column
(
unique
=
true
,
length
=
200
)
@NotNull
private
String
mail
;
@Column
(
name
=
"pw_hash"
)
@NotNull
private
String
passwordHash
;
@NotNull
@Column
(
length
=
16
)
private
String
salt
;
@OneToMany
(
mappedBy
=
"owner"
)
private
List
<
WebCityDoctorModel
>
ownedModels
=
new
ArrayList
<>();
public
List
<
WebCityDoctorModel
>
getOwnedModels
()
{
return
ownedModels
;
}
public
void
setOwnedModels
(
List
<
WebCityDoctorModel
>
ownedModels
)
{
this
.
ownedModels
=
ownedModels
;
}
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
String
getMail
()
{
return
mail
;
}
public
void
setMail
(
String
mail
)
{
this
.
mail
=
mail
;
}
public
String
getPasswordHash
()
{
return
passwordHash
;
}
public
void
setPasswordHash
(
String
passwordHash
)
{
this
.
passwordHash
=
passwordHash
;
}
public
String
getSalt
()
{
return
salt
;
}
public
void
setSalt
(
String
salt
)
{
this
.
salt
=
salt
;
}
@Override
public
String
toString
()
{
return
"User [id="
+
id
+
", mail="
+
mail
+
", passwordHash="
+
passwordHash
+
", salt="
+
salt
+
"]"
;
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/model/entities/Validation.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.model.entities
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.persistence.Access
;
import
javax.persistence.AccessType
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.OneToMany
;
import
javax.persistence.Table
;
import
javax.validation.constraints.NotNull
;
import
de.hft.stuttgart.citydoctor2.webservice.model.ValidationStatus
;
@Entity
@Table
(
name
=
"validations"
)
public
class
Validation
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Access
(
AccessType
.
PROPERTY
)
private
int
id
;
@ManyToOne
@NotNull
private
WebCityDoctorModel
model
;
@NotNull
private
ValidationStatus
status
;
@NotNull
private
String
name
;
@OneToMany
(
mappedBy
=
"validation"
,
orphanRemoval
=
true
)
private
List
<
WebError
>
errors
=
new
ArrayList
<>();
@OneToMany
(
mappedBy
=
"validation"
,
orphanRemoval
=
true
)
private
List
<
FeatureValidationStatus
>
errorStatus
=
new
ArrayList
<>();
@Column
(
name
=
"pdf_report"
)
private
byte
[]
pdfReport
;
@Column
(
name
=
"xml_report"
)
private
byte
[]
xmlReport
;
public
Validation
()
{
}
public
Validation
(
@NotNull
WebCityDoctorModel
model
,
@NotNull
ValidationStatus
status
,
@NotNull
String
name
)
{
super
();
this
.
model
=
model
;
this
.
status
=
status
;
this
.
name
=
name
;
}
public
List
<
FeatureValidationStatus
>
getErrorStatus
()
{
return
errorStatus
;
}
public
void
setErrorStatus
(
List
<
FeatureValidationStatus
>
errorStatus
)
{
this
.
errorStatus
=
errorStatus
;
}
public
List
<
WebError
>
getErrors
()
{
return
errors
;
}
public
void
setErrors
(
List
<
WebError
>
errors
)
{
this
.
errors
=
errors
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
WebCityDoctorModel
getModel
()
{
return
model
;
}
public
void
setModel
(
WebCityDoctorModel
model
)
{
this
.
model
=
model
;
}
public
ValidationStatus
getStatus
()
{
return
status
;
}
public
void
setStatus
(
ValidationStatus
status
)
{
this
.
status
=
status
;
}
public
byte
[]
getPdfReport
()
{
return
pdfReport
;
}
public
void
setPdfReport
(
byte
[]
pdfReport
)
{
this
.
pdfReport
=
pdfReport
;
}
public
byte
[]
getXmlReport
()
{
return
xmlReport
;
}
public
void
setXmlReport
(
byte
[]
xmlReport
)
{
this
.
xmlReport
=
xmlReport
;
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/model/entities/WebBuilding.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.model.entities
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.persistence.Access
;
import
javax.persistence.AccessType
;
import
javax.persistence.Basic
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.FetchType
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.OneToMany
;
import
javax.persistence.Table
;
import
javax.validation.constraints.NotNull
;
import
org.hibernate.search.annotations.Field
;
import
org.hibernate.search.annotations.Indexed
;
@Entity
@Table
(
name
=
"building_reference"
)
@Indexed
public
class
WebBuilding
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Access
(
AccessType
.
PROPERTY
)
private
int
id
;
@JoinColumn
(
name
=
"model_id"
)
@NotNull
@ManyToOne
private
WebCityDoctorModel
model
;
@Column
(
name
=
"gml_id"
)
@NotNull
@Field
private
String
gmlId
;
@Column
(
name
=
"model_width"
)
private
double
modelWidth
;
@Column
(
name
=
"view_data"
)
@Basic
(
fetch
=
FetchType
.
LAZY
)
private
byte
[]
viewData
;
@OneToMany
(
mappedBy
=
"building"
,
orphanRemoval
=
true
)
private
List
<
WebError
>
errors
=
new
ArrayList
<>();
@OneToMany
(
mappedBy
=
"feature"
,
orphanRemoval
=
true
)
private
List
<
FeatureValidationStatus
>
errorStatus
=
new
ArrayList
<>();
public
List
<
WebError
>
getErrors
()
{
return
errors
;
}
public
void
setErrors
(
List
<
WebError
>
errors
)
{
this
.
errors
=
errors
;
}
public
double
getModelWidth
()
{
return
modelWidth
;
}
public
void
setModelWidth
(
double
modelWidth
)
{
this
.
modelWidth
=
modelWidth
;
}
public
List
<
FeatureValidationStatus
>
getErrorStatus
()
{
return
errorStatus
;
}
public
void
setErrorStatus
(
List
<
FeatureValidationStatus
>
errorStatus
)
{
this
.
errorStatus
=
errorStatus
;
}
public
byte
[]
getViewData
()
{
return
viewData
;
}
public
void
setViewData
(
byte
[]
viewData
)
{
this
.
viewData
=
viewData
;
}
public
WebCityDoctorModel
getModel
()
{
return
model
;
}
public
void
setModel
(
WebCityDoctorModel
model
)
{
this
.
model
=
model
;
}
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
String
getGmlId
()
{
return
gmlId
;
}
public
void
setGmlId
(
String
gmlId
)
{
this
.
gmlId
=
gmlId
;
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/model/entities/WebCityDoctorModel.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.model.entities
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.persistence.Access
;
import
javax.persistence.AccessType
;
import
javax.persistence.CascadeType
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.FetchType
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.OneToMany
;
import
javax.persistence.OneToOne
;
import
javax.persistence.Table
;
import
javax.validation.constraints.NotNull
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
de.hft.stuttgart.citydoctor2.webservice.model.ParseStatus
;
@Entity
@Table
(
name
=
"web_city_doctor_model"
)
public
class
WebCityDoctorModel
{
@SuppressWarnings
(
"unused"
)
private
static
Logger
logger
=
LogManager
.
getLogger
(
WebCityDoctorModel
.
class
);
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Access
(
AccessType
.
PROPERTY
)
private
int
id
;
@NotNull
@Column
(
name
=
"file_name"
)
private
String
fileName
;
@NotNull
@Column
(
name
=
"parse_status"
)
private
ParseStatus
status
;
@NotNull
@ManyToOne
private
User
owner
;
@OneToOne
(
cascade
=
CascadeType
.
ALL
,
fetch
=
FetchType
.
LAZY
)
private
GmlFile
zipFile
;
@OneToMany
(
mappedBy
=
"model"
,
orphanRemoval
=
true
)
private
List
<
WebBuilding
>
buildings
=
new
ArrayList
<>();
@OneToMany
(
mappedBy
=
"model"
,
orphanRemoval
=
true
)
private
List
<
Validation
>
validations
=
new
ArrayList
<>();
public
List
<
Validation
>
getValidations
()
{
return
validations
;
}
public
void
setValidations
(
List
<
Validation
>
validations
)
{
this
.
validations
=
validations
;
}
public
List
<
WebBuilding
>
getBuildings
()
{
return
buildings
;
}
public
void
setBuildings
(
List
<
WebBuilding
>
buildings
)
{
this
.
buildings
=
buildings
;
}
public
GmlFile
getZipFile
()
{
return
zipFile
;
}
public
void
setZipFile
(
GmlFile
zipFile
)
{
this
.
zipFile
=
zipFile
;
}
public
User
getOwner
()
{
return
owner
;
}
public
void
setOwner
(
User
owner
)
{
this
.
owner
=
owner
;
}
public
ParseStatus
getStatus
()
{
return
status
;
}
public
void
setStatus
(
ParseStatus
status
)
{
this
.
status
=
status
;
}
public
String
getFileName
()
{
return
fileName
;
}
public
void
setFileName
(
String
fileName
)
{
this
.
fileName
=
fileName
;
}
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/model/entities/WebError.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.model.entities
;
import
javax.persistence.Access
;
import
javax.persistence.AccessType
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.validation.constraints.NotNull
;
@Entity
public
class
WebError
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Access
(
AccessType
.
PROPERTY
)
private
int
id
;
@NotNull
private
String
name
;
@JoinColumn
(
name
=
"building_id"
)
@NotNull
@ManyToOne
private
WebBuilding
building
;
@ManyToOne
@NotNull
private
Validation
validation
;
public
Validation
getValidation
()
{
return
validation
;
}
public
void
setValidation
(
Validation
validation
)
{
this
.
validation
=
validation
;
}
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
WebBuilding
getBuilding
()
{
return
building
;
}
public
void
setBuilding
(
WebBuilding
building
)
{
this
.
building
=
building
;
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/model/entities/WebGeometry.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.model.entities
;
import
javax.persistence.Access
;
import
javax.persistence.AccessType
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.validation.constraints.NotNull
;
import
de.hft.stuttgart.citydoctor2.datastructure.Lod
;
@Entity
@Table
(
name
=
"geometries"
)
public
class
WebGeometry
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Access
(
AccessType
.
PROPERTY
)
private
int
id
;
@NotNull
private
byte
[]
data
;
@NotNull
private
Lod
lod
;
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
byte
[]
getData
()
{
return
data
;
}
public
void
setData
(
byte
[]
data
)
{
this
.
data
=
data
;
}
public
Lod
getLod
()
{
return
lod
;
}
public
void
setLod
(
Lod
lod
)
{
this
.
lod
=
lod
;
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/utils/AuthenticationUtils.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.utils
;
import
java.time.LocalDateTime
;
import
javax.persistence.EntityManager
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.ws.rs.core.HttpHeaders
;
import
de.hft.stuttgart.citydoctor2.webservice.AuthenticationException
;
import
de.hft.stuttgart.citydoctor2.webservice.database.TokenQueries
;
import
de.hft.stuttgart.citydoctor2.webservice.model.entities.Token
;
import
de.hft.stuttgart.citydoctor2.webservice.model.entities.User
;
public
class
AuthenticationUtils
{
public
static
final
String
AUTHENTICATION_DENIED
=
"Authentication denied for address {}, reason: {}"
;
private
AuthenticationUtils
()
{
// only static use
}
public
static
User
authenticateUser
(
HttpServletRequest
request
,
EntityManager
manager
)
throws
AuthenticationException
{
final
String
authorization
=
request
.
getHeader
(
HttpHeaders
.
AUTHORIZATION
);
if
(
authorization
!=
null
&&
authorization
.
toLowerCase
().
startsWith
(
"bearer"
))
{
// Authorization: Bearer token
String
token
=
authorization
.
substring
(
"Bearer"
.
length
()).
trim
();
return
validateToken
(
token
,
request
.
getRemoteAddr
(),
manager
);
}
throw
new
AuthenticationException
(
"No bearer token provided with request"
);
}
private
static
User
validateToken
(
String
token
,
String
remoteAddr
,
EntityManager
manager
)
throws
AuthenticationException
{
Token
tokenForUser
=
TokenQueries
.
getTokenForTokenString
(
token
,
remoteAddr
,
manager
);
if
(
tokenForUser
==
null
)
{
throw
new
AuthenticationException
(
"No token for user"
);
}
if
(!
tokenForUser
.
getTokenString
().
equals
(
token
))
{
throw
new
AuthenticationException
(
"Token does not match"
);
}
LocalDateTime
now
=
LocalDateTime
.
now
();
if
(
tokenForUser
.
getExpires
().
isBefore
(
now
))
{
throw
new
AuthenticationException
(
"Token expired"
);
}
// update expiration date
TokenQueries
.
updateExpirationDate
(
now
.
plusHours
(
3
),
tokenForUser
,
manager
);
return
tokenForUser
.
getUser
();
}
public
static
void
removeTokenFromUser
(
HttpServletRequest
request
,
EntityManager
manager
)
throws
AuthenticationException
{
final
String
authorization
=
request
.
getHeader
(
HttpHeaders
.
AUTHORIZATION
);
if
(
authorization
!=
null
&&
authorization
.
toLowerCase
().
startsWith
(
"bearer"
))
{
String
token
=
authorization
.
substring
(
"Bearer"
.
length
()).
trim
();
Token
tokenForUser
=
TokenQueries
.
getTokenForTokenString
(
token
,
request
.
getRemoteAddr
(),
manager
);
if
(
tokenForUser
==
null
)
{
throw
new
AuthenticationException
(
"No token for user"
);
}
manager
.
getTransaction
().
begin
();
manager
.
remove
(
tokenForUser
);
manager
.
getTransaction
().
commit
();
return
;
}
throw
new
AuthenticationException
(
"No bearer token provided with request"
);
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/utils/HashUtils.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.utils
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.Base64
;
public
class
HashUtils
{
private
HashUtils
()
{
// only static use
}
public
static
String
createPasswordHash
(
String
password
,
String
salt
)
throws
NoSuchAlgorithmException
{
MessageDigest
digest
=
MessageDigest
.
getInstance
(
"SHA-256"
);
digest
.
update
(
salt
.
getBytes
());
digest
.
update
(
password
.
getBytes
());
return
Base64
.
getEncoder
().
encodeToString
(
digest
.
digest
());
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/utils/HexUtils.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.utils
;
public
class
HexUtils
{
private
HexUtils
()
{
// not used
}
public
static
String
encode
(
byte
[]
bytes
)
{
return
encodeHexString
(
bytes
);
}
private
static
String
encodeHexString
(
byte
[]
byteArray
)
{
StringBuilder
hexStringBuffer
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
byteArray
.
length
;
i
++)
{
byte
num
=
byteArray
[
i
];
hexStringBuffer
.
append
(
Character
.
forDigit
((
num
>>
4
)
&
0xF
,
16
));
hexStringBuffer
.
append
(
Character
.
forDigit
((
num
&
0xF
),
16
));
}
return
hexStringBuffer
.
toString
();
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/java/de/hft/stuttgart/citydoctor2/webservice/utils/HibernateUtils.java
0 → 100644
View file @
97a65114
package
de.hft.stuttgart.citydoctor2.webservice.utils
;
import
javax.persistence.EntityManager
;
import
javax.persistence.EntityManagerFactory
;
import
javax.persistence.Persistence
;
public
class
HibernateUtils
{
private
HibernateUtils
()
{
// only static use
}
private
static
EntityManagerFactory
factory
;
public
static
void
init
()
{
if
(
factory
==
null
)
{
factory
=
Persistence
.
createEntityManagerFactory
(
"CDPersistence"
);
}
}
public
static
EntityManager
createManager
()
{
init
();
return
factory
.
createEntityManager
();
}
public
static
void
shutdown
()
{
if
(
factory
!=
null
)
{
factory
.
close
();
}
}
public
static
void
closeManager
(
EntityManager
manager
)
{
if
(
manager
!=
null
)
{
manager
.
close
();
}
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/main/resources/Logo.png
0 → 100644
View file @
97a65114
21.4 KB
Prev
1
…
23
24
25
26
27
28
29
30
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment