Example usage for java.lang Character Character

List of usage examples for java.lang Character Character

Introduction

In this page you can find the example usage for java.lang Character Character.

Prototype

@Deprecated(since = "9")
public Character(char value) 

Source Link

Document

Constructs a newly allocated Character object that represents the specified char value.

Usage

From source file:de.innovationgate.wgpublisher.WGPDispatcher.java

public boolean browserCacheIsValid(HttpServletRequest request, Long lastModified, String currentETag) {

    try {/* w w w.  j  a va 2 s .c  o  m*/
        // Handle If-None-Match
        String browserETagsStr = (String) request.getHeader("If-None-Match");
        if (browserETagsStr != null) {
            Iterator<String> browserETags = WGUtils
                    .deserializeCollection(browserETagsStr, ",", true, new Character('"')).iterator();
            while (browserETags.hasNext()) {
                String rawETag = (String) browserETags.next();
                if (rawETag.trim().equals("*")) {
                    return true;
                }

                int startETag = rawETag.indexOf('"');
                int endETag = rawETag.lastIndexOf('"');
                if (startETag != -1 && endETag != -1 && startETag != endETag) {
                    String eTag = rawETag.substring(startETag + 1, endETag);
                    if (eTag.equals(currentETag)) {
                        return true;
                    }
                }
            }
        }

        // Handle If-Modified-Since
        if (lastModified != null) {
            long modSince = request.getDateHeader("If-Modified-Since");
            if (modSince != -1 && modSince >= WGUtils.cutoffTimeMillis(lastModified)) {
                return true;
            }
        }

    } catch (Exception e) {
        getCore().getLog().error("Exception evaluating browser cache HTTP headers", e);
    }

    return false;

}

From source file:org.openTwoFactor.client.util.TwoFactorClientCommonUtils.java

/**
 * get the Character wrapper value for the input
 * @param input allow null, return null//from   w ww.  ja v  a2  s  . com
 * @return the Character object wrapper
 */
public static Character charObjectValue(Object input) {
    if (input instanceof Character) {
        return (Character) input;
    }
    if (isBlank(input)) {
        return null;
    }
    return new Character(charValue(input));
}

From source file:au.org.theark.core.dao.StudyDao.java

private HashMap<String, String> constructKeyValueHashmap(Biospecimen biospecimen,
        Collection<BiospecimenField> biospecimenFields) {
    HashMap<String, String> map = new HashMap<String, String>();

    for (BiospecimenField field : biospecimenFields) {
        if (field.getFieldName().equalsIgnoreCase("sampleType")) {
            if (biospecimen.getSampleType() != null) {
                map.put(field.getPublicFieldName(), biospecimen.getSampleType().getName());
            }/*from   w w  w .ja  va  2  s .c o m*/
        } else if (field.getFieldName().equalsIgnoreCase("storedIn")) {
            if (biospecimen.getStoredIn() != null) {
                map.put(field.getPublicFieldName(), biospecimen.getStoredIn().getName());
            }
        } else if (field.getFieldName().equalsIgnoreCase("grade")) {
            if (biospecimen.getGrade() != null) {
                map.put(field.getPublicFieldName(), biospecimen.getGrade().getName());
            }
        } else if (field.getFieldName().equalsIgnoreCase("sampleDate")) {
            if (biospecimen.getSampleDate() != null) {
                map.put(field.getPublicFieldName(),
                        biospecimen.getSampleDate() != null ? biospecimen.getSampleDate().toString() : "");
            }
        } else if (field.getFieldName().equalsIgnoreCase("sampleTime")) {
            if (biospecimen.getSampleTime() != null) {
                //               map.put(field.getPublicFieldName(), biospecimen.getSampleTime()!=null?biospecimen.getSampleTime().toString().substring(8):"");
                SimpleDateFormat ft = new SimpleDateFormat("H:mm:ss");
                map.put(field.getPublicFieldName(), ft.format(biospecimen.getSampleTime()));
            }
        } else if (field.getFieldName().equalsIgnoreCase("processedDate")) {
            if (biospecimen.getProcessedDate() != null) {
                map.put(field.getPublicFieldName(),
                        biospecimen.getProcessedDate() != null ? biospecimen.getProcessedDate().toString()
                                : "");
            }
        } else if (field.getFieldName().equalsIgnoreCase("processedTime")) {
            if (biospecimen.getProcessedTime() != null) {
                SimpleDateFormat ft = new SimpleDateFormat("H:mm:ss");
                map.put(field.getPublicFieldName(), ft.format(biospecimen.getProcessedTime()));
            }
        } else if (field.getFieldName().equalsIgnoreCase("comments")) {
            if (biospecimen.getComments() != null) {
                map.put(field.getPublicFieldName(), biospecimen.getComments());
            }
        } else if (field.getFieldName().equalsIgnoreCase("unit")) {
            if (biospecimen.getUnit() != null) {
                map.put(field.getPublicFieldName(), biospecimen.getUnit().getName());
            }
        } else if (field.getFieldName().equalsIgnoreCase("treatmentType")) {
            if (biospecimen.getTreatmentType() != null) {
                map.put(field.getPublicFieldName(), biospecimen.getTreatmentType().getName());
            }
        } else if (field.getFieldName().equalsIgnoreCase("barcoded")) {
            if (biospecimen.getBarcoded() != null) {
                map.put(field.getPublicFieldName(),
                        biospecimen.getBarcoded() != null ? biospecimen.getBarcoded().toString() : "");
            }
        } else if (field.getFieldName().equalsIgnoreCase("anticoag")) {
            if (biospecimen.getAnticoag() != null) {
                map.put(field.getPublicFieldName(), biospecimen.getAnticoag().getName());
            }
        } else if (field.getFieldName().equalsIgnoreCase("status")) {
            if (biospecimen.getStatus() != null) {
                map.put(field.getPublicFieldName(), biospecimen.getStatus().getName());
            }
        } else if (field.getFieldName().equalsIgnoreCase("concentration")) {
            if (biospecimen.getConcentration() != null) {
                map.put(field.getPublicFieldName(),
                        biospecimen.getConcentration() != null ? biospecimen.getConcentration().toString()
                                : "");
            }
        } else if (field.getFieldName().equalsIgnoreCase("amount")) {
            if (biospecimen.getAmount() != null) {
                map.put(field.getPublicFieldName(),
                        biospecimen.getAmount() != null ? biospecimen.getAmount().toString() : "");
            }
        } else if (field.getFieldName().equalsIgnoreCase("status")) {
            if (biospecimen.getTreatmentType() != null) {
                map.put(field.getPublicFieldName(), biospecimen.getStatus().getName());
            }
        } else if (field.getFieldName().equalsIgnoreCase("biospecimenProtocol")) {
            if (biospecimen.getBiospecimenProtocol() != null) {
                map.put(field.getPublicFieldName(), biospecimen.getBiospecimenProtocol().getName());
            }
        } else if (field.getFieldName().equalsIgnoreCase("purity")) {
            if (biospecimen.getPurity() != null) {
                map.put(field.getPublicFieldName(),
                        biospecimen.getPurity() != null ? biospecimen.getPurity().toString() : "");
            }
        } else if (field.getFieldName().equalsIgnoreCase("quality")) {
            if (biospecimen.getQuality() != null) {
                map.put(field.getPublicFieldName(), biospecimen.getQuality().getName());
            }
        } else if (field.getFieldName().equalsIgnoreCase("quantity")) {
            if (biospecimen.getQuantity() != null) {
                map.put(field.getPublicFieldName(),
                        biospecimen.getQuantity() != null ? biospecimen.getQuantity().toString() : "");
            }
        } else if (field.getFieldName().equalsIgnoreCase("site")) {
            if (biospecimen.getInvCell() != null) {
                map.put(field.getPublicFieldName(), biospecimen.getInvCell().getInvBox().getInvRack()
                        .getInvFreezer().getInvSite().getName());
            }
        } else if (field.getFieldName().equalsIgnoreCase("freezer")) {
            if (biospecimen.getInvCell() != null) {
                map.put(field.getPublicFieldName(),
                        biospecimen.getInvCell().getInvBox().getInvRack().getInvFreezer().getName());
            }
        } else if (field.getFieldName().equalsIgnoreCase("rack")) {
            if (biospecimen.getInvCell() != null) {
                map.put(field.getPublicFieldName(),
                        biospecimen.getInvCell().getInvBox().getInvRack().getName());
            }
        } else if (field.getFieldName().equalsIgnoreCase("box")) {
            if (biospecimen.getInvCell() != null) {
                map.put(field.getPublicFieldName(), biospecimen.getInvCell().getInvBox().getName());
            }
        } else if (field.getFieldName().equalsIgnoreCase("column")) {
            if (biospecimen.getInvCell() != null) {
                String colLabel = new String();
                if (biospecimen.getInvCell().getInvBox().getColnotype().getName()
                        .equalsIgnoreCase("ALPHABET")) {
                    char character = (char) (biospecimen.getInvCell().getColno() + 64);
                    colLabel = new Character(character).toString();
                } else {
                    colLabel = new Integer(biospecimen.getInvCell().getColno().intValue()).toString();
                }

                map.put(field.getPublicFieldName(), colLabel);
            }
        } else if (field.getFieldName().equalsIgnoreCase("row")) {
            if (biospecimen.getInvCell() != null) {
                String rowLabel = new String();
                if (biospecimen.getInvCell().getInvBox().getRownotype().getName()
                        .equalsIgnoreCase("ALPHABET")) {
                    char character = (char) (biospecimen.getInvCell().getRowno() + 64);
                    rowLabel = new Character(character).toString();
                } else {
                    rowLabel = new Integer(biospecimen.getInvCell().getRowno().intValue()).toString();
                }

                map.put(field.getPublicFieldName(), rowLabel);
            }
        } else if (field.getFieldName().equalsIgnoreCase("bioCollectionUid")) {
            map.put(field.getPublicFieldName(), biospecimen.getBioCollection().getBiocollectionUid());
        } else if (field.getFieldName().equalsIgnoreCase("name")) {
            map.put(field.getPublicFieldName(), biospecimen.getBioCollection().getName());
        } else if (field.getFieldName().equalsIgnoreCase("parentUID")) {
            if (biospecimen.getParent() != null) {
                map.put(field.getPublicFieldName(), biospecimen.getParent().getBiospecimenUid());
            }
        }
    }
    return map;
}