forked from kiegroup/appformer
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AF-2847: Adding template to the REST API /spaces/{spaceName}/project …
…command in order to create new project based on the archetype template (kiegroup#1140) * AF-2847: Adding template to the REST API /spaces/{spaceName}/project command in order to create new project based on the archetype template * AF-2847: Adding template to the REST API /spaces/{spaceName}/project command in order to create new project based on the archetype template * Added Fallback implementation for Archetype Service * Added Template Id support for creating project by Rest API job request
- Loading branch information
Showing
11 changed files
with
237 additions
and
5 deletions.
There are no files selected for viewing
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
33 changes: 33 additions & 0 deletions
33
...ct-api/src/main/java/org/guvnor/common/services/project/service/BaseArchetypeService.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,33 @@ | ||
/* | ||
* Copyright 2021 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* 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.guvnor.common.services.project.service; | ||
|
||
import java.util.Optional; | ||
|
||
import org.guvnor.structure.repositories.Repository; | ||
|
||
public interface BaseArchetypeService { | ||
|
||
/** | ||
* Return the repository where the archetype is stored. | ||
* | ||
* @param alias archetype alias | ||
* @param spaceName archetype space | ||
* @return repository of the archetype | ||
*/ | ||
Repository getTemplateRepository(String alias, String spaceName); | ||
} |
36 changes: 36 additions & 0 deletions
36
...main/java/org/guvnor/common/services/project/backend/server/BaseArchetypeServiceImpl.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,36 @@ | ||
/* | ||
* Copyright 2021 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* 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.guvnor.common.services.project.backend.server; | ||
|
||
import java.util.Optional; | ||
|
||
import org.guvnor.common.services.project.service.BaseArchetypeService; | ||
import org.guvnor.structure.repositories.Repository; | ||
import org.uberfire.annotations.FallbackImplementation; | ||
|
||
@FallbackImplementation | ||
public class BaseArchetypeServiceImpl implements BaseArchetypeService { | ||
|
||
public BaseArchetypeServiceImpl() { | ||
} | ||
|
||
@Override | ||
public Repository getTemplateRepository(String alias, String spaceName) { | ||
return null; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...org/guvnor/common/services/project/backend/server/utils/BaseArchetypeServiceProducer.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,42 @@ | ||
/* | ||
* Copyright 2021 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* 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.guvnor.common.services.project.backend.server.utils; | ||
|
||
import javax.enterprise.inject.Instance; | ||
import javax.enterprise.inject.Produces; | ||
import javax.inject.Inject; | ||
|
||
import org.guvnor.common.services.project.backend.server.BaseArchetypeServiceImpl; | ||
import org.guvnor.common.services.project.service.BaseArchetypeService; | ||
import org.uberfire.annotations.Customizable; | ||
|
||
public class BaseArchetypeServiceProducer { | ||
|
||
@Inject | ||
private Instance<BaseArchetypeService> archetypeService; | ||
|
||
@Produces | ||
@Customizable | ||
public BaseArchetypeService baseArchetypeServiceProducer() { | ||
if (this.archetypeService.isUnsatisfied()) { | ||
return new BaseArchetypeServiceImpl(); | ||
} | ||
return this.archetypeService.get(); | ||
} | ||
|
||
} |
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
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
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
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