use of com.twinsoft.convertigo.engine.enums.Accessibility in project convertigo by convertigo.
the class GetStoreContent method getServiceResult.
@Override
protected void getServiceResult(HttpServletRequest request, Document document) throws Exception {
Element root = document.getDocumentElement();
Element projectsListElement = document.createElement("projects");
root.appendChild(projectsListElement);
String requestedPlatform = ServiceUtils.getRequiredParameter(request, "platform");
HttpSession httpSession = request.getSession();
boolean bAdminRole = hasRole(httpSession, Role.WEB_ADMIN);
boolean bAuthRole = hasRole(httpSession, Role.AUTHENTICATED);
for (String projectName : Engine.theApp.databaseObjectsManager.getAllProjectNamesList()) {
try {
Project project = Engine.theApp.databaseObjectsManager.getOriginalProjectByName(projectName);
Element projectElement = null;
MobileApplication mobileApplication = project.getMobileApplication();
if (mobileApplication != null) {
Accessibility accessibylity = mobileApplication.getAccessibility();
if (accessibylity == Accessibility.Public || (accessibylity == Accessibility.Private && bAuthRole) || bAdminRole) {
projectElement = createProjectElement(document, mobileApplication, projectName);
for (MobilePlatform platform : mobileApplication.getMobilePlatformList()) {
if (isRequestedPlatformValid(requestedPlatform, platform)) {
projectElement.getLastChild().appendChild(createPlatform(document, platform));
}
}
projectsListElement.appendChild(projectElement);
}
}
} catch (EngineException e) {
String message = "Unable to get project information ('" + projectName + "')";
Engine.logAdmin.error(message, e);
}
}
}
Aggregations