List of usage examples for java.lang Short compareTo
public int compareTo(Short anotherShort)
From source file:Main.java
public static void main(String[] args) { Short shortValue1 = new Short("10"); Short shortValue2 = new Short("11"); System.out.println(shortValue1.compareTo(shortValue2)); }
From source file:com.borqs.sync.server.contact.MergeUtils.java
/** * *//*from www. j av a 2s. c o m*/ public static MergeResult compareShorts(Short shortA, Short shortB) { MergeResult result = null; if (shortA == null && shortB == null) { return new MergeResult(false, false); } if (shortA != null && shortB == null) { result = new MergeResult(); result.addPropertyB("Short", shortA.shortValue() + ", null"); return result; } if (shortA == null && shortB != null) { result = new MergeResult(); result.addPropertyA("Short", "null, " + shortB.shortValue()); return result; } if (shortA.compareTo(shortB) != 0) { // // The values are different so // an update on shortB is required // result = new MergeResult(); result.addPropertyB("Short", shortA.shortValue() + ", " + shortB.shortValue()); return result; } return new MergeResult(false, false); }
From source file:org.mifos.application.servicefacade.CollectionSheetServiceImpl.java
private Boolean isIndividualSavingsAccount(Short customerLevelId, Short recommendedAmountUnitId) { if (customerLevelId.compareTo(CustomerLevel.CENTER.getValue()) == 0) { return true; }// www . j a v a2s . c o m if ((customerLevelId.compareTo(CustomerLevel.GROUP.getValue()) == 0) && (recommendedAmountUnitId != null) && (recommendedAmountUnitId.compareTo(Short.valueOf("1")) == 0)) { return true; } return false; }
From source file:org.mifos.customers.persistence.CustomerDaoHibernate.java
@SuppressWarnings("unchecked") @Override// ww w .java 2 s . c om public ClientDisplayDto getClientDisplayDto(Integer clientId, UserContext userContext) { Map<String, Object> queryParameters = new HashMap<String, Object>(); queryParameters.put("CLIENT_ID", clientId); List<Object[]> queryResult = (List<Object[]>) this.genericDao.executeNamedQuery("getClientDisplayDto", queryParameters); if (queryResult.size() == 0) { throw new MifosRuntimeException("Client not found: " + clientId); } if (queryResult.size() > 1) { throw new MifosRuntimeException( "Error finding Client id: " + clientId + " - Number found: " + queryResult.size()); } final Integer customerId = (Integer) queryResult.get(0)[0]; final String globalCustNum = (String) queryResult.get(0)[1]; final String displayName = (String) queryResult.get(0)[2]; final String parentCustomerDisplayName = (String) queryResult.get(0)[3]; final String branchName = (String) queryResult.get(0)[4]; final String externalId = (String) queryResult.get(0)[5]; final String customerFormedByDisplayName = (String) queryResult.get(0)[6]; final Date customerActivationDate = (Date) queryResult.get(0)[7]; final Short customerLevelId = (Short) queryResult.get(0)[8]; final Short customerStatusId = (Short) queryResult.get(0)[9]; final String lookupName = (String) queryResult.get(0)[10]; final Date trainedDate = (Date) queryResult.get(0)[11]; final Date dateOfBirth = (Date) queryResult.get(0)[12]; final String governmentId = (String) queryResult.get(0)[13]; final Short groupFlag = (Short) queryResult.get(0)[14]; final Boolean blackListed = (Boolean) queryResult.get(0)[15]; final Short loanOfficerId = (Short) queryResult.get(0)[16]; final String loanOfficerName = (String) queryResult.get(0)[17]; final String businessActivitiesName = (String) queryResult.get(0)[18]; final String handicappedName = (String) queryResult.get(0)[19]; final String maritalStatusName = (String) queryResult.get(0)[20]; final String citizenshipName = (String) queryResult.get(0)[21]; final String ethnicityName = (String) queryResult.get(0)[22]; final String educationLevelName = (String) queryResult.get(0)[23]; final String povertyStatusName = (String) queryResult.get(0)[24]; final Short numChildren = (Short) queryResult.get(0)[25]; final Integer branchId = (Integer) queryResult.get(0)[26]; Boolean clientUnderGroup = false; if (groupFlag.compareTo(Short.valueOf("0")) > 0) { clientUnderGroup = true; } final String customerStatusName = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(lookupName); final String businessActivities = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(businessActivitiesName); final String handicapped = ApplicationContextProvider.getBean(MessageLookup.class).lookup(handicappedName); final String maritalStatus = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(maritalStatusName); final String citizenship = ApplicationContextProvider.getBean(MessageLookup.class).lookup(citizenshipName); final String ethnicity = ApplicationContextProvider.getBean(MessageLookup.class).lookup(ethnicityName); final String educationLevel = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(educationLevelName); final String povertyStatus = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(povertyStatusName); String spouseFatherValue = null; String spouseFatherName = null; List<ClientFamilyDetailOtherDto> familyDetails = null; Boolean areFamilyDetailsRequired = ClientRules.isFamilyDetailsRequired(); if (areFamilyDetailsRequired) { familyDetails = new ArrayList<ClientFamilyDetailOtherDto>(); List<Object[]> familyDetailsQueryResult = (List<Object[]>) this.genericDao .executeNamedQuery("getClientFamilyDetailDto", queryParameters); for (Object[] familyDetail : familyDetailsQueryResult) { final String relationshipLookup = (String) familyDetail[0]; final String familyDisplayName = (String) familyDetail[1]; final Date familyDateOfBirth = (Date) familyDetail[2]; final String genderLookup = (String) familyDetail[3]; final String livingStatusLookup = (String) familyDetail[4]; final String relationship = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(relationshipLookup); final String gender = ApplicationContextProvider.getBean(MessageLookup.class).lookup(genderLookup); final String livingStatus = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(livingStatusLookup); String dateOfBirthAsString = ""; if (familyDateOfBirth != null) { dateOfBirthAsString = DateUtils.makeDateAsSentFromBrowser(familyDateOfBirth); } familyDetails.add(new ClientFamilyDetailOtherDto(relationship, familyDisplayName, familyDateOfBirth, gender, livingStatus, dateOfBirthAsString)); } } else { List<Object[]> clientNameDetailsQueryResult = (List<Object[]>) this.genericDao .executeNamedQuery("getClientNameDetailDto", queryParameters); if (clientNameDetailsQueryResult.size() > 0) { final String spouseFatherValueLookUp = (String) clientNameDetailsQueryResult.get(0)[0]; spouseFatherName = (String) clientNameDetailsQueryResult.get(0)[1]; spouseFatherValue = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(spouseFatherValueLookUp); } } Integer age = null; if (dateOfBirth != null) { age = DateUtils.DateDiffInYears(new java.sql.Date(dateOfBirth.getTime())); } return new ClientDisplayDto(customerId, globalCustNum, displayName, parentCustomerDisplayName, branchId, branchName, externalId, customerFormedByDisplayName, customerActivationDate, customerLevelId, customerStatusId, customerStatusName, trainedDate, dateOfBirth, governmentId, clientUnderGroup, blackListed, loanOfficerId, loanOfficerName, businessActivities, handicapped, maritalStatus, citizenship, ethnicity, educationLevel, povertyStatus, numChildren, areFamilyDetailsRequired, spouseFatherValue, spouseFatherName, familyDetails, age); }
From source file:sdf_manager.ExporterSiteHTML.java
/** * * @param i//from w w w . j a v a2 s . co m * @return */ Boolean toBool(Short i) { if (i == null) { return false; } if (i.compareTo(new Short(i)) > 0) { return true; } else { return false; } }