use of org.springframework.roo.addon.web.mvc.controller.addon.responses.ControllerMVCResponseService in project spring-roo by spring-projects.
the class WebFinderCommands method getInstalledControllerMVCResponseTypes.
/**
* This method gets all implementations of ControllerMVCResponseService interface to be able
* to locate all installed ControllerMVCResponseService
*
* @return Map with responseTypes identifier and the ControllerMVCResponseService implementation
*/
public Map<String, ControllerMVCResponseService> getInstalledControllerMVCResponseTypes() {
if (responseTypes.isEmpty()) {
try {
ServiceReference<?>[] references = this.context.getAllServiceReferences(ControllerMVCResponseService.class.getName(), null);
for (ServiceReference<?> ref : references) {
ControllerMVCResponseService responseTypeService = (ControllerMVCResponseService) this.context.getService(ref);
boolean isInstalled = false;
for (Pom module : getProjectOperations().getPoms()) {
if (responseTypeService.isInstalledInModule(module.getModuleName())) {
isInstalled = true;
break;
}
}
if (isInstalled) {
responseTypes.put(responseTypeService.getResponseType(), responseTypeService);
}
}
return responseTypes;
} catch (InvalidSyntaxException e) {
LOGGER.warning("Cannot load ControllerMVCResponseService on ControllerCommands.");
return null;
}
} else {
return responseTypes;
}
}
use of org.springframework.roo.addon.web.mvc.controller.addon.responses.ControllerMVCResponseService in project spring-roo by spring-projects.
the class I18nOperationsImpl method getControllerMVCResponseTypes.
/**
* This method gets all implementations of ControllerMVCResponseService
* interface to be able to locate all ControllerMVCResponseService. Uses
* param installed to obtain only the installed or not installed response
* types.
*
* @param installed
* indicates if returned responseType should be installed or not.
*
* @return Map with responseTypes identifier and the
* ControllerMVCResponseService implementation
*/
private List<ControllerMVCResponseService> getControllerMVCResponseTypes(boolean installed) {
List<ControllerMVCResponseService> responseTypes = new ArrayList<ControllerMVCResponseService>();
try {
ServiceReference<?>[] references = this.context.getAllServiceReferences(ControllerMVCResponseService.class.getName(), null);
for (ServiceReference<?> ref : references) {
ControllerMVCResponseService responseTypeService = (ControllerMVCResponseService) this.context.getService(ref);
boolean isAbleToInstall = false;
for (Pom module : getProjectOperations().getPoms()) {
if (responseTypeService.isInstalledInModule(module.getModuleName()) == installed) {
isAbleToInstall = true;
break;
}
}
if (isAbleToInstall) {
responseTypes.add(responseTypeService);
}
}
return responseTypes;
} catch (InvalidSyntaxException e) {
LOGGER.warning("Cannot load ControllerMVCResponseService on I18nOperationsImpl.");
return null;
}
}
Aggregations