Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eclipse Projects
Eclipse openK User Modules
org.eclipse.openk-usermodules.gridFailureInformation.backend
Commits
d9d19738
Commit
d9d19738
authored
Feb 13, 2020
by
dietricf
Browse files
Initial Commit
parent
74a1ba4a
Changes
89
Hide whitespace changes
Inline
Side-by-side
src/main/asciidoc/img/stornieren.png
0 → 100644
View file @
d9d19738
685 Bytes
src/main/asciidoc/img/stornieren_kommentar.png
0 → 100644
View file @
d9d19738
10.8 KB
src/main/asciidoc/img/tabellen-filter.png
0 → 100644
View file @
d9d19738
14.5 KB
src/main/asciidoc/img/vordefinierte_filter.png
0 → 100644
View file @
d9d19738
2.65 KB
src/main/java/org/eclipse/openk/gridfailure
I
nformation/GridFailureInformationApplication.java
→
src/main/java/org/eclipse/openk/gridfailure
i
nformation/GridFailureInformationApplication.java
View file @
d9d19738
package
org.eclipse.openk.gridfailure
I
nformation
;
package
org.eclipse.openk.gridfailure
i
nformation
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
@SpringBootApplication
@EnableSwagger2
@EnableFeignClients
public
class
GridFailureInformationApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
GridFailureInformationApplication
.
class
,
args
);
// passing through args is a security issue at sonar. As long as we don't know what for, we won't passthrough
// any arg
SpringApplication
.
run
(
GridFailureInformationApplication
.
class
,
new
String
[
0
]
);
}
}
src/main/java/org/eclipse/openk/gridfailureinformation/config/SecurityConfig.java
0 → 100644
View file @
d9d19738
/*
*******************************************************************************
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************
*/
package
org.eclipse.openk.gridfailureinformation.config
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
@Configuration
public
class
SecurityConfig
extends
WebSecurityConfigurerAdapter
{
@Override
protected
void
configure
(
HttpSecurity
security
)
throws
Exception
{
security
.
httpBasic
().
disable
();
security
.
csrf
().
disable
();
}
}
src/main/java/org/eclipse/openk/gridfailureinformation/constants/Constants.java
0 → 100644
View file @
d9d19738
/*
*******************************************************************************
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************
*/
package
org.eclipse.openk.gridfailureinformation.constants
;
public
final
class
Constants
{
private
Constants
()
{
// empty Constructor for the sake of SONAR
}
public
static
final
String
DB_VERSION_NOT_PRESENT
=
"DB-Version-not_present"
;
}
src/main/java/org/eclipse/openk/gridfailureinformation/controller/VersionController.java
0 → 100644
View file @
d9d19738
/*
*******************************************************************************
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************
*/
package
org.eclipse.openk.gridfailureinformation.controller
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
lombok.extern.log4j.Log4j2
;
import
org.eclipse.openk.gridfailureinformation.service.VersionService
;
import
org.eclipse.openk.gridfailureinformation.viewmodel.VersionDto
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Log4j2
@RestController
@RequestMapping
(
"/version"
)
public
class
VersionController
{
@Autowired
private
VersionService
versionService
;
@ApiOperation
(
value
=
"Anzeigen der Backend und der DB-Version"
)
@ApiResponses
(
value
=
{
@ApiResponse
(
code
=
204
,
message
=
"Erfolgreich durchgeführt"
)})
@GetMapping
public
VersionDto
getVersion
()
{
return
versionService
.
getVersion
();
}
}
src/main/java/org/eclipse/openk/gridfailureinformation/enums/OperationType.java
0 → 100644
View file @
d9d19738
package
org.eclipse.openk.gridfailureinformation.enums
;
public
enum
OperationType
{
INSERT
,
UPDATE
,
CREATE
,
DELETE
}
src/main/java/org/eclipse/openk/gridfailureinformation/exceptions/BadRequestException.java
0 → 100644
View file @
d9d19738
/*
*******************************************************************************
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************
*/
package
org.eclipse.openk.gridfailureinformation.exceptions
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
@ResponseStatus
(
code
=
HttpStatus
.
BAD_REQUEST
)
public
class
BadRequestException
extends
RuntimeException
{
public
BadRequestException
()
{
}
public
BadRequestException
(
String
message
)
{
super
(
message
);
}
}
src/main/java/org/eclipse/openk/gridfailureinformation/exceptions/ConflictException.java
0 → 100644
View file @
d9d19738
/*
*******************************************************************************
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************
*/
package
org.eclipse.openk.gridfailureinformation.exceptions
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
@ResponseStatus
(
code
=
HttpStatus
.
CONFLICT
)
public
class
ConflictException
extends
RuntimeException
{
public
ConflictException
(
String
message
)
{
super
(
message
);
}
}
src/main/java/org/eclipse/openk/gridfailureinformation/exceptions/InternalServerErrorException.java
0 → 100644
View file @
d9d19738
/*
*******************************************************************************
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************
*/
package
org.eclipse.openk.gridfailureinformation.exceptions
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
@ResponseStatus
(
code
=
HttpStatus
.
INTERNAL_SERVER_ERROR
)
public
class
InternalServerErrorException
extends
RuntimeException
{
public
InternalServerErrorException
(
String
message
)
{
super
(
message
);
}
}
src/main/java/org/eclipse/openk/gridfailureinformation/exceptions/NotFoundException.java
0 → 100644
View file @
d9d19738
/*
*******************************************************************************
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************
*/
package
org.eclipse.openk.gridfailureinformation.exceptions
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
@ResponseStatus
(
code
=
HttpStatus
.
NOT_FOUND
)
public
class
NotFoundException
extends
RuntimeException
{
public
NotFoundException
()
{
}
public
NotFoundException
(
String
message
)
{
super
(
message
);
}
}
src/main/java/org/eclipse/openk/gridfailureinformation/exceptions/OperationDeniedException.java
0 → 100644
View file @
d9d19738
package
org.eclipse.openk.gridfailureinformation.exceptions
;
import
org.eclipse.openk.gridfailureinformation.enums.OperationType
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
@ResponseStatus
(
code
=
HttpStatus
.
NOT_ACCEPTABLE
)
public
class
OperationDeniedException
extends
RuntimeException
{
public
OperationDeniedException
(
OperationType
operation
,
String
message
)
{
super
(
message
);
}
}
src/main/java/org/eclipse/openk/gridfailureinformation/exceptions/UnauthorizedException.java
0 → 100644
View file @
d9d19738
package
org.eclipse.openk.gridfailureinformation.exceptions
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
@ResponseStatus
(
code
=
HttpStatus
.
UNAUTHORIZED
)
public
class
UnauthorizedException
extends
RuntimeException
{
public
UnauthorizedException
(
String
message
)
{
super
(
message
);
}
}
src/main/java/org/eclipse/openk/gridfailureinformation/mapper/VersionMapper.java
0 → 100644
View file @
d9d19738
/*
*******************************************************************************
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************
*/
package
org.eclipse.openk.gridfailureinformation.mapper
;
import
org.eclipse.openk.gridfailureinformation.model.Version
;
import
org.eclipse.openk.gridfailureinformation.viewmodel.VersionDto
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mapping
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.ReportingPolicy
;
@Mapper
(
componentModel
=
"spring"
,
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
public
interface
VersionMapper
{
@Mappings
({
@Mapping
(
source
=
"version"
,
target
=
"dbVersion"
)
})
VersionDto
toVersionDto
(
Version
version
);
}
src/main/java/org/eclipse/openk/gridfailureinformation/model/Version.java
0 → 100644
View file @
d9d19738
/*
*******************************************************************************
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************
*/
package
org.eclipse.openk.gridfailureinformation.model
;
import
lombok.Data
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
@Data
@Entity
public
class
Version
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
private
String
version
;
}
src/main/java/org/eclipse/openk/gridfailureinformation/repository/VersionRepository.java
0 → 100644
View file @
d9d19738
/*
*******************************************************************************
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************
*/
package
org.eclipse.openk.gridfailureinformation.repository
;
import
org.eclipse.openk.gridfailureinformation.model.Version
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.stereotype.Repository
;
@Repository
public
interface
VersionRepository
extends
JpaRepository
<
Version
,
Long
>
{
}
src/main/java/org/eclipse/openk/gridfailureinformation/service/VersionService.java
0 → 100644
View file @
d9d19738
/*
*******************************************************************************
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************
*/
package
org.eclipse.openk.gridfailureinformation.service
;
import
org.eclipse.openk.gridfailureinformation.constants.Constants
;
import
org.eclipse.openk.gridfailureinformation.mapper.VersionMapper
;
import
org.eclipse.openk.gridfailureinformation.model.Version
;
import
org.eclipse.openk.gridfailureinformation.repository.VersionRepository
;
import
org.eclipse.openk.gridfailureinformation.viewmodel.VersionDto
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Optional
;
@Service
public
class
VersionService
{
@Autowired
VersionRepository
versionRepository
;
@Autowired
VersionMapper
versionMapper
;
public
VersionDto
getVersion
()
{
VersionDto
retVersion
;
Optional
<
Version
>
dbVersion
=
versionRepository
.
findById
(
1L
);
if
(
dbVersion
.
isPresent
()
)
{
retVersion
=
versionMapper
.
toVersionDto
(
dbVersion
.
get
());
}
else
{
retVersion
=
new
VersionDto
();
retVersion
.
setDbVersion
(
Constants
.
DB_VERSION_NOT_PRESENT
);
}
retVersion
.
setBackendVersion
(
"00"
);
return
retVersion
;
}
}
src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/VersionDto.java
0 → 100644
View file @
d9d19738
/*
*******************************************************************************
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************
*/
package
org.eclipse.openk.gridfailureinformation.viewmodel
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
VersionDto
implements
Serializable
{
private
String
backendVersion
;
private
String
dbVersion
;
}
Prev
1
2
3
4
5
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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