Search in sources :

Example 11 with TServiceTemplate

use of org.eclipse.winery.model.tosca.TServiceTemplate 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)

Aggregations

TServiceTemplate (org.eclipse.winery.model.tosca.TServiceTemplate)11 NodeTypeId (org.eclipse.winery.common.ids.definitions.NodeTypeId)5 RelationshipTypeId (org.eclipse.winery.common.ids.definitions.RelationshipTypeId)4 TNodeType (org.eclipse.winery.model.tosca.TNodeType)4 HashSet (java.util.HashSet)3 QName (javax.xml.namespace.QName)3 XmlId (org.eclipse.winery.common.ids.XmlId)3 ComplianceRuleId (org.eclipse.winery.common.ids.definitions.ComplianceRuleId)3 DefinitionsChildId (org.eclipse.winery.common.ids.definitions.DefinitionsChildId)3 ServiceTemplateId (org.eclipse.winery.common.ids.definitions.ServiceTemplateId)3 TComplianceRule (org.eclipse.winery.model.tosca.TComplianceRule)3 TNodeTemplate (org.eclipse.winery.model.tosca.TNodeTemplate)3 InputStream (java.io.InputStream)2 StringWriter (java.io.StringWriter)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 JAXBContext (javax.xml.bind.JAXBContext)2 JAXBException (javax.xml.bind.JAXBException)2 Marshaller (javax.xml.bind.Marshaller)2