use of org.eclipse.winery.repository.rest.resources.apiData.ValidEndingsApiData in project winery by eclipse.
the class RelationshipTypeResource method getValidEndings.
/*
* Select2DataItem used to send valid source as json to frontend.
* Mapping from Select2DataItem.Id as ValidSource.namespace and
* from Select2DataItem.Text as Validsource.localname
*/
@Path("validsourcesandtargets/")
@GET
@Produces(MediaType.APPLICATION_JSON)
public ValidEndingsApiData getValidEndings() {
ValidEndingsApiData validEndingsData = new ValidEndingsApiData();
// ToDo enable validSource as RequirementType (not-yet-implemented)
ValidSource validSource;
if (((validSource = this.getRelationshipType().getValidSource()) == null) || (validSource.getTypeRef() == null)) {
validEndingsData.validSource = null;
} else {
validSource = this.getRelationshipType().getValidSource();
validEndingsData.validSource = new ValidEndingsApiDataSet("nodeType", new Select2DataItem(validSource.getTypeRef().toString(), validSource.getTypeRef().getLocalPart()));
}
// ToDo enable validTarget as CapabilityType (not-yet-implemented)
ValidTarget validTarget;
if (((validTarget = this.getRelationshipType().getValidTarget()) == null) || (validTarget.getTypeRef() == null)) {
validEndingsData.validTarget = null;
} else {
validTarget = this.getRelationshipType().getValidTarget();
validEndingsData.validTarget = new ValidEndingsApiDataSet("nodeType", new Select2DataItem(validTarget.getTypeRef().toString(), validTarget.getTypeRef().getLocalPart()));
}
return validEndingsData;
}
Aggregations