use of org.alien4cloud.tosca.model.types.AbstractToscaType in project alien4cloud by alien4cloud.
the class EditorStepDefs method iShouldBeAbleToFindAComponentWithId.
@And("^I should be able to find a component with id \"([^\"]*)\"$")
public void iShouldBeAbleToFindAComponentWithId(String id) throws Throwable {
AbstractToscaType compoennt = alienDAO.findById(AbstractToscaType.class, id);
Assert.assertNotNull(compoennt);
}
use of org.alien4cloud.tosca.model.types.AbstractToscaType in project alien4cloud by alien4cloud.
the class PluginArchiveIndexer method injectWorkSpace.
private void injectWorkSpace(Collection<? extends AbstractToscaType> elements, Orchestrator orchestrator, Location location) {
for (AbstractToscaType element : elements) {
if (element.getTags() == null) {
element.setTags(new ArrayList<Tag>());
}
element.getTags().add(new Tag("alien-workspace-id", orchestrator.getId() + ":" + location.getId()));
element.getTags().add(new Tag("alien-workspace-name", orchestrator.getName() + " - " + location.getName()));
}
}
use of org.alien4cloud.tosca.model.types.AbstractToscaType in project alien4cloud by alien4cloud.
the class ComponentController method getComponentVersions.
/**
* Get all versions of a given component.
*
* @param elementId unique id of the component for which to get all other versions.
* @return A {@link RestResponse} that contains an {@link AbstractToscaType} .
*/
@ApiOperation(value = "Get details for a component (tosca type).")
@RequestMapping(value = "/element/{elementId:.+}/versions", method = RequestMethod.GET)
@PreAuthorize("hasAnyAuthority('ADMIN', 'COMPONENTS_MANAGER', 'COMPONENTS_BROWSER')")
public RestResponse<CatalogVersionResult[]> getComponentVersions(@PathVariable String elementId, @RequestParam(required = false) QueryComponentType toscaType) {
Class<? extends AbstractToscaType> queryClass = toscaType == null ? AbstractToscaType.class : toscaType.getIndexedToscaElementClass();
Object array = toscaTypeSearchService.findAll(queryClass, elementId);
if (array != null) {
int length = Array.getLength(array);
CatalogVersionResult[] versions = new CatalogVersionResult[length];
for (int i = 0; i < length; i++) {
AbstractToscaType element = ((AbstractToscaType) Array.get(array, i));
versions[i] = new CatalogVersionResult(element.getId(), element.getArchiveVersion());
}
return RestResponseBuilder.<CatalogVersionResult[]>builder().data(versions).build();
}
return RestResponseBuilder.<CatalogVersionResult[]>builder().data(new CatalogVersionResult[0]).build();
}
use of org.alien4cloud.tosca.model.types.AbstractToscaType in project alien4cloud by alien4cloud.
the class ComponentController method getComponent.
@ApiOperation(value = "Get details for a component (tosca type).")
@RequestMapping(value = "/getInArchives", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasAnyAuthority('ADMIN', 'COMPONENTS_MANAGER', 'COMPONENTS_BROWSER')")
public RestResponse<AbstractToscaType> getComponent(@RequestBody ElementFromArchiveRequest checkElementExistRequest) throws ClassNotFoundException {
Class<? extends AbstractToscaType> elementClass = checkElementExistRequest.getComponentType().getIndexedToscaElementClass();
AbstractToscaType element = toscaTypeSearchService.getElementInDependencies(elementClass, checkElementExistRequest.getElementName(), checkElementExistRequest.getDependencies());
return RestResponseBuilder.<AbstractToscaType>builder().data(element).build();
}
use of org.alien4cloud.tosca.model.types.AbstractToscaType in project alien4cloud by alien4cloud.
the class ToscaTypeIndexerService method deleteElements.
@Override
public void deleteElements(String name, String version) {
GetMultipleDataResult<AbstractToscaType> result = alienDAO.buildQuery(AbstractToscaType.class).setFilters(fromKeyValueCouples("archiveName", name, "archiveVersion", version)).prepareSearch().setFetchContext(FetchContext.SUMMARY).search(0, Integer.MAX_VALUE);
AbstractToscaType[] elements = result.getData();
// we need to delete each element
for (AbstractToscaType element : elements) {
deleteElement(element);
}
}
Aggregations