List of usage examples for java.lang Integer longValue
public long longValue()
From source file:org.egov.egf.web.actions.report.VoucherStatusReportAction.java
private String getUserNameForPosition(final Integer posId) { final String query = "select emp.userName from org.egov.eis.entity.EmployeeView emp where emp.position.id = ? "; return (String) persistenceService.find(query, posId.longValue()); }
From source file:com.zb.app.biz.service.impl.TravelCompanyServiceImpl.java
/** * /*from w w w . j a v a 2s . co m*/ * * @param id * @return */ @Override public boolean delete(Integer id) { if (Argument.isNotPositive(id)) { return false; } boolean isSuccess = travelCompanyDao.deleteById(id); if (isSuccess) { notifyCompanyEvent(new CompanyEvent(EventType.companyDelete, id.longValue(), null)); logger.debug("delete company event happen,cid={},time={}", id, new Date()); } return isSuccess; }
From source file:org.egov.ptis.client.util.PropertyTaxUtil.java
/** * Returns the number of days between fromDate and toDate * * @param fromDate the date/*from w w w. ja va2 s.c o m*/ * @param toDate the date * @return Long the number of days */ public static Long getNumberOfDays(final Date fromDate, final Date toDate) { LOGGER.debug("Entered into getNumberOfDays, fromDate=" + fromDate + ", toDate=" + toDate); final DateTime startDate = new DateTime(fromDate); final DateTime endDate = new DateTime(toDate); Integer days = Days.daysBetween(startDate, endDate).getDays(); days = days < 0 ? 0 : days; return Long.valueOf(days.longValue()); }
From source file:org.sakaiproject.calendar.impl.readers.IcalendarReader.java
public List filterEvents(List events, String[] customFieldNames) throws ImportException { Iterator it = events.iterator(); int lineNumber = 1; ///*from w ww . jav a2s .com*/ // Convert the date/time fields as they appear in the Outlook import to // be a synthesized start/end timerange. // while (it.hasNext()) { Map eventProperties = (Map) it.next(); Date startTime = (Date) eventProperties .get(defaultHeaderMap.get(GenericCalendarImporter.START_TIME_DEFAULT_COLUMN_HEADER)); TimeBreakdown startTimeBreakdown = null; if (startTime != null) { // if the source time zone were known, this would be // a good place to set it: startCal.setTimeZone() GregorianCalendar startCal = new GregorianCalendar(); startCal.setTimeInMillis(startTime.getTime()); startTimeBreakdown = getTimeService().newTimeBreakdown(0, 0, 0, startCal.get(Calendar.HOUR_OF_DAY), startCal.get(Calendar.MINUTE), startCal.get(Calendar.SECOND), 0); } else { Integer line = Integer.valueOf(lineNumber); String msg = (String) rb.getFormattedMessage("err_no_stime_on", new Object[] { line }); throw new ImportException(msg); } Integer durationInMinutes = (Integer) eventProperties .get(defaultHeaderMap.get(GenericCalendarImporter.DURATION_DEFAULT_COLUMN_HEADER)); if (durationInMinutes == null) { Integer line = Integer.valueOf(lineNumber); String msg = (String) rb.getFormattedMessage("err_no_dtime_on", new Object[] { line }); throw new ImportException(msg); } Date endTime = new Date(startTime.getTime() + (durationInMinutes.longValue() * 60 * 1000)); TimeBreakdown endTimeBreakdown = null; if (endTime != null) { // if the source time zone were known, this would be // a good place to set it: endCal.setTimeZone() GregorianCalendar endCal = new GregorianCalendar(); endCal.setTimeInMillis(endTime.getTime()); endTimeBreakdown = getTimeService().newTimeBreakdown(0, 0, 0, endCal.get(Calendar.HOUR_OF_DAY), endCal.get(Calendar.MINUTE), endCal.get(Calendar.SECOND), 0); } Date startDate = (Date) eventProperties .get(defaultHeaderMap.get(GenericCalendarImporter.DATE_DEFAULT_COLUMN_HEADER)); // if the source time zone were known, this would be // a good place to set it: startCal.setTimeZone() GregorianCalendar startCal = new GregorianCalendar(); if (startDate != null) startCal.setTimeInMillis(startDate.getTime()); startTimeBreakdown.setYear(startCal.get(Calendar.YEAR)); startTimeBreakdown.setMonth(startCal.get(Calendar.MONTH) + 1); startTimeBreakdown.setDay(startCal.get(Calendar.DAY_OF_MONTH)); endTimeBreakdown.setYear(startCal.get(Calendar.YEAR)); endTimeBreakdown.setMonth(startCal.get(Calendar.MONTH) + 1); endTimeBreakdown.setDay(startCal.get(Calendar.DAY_OF_MONTH)); eventProperties.put(GenericCalendarImporter.ACTUAL_TIMERANGE, getTimeService().newTimeRange(getTimeService().newTimeLocal(startTimeBreakdown), getTimeService().newTimeLocal(endTimeBreakdown), true, false)); lineNumber++; } return events; }
From source file:org.jgap.gp.function.AddAndStoreTerminal.java
public void execute_void(ProgramChromosome c, int n, Object[] args) { check(c);/*from w ww . j ava2 s. c o m*/ if (m_type == CommandGene.IntegerClass) { int value = c.execute_int(n, 0, args); Integer oldValue = (Integer) getGPConfiguration().readFromMemoryIfExists(m_storageName); if (oldValue != null) { value = value + oldValue.intValue(); } // Store in memory. // ---------------- getGPConfiguration().storeInMemory(m_storageName, new Integer(value)); } else if (m_type == CommandGene.LongClass) { long value = c.execute_long(n, 0, args); Long oldValue = (Long) getGPConfiguration().readFromMemoryIfExists(m_storageName); if (oldValue != null) { value = value + oldValue.longValue(); } getGPConfiguration().storeInMemory(m_storageName, new Long(value)); } else if (m_type == CommandGene.DoubleClass) { double value = c.execute_double(n, 0, args); Double oldValue = (Double) getGPConfiguration().readFromMemoryIfExists(m_storageName); if (oldValue != null) { value = value + oldValue.doubleValue(); } getGPConfiguration().storeInMemory(m_storageName, new Double(value)); } else if (m_type == CommandGene.FloatClass) { float value = c.execute_float(n, 0, args); Float oldValue = (Float) getGPConfiguration().readFromMemoryIfExists(m_storageName); if (oldValue != null) { value = value + oldValue.floatValue(); } getGPConfiguration().storeInMemory(m_storageName, new Float(value)); } else { throw new IllegalStateException("Type " + m_type + " unknown"); } }
From source file:gov.nih.nci.cabig.caaers.service.workflow.WorkflowServiceImpl.java
/** * @see WorkflowService#advanceWorkflow(Integer, String) *//*w w w.ja v a 2 s. com*/ /* * Will fetch the workflow process * Get the current node, * Find the next nodes, and see if the status mentioned is associated to that task. */ @SuppressWarnings("unchecked") @Transactional(readOnly = false, propagation = Propagation.REQUIRED, noRollbackFor = MailException.class) public ReviewStatus advanceWorkflow(Integer workflowId, String leavingTransitionName) { //fetch the process instance ProcessInstance processInstance = fetchProcessInstance(workflowId.longValue()); Token token = processInstance.getRootToken(); //figure out the transition to take, based upon our crude logic of applicable/not applicable, //the leavingTransitionName, may not be a valid leaving transition in the current workflow node. Transition transitionToTake = token.getNode().getDefaultLeavingTransition(); for (Iterator<Transition> it = token.getNode().getLeavingTransitions().iterator(); it.hasNext();) { Transition transition = it.next(); if (StringUtils.equals(transition.getName(), leavingTransitionName)) { transitionToTake = transition; break; } } //leave through the transition token.signal(transitionToTake); jbpmTemplate.saveProcessInstance(processInstance); //now fetch the node where we are at after the transition. Node currentNode = processInstance.getRootToken().getNode(); String workflowDefinitionName = processInstance.getProcessDefinition().getName(); //fetch the current nodes status from task config WorkflowConfig wfConfig = workflowConfigDao.getByWorkflowDefinitionName(workflowDefinitionName); if (wfConfig == null) { throw new CaaersSystemException("WF-0011", "Workflow is not configured for [" + workflowDefinitionName + "]"); } TaskConfig taskConfig = wfConfig.findTaskConfig(currentNode.getName()); assert taskConfig != null; String reviewStatusName = taskConfig.getStatusName(); return ReviewStatus.valueOf(reviewStatusName); }
From source file:com.redhat.rhn.frontend.xmlrpc.system.crash.CrashHandler.java
/** * @param loggedInUser The current user/*from w w w. j av a 2 s.c om*/ * @param crashId Crash ID * @param subject Crash note subject * @param details Crash note details * @return 1 on success * * @xmlrpc.doc Create a crash note * @xmlrpc.param #param("string", "sessionKey") * @xmlrpc.param #param("int", "crashId") * @xmlrpc.param #param("string", "subject") * @xmlrpc.param #param("string", "details") * @xmlrpc.returntype #return_int_success() */ public int createCrashNote(User loggedInUser, Integer crashId, String subject, String details) { if (StringUtils.isBlank(subject)) { throw new IllegalArgumentException("Crash note subject is required"); } CrashNote cn = new CrashNote(); cn.setSubject(subject); cn.setNote(details); cn.setCreator(loggedInUser); cn.setCrash(CrashManager.lookupCrashByUserAndId(loggedInUser, crashId.longValue())); CrashFactory.save(cn); return 1; }
From source file:org.openmeetings.app.data.user.Organisationmanagement.java
/** * adds all send organisations to this User-Object (for newly * registered/created Users)/*www . j ava2 s. c om*/ * * @param us * @param org * @return */ @SuppressWarnings("rawtypes") public Long addUserOrganisationsByHashMap(long us, List org) { try { if (org != null) { for (Iterator it = org.iterator(); it.hasNext();) { Integer key = (Integer) it.next(); Long newOrgId = key.longValue(); this.addUserToOrganisation(us, newOrgId, new Long(1)); } } } catch (Exception ex) { log.error("addUserOrganisationsByHashMap", ex); } return null; }
From source file:com.cyberway.issue.crawler.prefetch.PreconditionEnforcer.java
/** Get the maximum time a robots.txt is valid. * * @param curi// w w w . j a v a 2 s .c o m * @return the time a robots.txt is valid in milliseconds. */ public long getRobotsValidityDuration(CrawlURI curi) { Integer d; try { d = (Integer) getAttribute(ATTR_ROBOTS_VALIDITY_DURATION, curi); } catch (AttributeNotFoundException e) { // This should never happen, but if it does, return default logger.severe(e.getLocalizedMessage()); d = DEFAULT_ROBOTS_VALIDITY_DURATION; } // convert from seconds to milliseconds return d.longValue() * 1000; }
From source file:org.opendaylight.vpnservice.itm.impl.ItmUtils.java
public static Interface buildHwTunnelInterface(String tunnelIfName, String desc, boolean enabled, String topo_id, String node_id, Class<? extends TunnelTypeBase> tunType, IpAddress srcIp, IpAddress destIp, IpAddress gWIp, Boolean monitor_enabled, Integer monitor_interval) { InterfaceBuilder builder = new InterfaceBuilder().setKey(new InterfaceKey(tunnelIfName)) .setName(tunnelIfName).setDescription(desc).setEnabled(enabled).setType(Tunnel.class); List<NodeIdentifier> nodeIds = new ArrayList<NodeIdentifier>(); NodeIdentifier hWnode = new NodeIdentifierBuilder().setKey(new NodeIdentifierKey(topo_id)) .setTopologyId(topo_id).setNodeId(node_id).build(); nodeIds.add(hWnode);/*from w w w. ja va 2s . c om*/ ParentRefs parent = new ParentRefsBuilder().setNodeIdentifier(nodeIds).build(); builder.addAugmentation(ParentRefs.class, parent); Long monitoringInterval = (long) ITMConstants.DEFAULT_MONITOR_INTERVAL; Boolean monitoringEnabled = true; if (monitor_interval != null) monitoringInterval = monitor_interval.longValue(); if (monitor_enabled != null) monitoringEnabled = monitor_enabled; IfTunnel tunnel = new IfTunnelBuilder().setTunnelDestination(destIp).setTunnelGateway(gWIp) .setTunnelSource(srcIp).setMonitorEnabled(monitoringEnabled).setMonitorInterval(100L) .setTunnelInterfaceType(tunType).setInternal(false).build(); builder.addAugmentation(IfTunnel.class, tunnel); LOG.trace("iftunnel {} built from hwvtep {} ", tunnel, node_id); return builder.build(); }