-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/packages and fileservice (#176)
* delete url attribute * add models for ImplementationPackage * add implementation package * add repository and services * add dtos and copyright * fix wiring * add GET methods for implementation package * implement POST * implement GET * add update and delete for implementation packages * file: implementation dependency switched to implementation package * fix merging errors * use file instead of files (one-to-one mapping from implementationPackage to file) * minor fix * implement create of file service * make ImplementationPackage non-abstract * fix: avoid strange model mapper behaviour * implement POST and DELETE for a file of an ImplementationPackage * delete PUT method because we currently do not implement this operation * implement get Content (download) of file * allow to load up file with the same name for different implementation packages * rename defaultfile to file + join implementation package tables * adapt exception message * add implementation package service tests * fix one to one mapping between implementation package and file * add file service tests and fix deletion of file * add check for NPE, fix controller tests * controller tests for implementation packages * fix FileServiceCloudStorageServiceTest * don't store a foreign key in the file table delete unused upload/download methods * avoid IO exception caused by unclosed streamwriter * take foreign key constraint into account when deleting a file * adjust test to change in last commit * remove dependency from File to ImplementationPackage Co-authored-by: Manuela Weigold <manuela.weigold@iaas.uni-stuttgart.de>
- Loading branch information
Showing
38 changed files
with
2,427 additions
and
743 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
org.planqk.atlas.core/src/main/java/org/planqk/atlas/core/CloudStorageConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...anqk.atlas.core/src/main/java/org/planqk/atlas/core/exceptions/CloudStorageException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...lanqk.atlas.core/src/main/java/org/planqk/atlas/core/model/FileImplementationPackage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 the qc-atlas contributors. | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*******************************************************************************/ | ||
|
||
package org.planqk.atlas.core.model; | ||
|
||
import javax.persistence.Entity; | ||
|
||
@Entity | ||
public class FileImplementationPackage extends ImplementationPackage { | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
...k.atlas.core/src/main/java/org/planqk/atlas/core/model/FunctionImplementationPackage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 the qc-atlas contributors. | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*******************************************************************************/ | ||
|
||
package org.planqk.atlas.core.model; | ||
|
||
import javax.persistence.Entity; | ||
|
||
@Entity | ||
public class FunctionImplementationPackage extends ImplementationPackage { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
org.planqk.atlas.core/src/main/java/org/planqk/atlas/core/model/ImplementationPackage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 the qc-atlas contributors. | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*******************************************************************************/ | ||
|
||
package org.planqk.atlas.core.model; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.JoinTable; | ||
import javax.persistence.ManyToOne; | ||
import javax.persistence.OneToOne; | ||
|
||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@NoArgsConstructor | ||
@EqualsAndHashCode(callSuper = true) | ||
@Data | ||
public class ImplementationPackage extends HasId { | ||
|
||
private String name; | ||
|
||
private String description; | ||
|
||
private ImplementationPackageType packageType; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "implementation_id") | ||
private Implementation implementation; | ||
|
||
@OneToOne(fetch = FetchType.LAZY, orphanRemoval = true) | ||
@EqualsAndHashCode.Exclude | ||
@JoinTable( | ||
name = "ImplementationPackageFile", | ||
joinColumns = @JoinColumn(name = "implementation_package_id"), | ||
inverseJoinColumns = @JoinColumn(name = "file_id") | ||
) | ||
private File file; | ||
} |
24 changes: 24 additions & 0 deletions
24
...lanqk.atlas.core/src/main/java/org/planqk/atlas/core/model/ImplementationPackageType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 the qc-atlas contributors. | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*******************************************************************************/ | ||
|
||
package org.planqk.atlas.core.model; | ||
|
||
public enum ImplementationPackageType { | ||
FILE, TOSCA, FUNCTION | ||
} |
27 changes: 27 additions & 0 deletions
27
...anqk.atlas.core/src/main/java/org/planqk/atlas/core/model/TOSCAImplementationPackage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 the qc-atlas contributors. | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*******************************************************************************/ | ||
|
||
package org.planqk.atlas.core.model; | ||
|
||
import javax.persistence.Entity; | ||
|
||
@Entity | ||
public class TOSCAImplementationPackage extends ImplementationPackage { | ||
|
||
} |
30 changes: 22 additions & 8 deletions
30
org.planqk.atlas.core/src/main/java/org/planqk/atlas/core/repository/FileRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,41 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 the qc-atlas contributors. | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*******************************************************************************/ | ||
|
||
package org.planqk.atlas.core.repository; | ||
|
||
import java.util.Optional; | ||
import java.util.UUID; | ||
|
||
import org.planqk.atlas.core.model.File; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface FileRepository extends JpaRepository<File, UUID> { | ||
|
||
Optional<File> findByFileURL(String fileURL); | ||
|
||
@Query(value = "SELECT * " + | ||
"FROM file " + | ||
"INNER JOIN implementation_files on file.id = implementation_files.file_id " + | ||
"INNER JOIN implementation_package_file on file.id = implementation_package_file.file_id " + | ||
"INNER JOIN knowledge_artifact ka on file.id = ka.id " + | ||
"WHERE implementation_files.implementation_id = :implId", | ||
"WHERE implementation_package_file.implementation_package_id = :implementationPackageId", | ||
nativeQuery = true) | ||
Page<File> findFilesByImplementation(@Param("implId") UUID implementationId, Pageable pageable); | ||
Optional<File> findByImplementationPackage_Id(@Param("implementationPackageId") UUID implementationPackageId); | ||
} | ||
|
Oops, something went wrong.