List of usage examples for java.lang Long toString
public String toString()
From source file:org.openmrs.module.sync.web.controller.OverviewController.java
@SuppressWarnings("unchecked") @Override/*from w w w .ja va 2s .c o m*/ protected Map referenceData(HttpServletRequest request, Object obj, Errors errors) throws Exception { Map<String, Object> ret = new HashMap<String, Object>(); if (Context.isAuthenticated()) { //cast Map<String, Object> ref = (Map<String, Object>) obj; // the parent server List<RemoteServer> serverList = (ArrayList<RemoteServer>) ref.get("serverList"); RemoteServer parent = null; for (RemoteServer server : serverList) { if (server.getServerType().equals(RemoteServerType.PARENT)) { parent = server; } } // testConnection error messages MessageSourceAccessor msa = getMessageSourceAccessor(); Map<String, String> connectionState = new HashMap<String, String>(); connectionState.put(ServerConnectionState.OK.toString(), msa.getMessage("sync.config.server.connection.status.ok")); connectionState.put(ServerConnectionState.AUTHORIZATION_FAILED.toString(), msa.getMessage("sync.config.server.connection.status.noAuth")); connectionState.put(ServerConnectionState.CONNECTION_FAILED.toString(), msa.getMessage("sync.config.server.connection.status.noConnection")); connectionState.put(ServerConnectionState.CERTIFICATE_FAILED.toString(), msa.getMessage("sync.config.server.connection.status.noCertificate")); connectionState.put(ServerConnectionState.MALFORMED_URL.toString(), msa.getMessage("sync.config.server.connection.status.badUrl")); connectionState.put(ServerConnectionState.NO_ADDRESS.toString(), msa.getMessage("sync.config.server.connection.status.noAddress")); try { //Add privilege to enable us access the registered tasks Context.addProxyPrivilege(OpenmrsConstants.PRIV_MANAGE_SCHEDULER); //taskConfig for automated syncing TaskDefinition parentSchedule = new TaskDefinition(); String repeatInterval = ""; if (parent != null) { Collection<TaskDefinition> tasks = Context.getSchedulerService().getRegisteredTasks(); if (tasks != null) { String serverId = parent.getServerId().toString(); for (TaskDefinition task : tasks) { if (task.getTaskClass().equals(SyncConstants.SCHEDULED_TASK_CLASS)) { if (serverId.equals( task.getProperty(SyncConstants.SCHEDULED_TASK_PROPERTY_SERVER_ID))) { parentSchedule = task; Long repeat = parentSchedule.getRepeatInterval() / 60; repeatInterval = repeat.toString(); if (repeatInterval.indexOf(".") > -1) repeatInterval = repeatInterval.substring(0, repeatInterval.indexOf(".")); } } } } } ret.put("connectionState", connectionState.entrySet()); ret.put("parent", parent); ret.put("parentSchedule", parentSchedule); ret.put("repeatInterval", repeatInterval); ret.put("syncDateDisplayFormat", TimestampNormalizer.DATETIME_DISPLAY_FORMAT); //sync status staff ret.put("localServerUuid", ref.get("localServerUuid")); ret.put("localServerName", Context.getService(SyncService.class).getServerName()); ret.put("localServerAdminEmail", Context.getService(SyncService.class).getAdminEmail()); } finally { //We no longer need this privilege. Context.removeProxyPrivilege(OpenmrsConstants.PRIV_MANAGE_SCHEDULER); } } return ret; }
From source file:com.sinet.gage.provision.service.impl.DomainServiceImpl.java
/** * Get domain customization data searched by domainId * /*from www. jav a 2 s. c o m*/ * @param token * authentication token for dlap api * @param domainId * domain id for searching domain * @return domain customization data */ @Override public Customization getDomainData(String token, Long domainId) { return domainclient.getDomain2Data(token, domainId.toString()); }
From source file:net.softforlife.klich.ws.service.impl.KlichWSLocalImpl.java
@Override public ResultWSMessage replaceLastGeopoint(String s) { logger.info("Vamos a reemplazar el ultimo Geopoint: " + s); ResultWSMessage result = new ResultWSMessage(); Geopoint geopoint = Geopoint.parse(s); if (geopoint.getTrackId() != null) { Long id = wsDataService.replaceLastGeopoint(geopoint); if (id != null) { result.setMessage(id.toString()); } else {//from ww w . ja v a2 s. c o m result.setMessage("FAIL"); } } else { result.setMessage("FAIL"); } return result; }