Search in sources :

Example 1 with TDocumentation

use of org.eclipse.winery.model.tosca.TDocumentation in project winery by eclipse.

the class DocumentationResource method onPost.

@PUT
public Response onPost(String documentation) {
    this.documentation.clear();
    TDocumentation tDocumentation = new TDocumentation();
    tDocumentation.getContent().add(documentation);
    this.documentation.add(tDocumentation);
    return RestUtils.persist(this.abstractComponentInstanceResource);
}
Also used : TDocumentation(org.eclipse.winery.model.tosca.TDocumentation) PUT(javax.ws.rs.PUT)

Example 2 with TDocumentation

use of org.eclipse.winery.model.tosca.TDocumentation in project winery by eclipse.

the class SelfServiceMetaDataUtils method getDefaultApplicationData.

private static Application getDefaultApplicationData(SelfServiceMetaDataId id) {
    Application app = new Application();
    app.setIconUrl("icon.jpg");
    app.setImageUrl("image.jpg");
    final TServiceTemplate serviceTemplate = RepositoryFactory.getRepository().getElement((ServiceTemplateId) id.getParent());
    app.setDisplayName(serviceTemplate.getName());
    List<TDocumentation> documentation = serviceTemplate.getDocumentation();
    if ((documentation != null) && (!documentation.isEmpty())) {
        TDocumentation doc = documentation.get(0);
        List<Object> content = doc.getContent();
        if ((content != null) && (!content.isEmpty())) {
            app.setDescription(content.get(0).toString());
        }
    }
    return app;
}
Also used : TDocumentation(org.eclipse.winery.model.tosca.TDocumentation) Application(org.eclipse.winery.model.selfservice.Application) TServiceTemplate(org.eclipse.winery.model.tosca.TServiceTemplate)

Example 3 with TDocumentation

use of org.eclipse.winery.model.tosca.TDocumentation in project winery by eclipse.

the class SelfServiceMetaDataUtils method getDefaultApplicationData.

private static Application getDefaultApplicationData(IRepository repository, SelfServiceMetaDataId id) {
    Application app = new Application();
    app.setIconUrl("icon.jpg");
    app.setImageUrl("image.jpg");
    final TServiceTemplate serviceTemplate = repository.getElement((ServiceTemplateId) id.getParent());
    app.setDisplayName(serviceTemplate.getName());
    List<TDocumentation> documentation = serviceTemplate.getDocumentation();
    if ((documentation != null) && (!documentation.isEmpty())) {
        TDocumentation doc = documentation.get(0);
        List<Object> content = doc.getContent();
        if ((content != null) && (!content.isEmpty())) {
            app.setDescription(content.get(0).toString());
        }
    }
    return app;
}
Also used : TDocumentation(org.eclipse.winery.model.tosca.TDocumentation) Application(org.eclipse.winery.model.selfservice.Application) TServiceTemplate(org.eclipse.winery.model.tosca.TServiceTemplate)

Aggregations

TDocumentation (org.eclipse.winery.model.tosca.TDocumentation)3 Application (org.eclipse.winery.model.selfservice.Application)2 TServiceTemplate (org.eclipse.winery.model.tosca.TServiceTemplate)2 PUT (javax.ws.rs.PUT)1