use of com.serotonin.m2m2.i18n.ProcessResult in project ma-core-public by infiniteautomation.
the class ModulesDwr method versionCheck.
@DwrPermission(admin = true)
public ProcessResult versionCheck() {
ProcessResult result = new ProcessResult();
if (UPGRADE_DOWNLOADER != null) {
result.addData("error", Common.translate("modules.versionCheck.occupied"));
return result;
}
try {
JsonValue jsonResponse = getAvailableUpgrades();
if (jsonResponse instanceof JsonString)
result.addData("error", jsonResponse.toString());
else {
JsonObject root = jsonResponse.toJsonObject();
result.addData("upgrades", root.get("upgrades").toNative());
result.addData("newInstalls", root.get("newInstalls").toNative());
if (root.containsKey("upgradesError"))
result.addData("upgradesError", root.getString("upgradesError"));
if (root.containsKey("updates")) {
result.addData("updates", root.get("updates").toNative());
result.addData("newInstalls-oldCore", root.get("newInstalls-oldCore").toNative());
}
if (root.containsKey("missingModules"))
result.addData("missingModules", root.getJsonArray("missingModules").toNative());
}
} catch (UnknownHostException e) {
LOG.error("", e);
result.addData("unknownHost", e.getMessage());
} catch (Exception e) {
LOG.error("", e);
result.addData("error", e.getMessage());
}
return result;
}
use of com.serotonin.m2m2.i18n.ProcessResult in project ma-core-public by infiniteautomation.
the class ModulesDwr method monitorDownloads.
@DwrPermission(admin = true)
public static ProcessResult monitorDownloads() {
ProcessResult result = new ProcessResult();
synchronized (UPGRADE_DOWNLOADER_LOCK) {
if (UPGRADE_DOWNLOADER == null && stage == UpgradeState.IDLE) {
result.addGenericMessage("modules.versionCheck.notRunning");
return result;
}
result.addData("finished", finished);
result.addData("cancelled", cancelled);
result.addData("restart", restart);
if (error != null)
result.addData("error", error);
result.addData("stage", stage);
result.addData("results", getUpgradeResults(Common.getTranslations()));
if (finished)
stage = UpgradeState.IDLE;
}
return result;
}
use of com.serotonin.m2m2.i18n.ProcessResult in project ma-core-public by infiniteautomation.
the class AbstractBasicDwr method get.
/**
* Get a VO
* @param id
* @return
*/
@DwrPermission(user = true)
public ProcessResult get(int id) {
VO vo = dao.get(id);
ProcessResult response = new ProcessResult();
response.addData("vo", vo);
return response;
}
use of com.serotonin.m2m2.i18n.ProcessResult in project ma-core-public by infiniteautomation.
the class AbstractBasicDwr method dojoQuery.
/**
* Load a list of VOs
* @return
*/
@DwrPermission(user = true)
public ProcessResult dojoQuery(Map<String, String> query, List<SortOption> sort, Integer start, Integer count, boolean or) {
ProcessResult response = new ProcessResult();
ResultsWithTotal results = dao.dojoQuery(query, sort, start, count, or);
response.addData("list", results.getResults());
response.addData("total", results.getTotal());
return response;
}
use of com.serotonin.m2m2.i18n.ProcessResult in project ma-core-public by infiniteautomation.
the class AbstractDwr method getCopy.
@DwrPermission(user = true)
public ProcessResult getCopy(int id) {
// Get a Full Copy
VO vo = dao.getFull(id);
ProcessResult response = new ProcessResult();
String name = StringUtils.abbreviate(TranslatableMessage.translate(getTranslations(), "common.copyPrefix", vo.getName()), 40);
// Setup the Copy
VO copy = (VO) vo.copy();
copy.setId(Common.NEW_ID);
copy.setName(name);
copy.setXid(dao.generateUniqueXid());
response.addData("vo", copy);
return response;
}
Aggregations