List of usage examples for java.lang Integer longValue
public long longValue()
From source file:com.intuit.tank.api.model.v1.datafile.DataFileDescriptorTest.java
/** * Run the Integer getId() method test./* w w w . j a v a2 s . c om*/ * * @throws Exception * * @generatedBy CodePro at 12/15/14 3:00 PM */ @Test public void testGetId_1() throws Exception { DataFileDescriptor fixture = new DataFileDescriptor(); fixture.setComments(""); fixture.setCreator(""); fixture.setName(""); fixture.setDataUrl(""); fixture.setId(new Integer(1)); fixture.setCreated(new Date()); fixture.setModified(new Date()); Integer result = fixture.getId(); assertNotNull(result); assertEquals("1", result.toString()); assertEquals((byte) 1, result.byteValue()); assertEquals((short) 1, result.shortValue()); assertEquals(1, result.intValue()); assertEquals(1L, result.longValue()); assertEquals(1.0f, result.floatValue(), 1.0f); assertEquals(1.0, result.doubleValue(), 1.0); }
From source file:com.redhat.rhn.frontend.xmlrpc.chain.ActionChainHandler.java
/** * Deploy configuration./* w w w .ja v a 2s . c om*/ * * @param loggedInUser The current user * @param chainLabel Label of the action chain * @param serverId System ID * @param revisions List of configuration revisions. * @return True in XML-RPC representation * * @xmlrpc.doc Adds an action to deploy a configuration file to an Action Chain. * @xmlrpc.param #param_desc("string", "sessionKey", "Session token, issued at login") * @xmlrpc.param #param_desc("string", "chainLabel", "Label of the chain") * @xmlrpc.param #param_desc("int", "System ID", "System ID") * @xmlrpc.param #array_single("int", "Revision ID") * @xmlrpc.returntype #return_int_success() */ @SuppressWarnings("unchecked") public Integer addConfigurationDeployment(User loggedInUser, String chainLabel, Integer serverId, List<Integer> revisions) { if (revisions.isEmpty()) { throw new InvalidParameterException("At least one revision should be given."); } List<Long> server = new ArrayList<Long>(); server.add(serverId.longValue()); ActionChainManager.createConfigActions(loggedInUser, CollectionUtils.collect(revisions, new ActionChainRPCCommon.IntegerToLongTransformer()), server, ActionFactory.TYPE_CONFIGFILES_DEPLOY, new Date(), this.acUtil.getActionChainByLabel(loggedInUser, chainLabel)); return BaseHandler.VALID; }
From source file:org.opennms.netmgt.scriptd.ins.events.InsSession.java
private Event getXMLEvent(final OnmsEvent ev) { final Integer id = ev.getId(); LOG.info("Working on XML Event for id: {}", id); LOG.debug("Setting Event id: {}", id); final Event e = new Event(); e.setDbid(id);// w w w . j a va 2s. com //UEI final String uei = ev.getEventUei(); if (uei != null) { LOG.debug("Setting Event uei: {}", uei); e.setUei(uei); } else { LOG.warn("No Event uei found: skipping event...."); return null; } // Source final String source = ev.getEventSource(); if (source != null) { LOG.debug("Setting Event source: {}", source); e.setSource(source); } else { LOG.info("No Event source found."); } //nodeid final Integer nodeid = ev.getNode().getId(); if (ev.getNode() != null && nodeid != null) { LOG.debug("Setting Event nodeid: {}", nodeid); e.setNodeid(nodeid.longValue()); } else { LOG.info("No Event node found."); } // timestamp final Date time = ev.getEventTime(); if (time != null) { LOG.debug("Setting event date timestamp to (GMT): {}", time); e.setTime(time); } else { LOG.info("No Event time found."); } // host final String host = ev.getEventHost(); if (host != null) { LOG.debug("Setting Event Host: {}", host); e.setHost(host); } else { LOG.info("No Event host found."); } // interface final InetAddress ipAddr = ev.getIpAddr(); if (ipAddr != null) { LOG.debug("Setting Event Interface/ipaddress: {}", ipAddr); e.setInterfaceAddress(ipAddr); } else { LOG.info("No Event ip address found."); } // Service Name if (ev.getServiceType() != null) { final String serviceName = ev.getServiceType().getName(); LOG.debug("Setting Event Service Name: {}", serviceName); e.setService(serviceName); } else { LOG.info("No Event service name found."); } // Description final String descr = ev.getEventDescr(); if (descr != null) { LOG.debug("Setting Event Description: {}", descr); e.setDescr(descr); } else { LOG.info("No Event ip address found."); } // Log message final String logmsg = ev.getEventLogMsg(); if (logmsg != null) { final Logmsg msg = new Logmsg(); LOG.debug("Setting Event Log Message: {}", logmsg); msg.setContent(logmsg); e.setLogmsg(msg); } else { LOG.info("No Event log Message found."); } // severity final Integer severity = ev.getEventSeverity(); if (severity != null) { LOG.debug("Setting Event Severity: {}", severity); e.setSeverity(OnmsSeverity.get(severity).getLabel()); } else { LOG.info("No Event severity found."); } final Integer ifIndex = ev.getIfIndex(); if (ifIndex != null && ifIndex > 0) { e.setIfIndex(ifIndex); e.setIfAlias(getIfAlias(nodeid, ifIndex)); } else { e.setIfIndex(-1); e.setIfAlias("-1"); } // operator Instruction final String operInstruct = ev.getEventOperInstruct(); if (operInstruct != null) { LOG.debug("Setting Event Operator Instruction: {}", operInstruct); e.setOperinstruct(operInstruct); } else { LOG.info("No Event operator Instruction found."); } // parms final String eventParms = ev.getEventParms(); if (eventParms != null) { LOG.debug("Setting Event Parms: {}", eventParms); final List<Parm> parms = EventParameterUtils.decode(eventParms); if (parms != null) e.setParmCollection(parms); } else { LOG.info("No Event parms found."); } final AlarmData ad = new AlarmData(); final OnmsAlarm onmsAlarm = ev.getAlarm(); try { if (onmsAlarm != null) { ad.setReductionKey(onmsAlarm.getReductionKey()); ad.setAlarmType(onmsAlarm.getAlarmType()); ad.setClearKey(onmsAlarm.getClearKey()); e.setAlarmData(ad); } } catch (final ObjectNotFoundException e1) { LOG.warn("Correlated alarm data not found.", e1); } LOG.info("Returning event with id: {}", id); return e; }
From source file:com.hmsinc.epicenter.webapp.remoting.PatientService.java
/** * Gets a line listing of visits using optional paging. * //from www . j a va 2s . c om * @param <T> * @param classifierId * @param classifierCategory * @param start * @param end * @param geoType * @param geoId * @param patientLocation * @param pageSize * @param pageNum * @return */ @Secured("ROLE_USER") @Transactional(readOnly = true) @RemoteMethod public <T extends Geography> ListView<CasesDTO> getCases(final AnalysisParametersDTO paramsDTO, final Integer offset, final Integer numRows) { final AnalysisParameters params = convertParameters(paramsDTO); SpatialSecurity.checkAggregateOnlyAccess(getPrincipal(), params.getContainer()); logger.debug("Getting cases for: {} [offset: {}, numRows: {}]", new Object[] { params, offset, numRows }); // Hibernate should cache this final Long total = analysisRepository.getCasesCount(params); final Long offsetL = offset == null ? null : Long.valueOf(offset.longValue()); final Long numRowsL = numRows == null ? null : Long.valueOf(numRows.longValue()); final List<? extends Interaction> interactions = analysisRepository.getCases(params, offsetL, numRowsL); logger.debug("Got {} cases.", interactions.size()); // Build the ListView final ListView<CasesDTO> cases = new ListView<CasesDTO>(total.intValue()); for (final Interaction a : interactions) { // Only copy the requested classifications into the view final Set<String> clz = new HashSet<String>(); for (Classification cc : a.getClassifications()) { if (params.getClassifications() == null || params.getClassifications().size() == 0 || params.getClassifications().contains(cc)) { clz.add(cc.getCategory()); } } if (params.getClassifications() == null || params.getClassifications().size() == 0 || clz.size() > 0) { cases.getItems().add(filterFacility(new CasesDTO(a, clz), a)); } // Evict from the cache since we're done. analysisRepository.evict(a); } return cases; }
From source file:com.gst.portfolio.shareaccounts.service.ShareAccountWritePlatformServiceJpaRepositoryImpl.java
private Map<String, Object> populateJournalEntries(final ShareAccount account, final Set<ShareAccountTransaction> transactions) { final Map<String, Object> accountingBridgeData = new HashMap<>(); Boolean cashBasedAccounting = account.getShareProduct().getAccountingType().intValue() == 2 ? Boolean.TRUE : Boolean.FALSE;/*from w w w . ja va 2 s . c o m*/ accountingBridgeData.put("cashBasedAccountingEnabled", cashBasedAccounting); accountingBridgeData.put("accrualBasedAccountingEnabled", Boolean.FALSE); accountingBridgeData.put("shareAccountId", account.getId()); accountingBridgeData.put("shareProductId", account.getShareProduct().getId()); accountingBridgeData.put("officeId", account.getOfficeId()); MonetaryCurrency currency = account.getCurrency(); final CurrencyData currencyData = new CurrencyData(currency.getCode(), "", currency.getDigitsAfterDecimal(), currency.getCurrencyInMultiplesOf(), "", ""); accountingBridgeData.put("currency", currencyData); final List<Map<String, Object>> newTransactionsMap = new ArrayList<>(); accountingBridgeData.put("newTransactions", newTransactionsMap); for (ShareAccountTransaction transaction : transactions) { final Map<String, Object> transactionDto = new HashMap<>(); transactionDto.put("officeId", account.getOfficeId()); transactionDto.put("id", transaction.getId()); transactionDto.put("date", new LocalDate(transaction.getPurchasedDate())); final Integer status = transaction.getTransactionStatus(); final ShareAccountTransactionEnumData statusEnum = new ShareAccountTransactionEnumData( status.longValue(), null, null); final Integer type = transaction.getTransactionType(); final ShareAccountTransactionEnumData typeEnum = new ShareAccountTransactionEnumData(type.longValue(), null, null); transactionDto.put("status", statusEnum); transactionDto.put("type", typeEnum); if (transaction.isPurchaseRejectedTransaction() || transaction.isRedeemTransaction()) { BigDecimal amount = transaction.amount(); if (transaction.chargeAmount() != null) { amount = amount.add(transaction.chargeAmount()); } transactionDto.put("amount", amount); } else { transactionDto.put("amount", transaction.amount()); } transactionDto.put("chargeAmount", transaction.chargeAmount()); transactionDto.put("paymentTypeId", null); // FIXME::make it cash // payment if (transaction.getChargesPaidBy() != null && !transaction.getChargesPaidBy().isEmpty()) { final List<Map<String, Object>> chargesPaidData = new ArrayList<>(); transactionDto.put("chargesPaid", chargesPaidData); Set<ShareAccountChargePaidBy> chargesPaidBySet = transaction.getChargesPaidBy(); for (ShareAccountChargePaidBy chargesPaidBy : chargesPaidBySet) { Map<String, Object> chargesPaidDto = new HashMap<>(); chargesPaidDto.put("chargeId", chargesPaidBy.getChargeId()); chargesPaidDto.put("sharesChargeId", chargesPaidBy.getShareChargeId()); chargesPaidDto.put("amount", chargesPaidBy.getAmount()); chargesPaidData.add(chargesPaidDto); } } newTransactionsMap.add(transactionDto); } return accountingBridgeData; }
From source file:org.sakaiproject.tool.assessment.qti.helper.assessment.AssessmentHelperBase.java
/** Set the assessment duration. * @param duration assessment duration in seconds * @param assessmentXml the xml/* www . ja v a 2 s .c om*/ */ public void setDuration(Integer duration, Assessment assessmentXml) { String xpath = "questestinterop/assessment/duration"; List list = assessmentXml.selectNodes(xpath); try { Iso8601TimeInterval isoTime = new Iso8601TimeInterval(1000 * duration.longValue()); assessmentXml.update(xpath, isoTime.toString()); } catch (Exception ex) { log.error(ex.getMessage(), ex); } }
From source file:org.opendaylight.vpnservice.itm.impl.ItmUtils.java
public static Interface buildTunnelInterface(BigInteger dpn, String ifName, String desc, boolean enabled, Class<? extends TunnelTypeBase> tunType, IpAddress localIp, IpAddress remoteIp, IpAddress gatewayIp, Integer vlanId, boolean internal, Boolean monitorEnabled, Integer monitorInterval) { InterfaceBuilder builder = new InterfaceBuilder().setKey(new InterfaceKey(ifName)).setName(ifName) .setDescription(desc).setEnabled(enabled).setType(Tunnel.class); ParentRefs parentRefs = new ParentRefsBuilder().setDatapathNodeIdentifier(dpn).build(); builder.addAugmentation(ParentRefs.class, parentRefs); if (vlanId > 0) { IfL2vlan l2vlan = new IfL2vlanBuilder().setVlanId(new VlanId(vlanId)).build(); builder.addAugmentation(IfL2vlan.class, l2vlan); }//from ww w . j a v a2 s . c o m Long monitoringInterval = (long) ITMConstants.DEFAULT_MONITOR_INTERVAL; Boolean monitoringEnabled = true; if (monitorInterval != null) monitoringInterval = monitorInterval.longValue(); if (monitorEnabled != null) monitoringEnabled = monitorEnabled; IfTunnel tunnel = new IfTunnelBuilder().setTunnelDestination(remoteIp).setTunnelGateway(gatewayIp) .setTunnelSource(localIp).setTunnelInterfaceType(tunType).setInternal(internal) .setMonitorEnabled(monitoringEnabled).setMonitorInterval(monitoringInterval).build(); builder.addAugmentation(IfTunnel.class, tunnel); return builder.build(); }
From source file:gov.nih.nci.cabig.caaers.service.workflow.WorkflowServiceImpl.java
/** * This method, return the list of possible transitions available at a given time on a specific workflow process instance *///from w w w .j av a2 s. c o m public List<Transition> nextTransitions(Integer workflowId, String loginId) { ProcessInstance processInstance = fetchProcessInstance(workflowId.longValue()); String workflowDefinitionName = processInstance.getProcessDefinition().getName(); WorkflowConfig wfConfig = workflowConfigDao.getByWorkflowDefinitionName(workflowDefinitionName); List<Transition> possibleTransitions = possibleTransitionsResolver.fetchNextTransitions(wfConfig, processInstance); //now filter based on login roles String taskNodeName = processInstance.getRootToken().getNode().getName(); TaskConfig taskConfig = wfConfig.findTaskConfig(taskNodeName); if (taskConfig == null) return possibleTransitions; // task is not configured List<UserGroupType> userGroupTypes = userRepository.getUserByLoginName(loginId).getUserGroupTypes(); //CAAERS-4586 Map<String, Transition> filteredTransitionMap = new HashMap<String, Transition>(); for (Transition transition : possibleTransitions) { TransitionConfig transitionConfig = taskConfig.findTransitionConfig(transition.getName()); if (transitionConfig == null) continue; //transition is not configured so no body can move it expect sysadmin List<TransitionOwner> owners = transitionConfig.getOwners(); if (owners == null) continue; //no body owns the transition for (TransitionOwner owner : owners) { if (owner.isPerson()) { PersonTransitionOwner personOwner = (PersonTransitionOwner) owner; if (StringUtils.equals(personOwner.getPerson().getLoginId(), loginId)) { if (!filteredTransitionMap.containsKey(transition.getName())) { filteredTransitionMap.put(transition.getName(), transition); } } } else { RoleTransitionOwner roleOwner = (RoleTransitionOwner) owner; PersonRole ownerRole = roleOwner.getUserRole(); UserGroupType[] ownerGroupTypes = ownerRole.getUserGroups(); for (UserGroupType userGroupType : userGroupTypes) { if (ArrayUtils.contains(ownerGroupTypes, userGroupType)) { if (!filteredTransitionMap.containsKey(transition.getName())) { filteredTransitionMap.put(transition.getName(), transition); } break; } } } } } return new ArrayList<Transition>(filteredTransitionMap.values()); }
From source file:com.zb.app.web.tools.SiteCacheTools.java
public List<SiteFullVO> getAllSite4Cat(Integer cat) { if (cat == null) { return Collections.<SiteFullVO>emptyList(); }//from w w w. j a v a 2s. co m List<TravelSiteFullDO> siteall = siteService.getSiteFullCore4All(); Map<Long, List<TravelSiteFullDO>> map = CollectionUtils.toLongListMap(siteall, "zCat"); if (map != null && map.size() > 0) { siteall = map.get(cat.longValue()); } return parseSiteFullvoList(siteall); }
From source file:org.egov.egf.web.actions.report.VoucherStatusReportAction.java
private String getVoucherOwner(final CVoucherHeader voucherHeader) { final String dash = "-"; final Integer voucherStatus = voucherHeader.getStatus(); final String voucherType = voucherHeader.getType(); State voucherState;/*from w ww. j ava 2 s . c o m*/ if (voucherStatus.longValue() == FinancialConstants.CANCELLEDVOUCHERSTATUS.longValue() || voucherStatus.longValue() == FinancialConstants.CREATEDVOUCHERSTATUS.longValue()) return dash; else if (voucherType.equalsIgnoreCase(FinancialConstants.STANDARD_VOUCHER_TYPE_CONTRA)) { final ContraJournalVoucher contraJV = (ContraJournalVoucher) persistenceService .find("from ContraJournalVoucher cj where cj.voucherHeaderId=?", voucherHeader); if (contraJV == null) return dash; else voucherState = contraJV.getState(); if (voucherState == null) return dash; else if (voucherState.getValue().equals("END")) return dash; else return getUserNameForPosition(voucherState.getOwnerPosition().getId().intValue()); } else if (voucherType.equalsIgnoreCase(FinancialConstants.STANDARD_VOUCHER_TYPE_JOURNAL)) { voucherState = voucherHeader.getState(); if (voucherState == null) return dash; else if (voucherState.getValue().equals("END")) return dash; else return getUserNameForPosition(voucherState.getOwnerPosition().getId().intValue()); } else if (voucherType.equalsIgnoreCase(FinancialConstants.STANDARD_VOUCHER_TYPE_PAYMENT)) { final Paymentheader paymentHeader = (Paymentheader) persistenceService .find("from Paymentheader ph where ph.voucherheader=?", voucherHeader); if (paymentHeader == null) return dash; else voucherState = paymentHeader.getState(); if (voucherState == null) return dash; else if (voucherState.getValue().equals("END")) return dash; else return getUserNameForPosition(voucherState.getOwnerPosition().getId().intValue()); } else return dash; }