Example usage for java.lang Byte Byte

List of usage examples for java.lang Byte Byte

Introduction

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

Prototype

@Deprecated(since = "9")
public Byte(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Byte object that represents the byte value indicated by the String parameter.

Usage

From source file:br.com.topsys.util.TSArrayUtil.java

/**
 * <p>//  w w w.j a va 2 s . c  om
 * Converts an array of primitive bytes to objects.
 * </p>
 * 
 * <p>
 * This method returns <code>null</code> if <code>null</code> array
 * input.
 * </p>
 * 
 * @param array
 *            a <code>byte</code> array
 * @return a <code>Byte</code> array, <code>null</code> if null array
 *         input
 */
public static Byte[] toObject(final byte[] array) {
    if (array == null) {
        return null;
    } else if (array.length == 0) {
        return EMPTY_BYTE_OBJECT_ARRAY;
    }
    final Byte[] result = new Byte[array.length];
    for (int i = 0; i < array.length; i++) {
        result[i] = new Byte(array[i]);
    }
    return result;
}

From source file:edu.ku.brc.dbsupport.ImportExportDB.java

    /**
         * set the value of an element to the correct type
         * @param compareMe the element/*from w  w w.j av a 2 s .  co  m*/
         * @param dbTable the class name of the table
         * @param parentObject the parent record
         * @param parentName the parentName
         * @return an object, "ManyToMany", "OneToMany", or null if it could not find the type
         */
        protected Object findType(Element compareMe, String dbTable, Object parentObject, String parentName) {
            try { // get the fieldinfo
                String lowerdbTable = dbTable.toLowerCase();
                DBTableInfo info = DBTableIdMgr.getInstance().getInfoByTableName(lowerdbTable);
                // find element with compareme.getName()
                DBFieldInfo fieldInfo = info.getFieldByName(compareMe.getName());
                // if the element is an id, ignore it
                if (!compareMe.getName().equals(lowerFirstChar(dbTable) + "Id")) //$NON-NLS-1$
                {
                    // if it is a normal field
                    if (fieldInfo != null) {
                        String type = fieldInfo.getType();
                        // check the type
                        if (type.equals("java.lang.String") || type.equals("text")) //$NON-NLS-1$ //$NON-NLS-2$
                        {
                            return compareMe.getStringValue();

                        } else if (type.equals("java.util.Date")) //$NON-NLS-1$
                        {
                            Date dtTmp = new SimpleDateFormat("yy-MM-dd H:mm:ss").parse(compareMe //$NON-NLS-1$
                                    .getStringValue());
                            return dtTmp;

                        } else if (type.equals("java.sql.Timestamp")) //$NON-NLS-1$
                        {
                            Timestamp tmstmp = Timestamp.valueOf(compareMe.getStringValue());
                            return tmstmp;
                        } else if (type.equals("java.lang.Integer")) //$NON-NLS-1$
                        {
                            int num = new Integer(compareMe.getStringValue()).intValue();
                            return num;

                        } else if (type.equals("java.lang.Boolean")) //$NON-NLS-1$
                        {
                            Boolean bool = Boolean.valueOf(compareMe.getStringValue());
                            return bool;
                        } else if (type.equals("java.math.BigDecimal")) //$NON-NLS-1$
                        {
                            BigDecimal num = UIHelper.parseDoubleToBigDecimal(compareMe.getStringValue());
                            return num;
                        } else if (type.equals("java.lang.Double")) //$NON-NLS-1$
                        {
                            double num = new Double(compareMe.getStringValue()).doubleValue();
                            return num;
                        } else if (type.equals("java.lang.Float")) //$NON-NLS-1$
                        {
                            float num = new Float(compareMe.getStringValue()).floatValue();
                            return num;
                        } else if (type.equals("java.lang.Long")) //$NON-NLS-1$
                        {
                            long num = new Long(compareMe.getStringValue()).longValue();
                            return num;
                        } else if (type.equals("java.lang.Short")) //$NON-NLS-1$
                        {
                            short num = new Short(compareMe.getStringValue()).shortValue();
                            return num;
                        } else if (type.equals("java.lang.Byte")) //$NON-NLS-1$
                        {
                            byte num = new Byte(compareMe.getStringValue()).byteValue();
                            return num;
                        } else if (type.equals("java.util.Calendar")) //$NON-NLS-1$
                        {
                            Calendar date = dateString2Calendar(compareMe.getStringValue());
                            return date;
                        }
                    } else
                    // check if it is a many-to-one
                    {
                        DBRelationshipInfo tablerel = info.getRelationshipByName(compareMe.getName());
                        if (tablerel != null && tablerel.getType().name() == "ManyToOne") //$NON-NLS-1$
                        {
                            long num = new Long(compareMe.getStringValue()).longValue();

                            if (compareMe.getName().equals(parentName)) {
                                return parentObject;
                            }
                            // else check if the xml fiel is there,
                            // if so run it
                            // otherwise make a generic thing
                            // some things cant be generic
                            // also check the order of how buildsampledb does it ^.^
                            // a generic map
                            // get the classtype
                            /*
                             * if(compareMe.getName() == "deaccessionPreparation"){ String className =
                             * tablerel.getClassName().substring(29).toLowerCase();//strip working
                             * set Object tableObject2 = genericDBObject2(className, num); return
                             * tableObject2; }
                             */// else{
                                // if(compareMe.getName() == "referenceWork"){File path = new
                                // File(importFolderPath+"ReferenceWork"+".xml");
                            try {// if a generic exsists
                                File path = new File(
                                        importFolderPath + capFirstChar(compareMe.getName()) + "Generic.xml"); //$NON-NLS-1$
                                Element dbImport2 = XMLHelper.readFileToDOM4J(path);
                                Object tableObject = dynamicXMLImportRecReturn(dbImport2,
                                        capFirstChar(compareMe.getName()));
                                return tableObject;
                            } catch (FileNotFoundException e) {
                                edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ImportExportDB.class, e);
                                // normal
                                String className = tablerel.getClassName().substring(29).toLowerCase();// strip working set
                                Object tableObject = genericDBObject2(className, num);
                                return tableObject;
                            }
                            // }else{
                            /*
                             * Element dbImport = XMLHelper.readFileToDOM4J(path); Object
                             * tableObject = dynamicXMLImportRecReturn(dbImport,
                             * capFirstChar(compareMe.getName())); return tableObject;
                             */
                            // }
                            // check if its a collection (one-to-many)
                        } else if ((tablerel != null && tablerel.getType().name() == "OneToMany") //$NON-NLS-1$
                                || (tablerel != null && tablerel.getType().name() == "ManyToMany")) //$NON-NLS-1$
                        {
                            // if many-to-many
                            if (compareMe.getName().equals(parentName + "s")) {
//$NON-NLS-0$
                                return "ManyToMany"; //$NON-NLS-1$
                            }
                            // else one-to-many
                            return "OneToMany"; //$NON-NLS-1$
                        } else {
                            log.debug("could not import element: " + compareMe.getName() //$NON-NLS-1$
                                    + ", with data:" + compareMe.getData()); //$NON-NLS-1$
                        }
                    }
                }
            } catch (Exception ex) {
                edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ImportExportDB.class, ex);
                ex.printStackTrace();
            }
            return null;
        }

From source file:de.juwimm.cms.remote.ViewServiceSpringImpl.java

private PersonHbm createPersonHbm(UnitHbm unit, Element ael, boolean useNewIds,
        Hashtable<Integer, Integer> picIds) throws Exception {
    PersonHbm person = new PersonHbmImpl();
    try {// www .j av a  2 s  .  co  m
        Integer imageId = Integer.parseInt(ael.getAttribute("imageid"));
        if (picIds != null) {
            Integer newPicId = picIds.get(imageId);
            person.setImageId(newPicId);
        } else {
            person.setImageId(imageId);
        }
    } catch (Exception exe) {
    }
    try {
        person.setBirthDay(getNVal(ael, "birthDay"));
    } catch (Exception exe) {
    }
    try {
        person.setCountryJob(getNVal(ael, "countryJob"));
        person.setFirstname(getNVal(ael, "firstname"));
        person.setJob(getNVal(ael, "job"));
        person.setJobTitle(getNVal(ael, "jobTitle"));
        person.setLastname(getNVal(ael, "lastname"));
        person.setLinkMedicalAssociation(getNVal(ael, "linkMedicalAssociation"));
        person.setMedicalAssociation(getNVal(ael, "medicalAssociation"));
        person.setPosition(new Byte(getNVal(ael, "position")).byteValue());
        person.setSalutation(getNVal(ael, "salutation"));
        person.setSex(new Byte(getNVal(ael, "sex")).byteValue());
        person.setTitle(getNVal(ael, "title"));
        person.getUnits().add(unit);
        person = getPersonHbmDao().create(person);
    } catch (Exception exe) {
        log.warn("Error setting values: ", exe);
    }
    try {
        if (log.isDebugEnabled())
            log.debug("looking for addresses to import for person " + person.getPersonId());
        Iterator itAdr = XercesHelper.findNodes(ael, "./address");
        while (itAdr.hasNext()) {
            Element adrEl = (Element) itAdr.next();
            if (log.isDebugEnabled())
                log.debug("found address to import");
            AddressHbm local = createAddressHbm(adrEl, useNewIds);
            person.addAddress(local);
        }
    } catch (Exception exe) {
        if (log.isWarnEnabled())
            log.warn("Error importing addresses: ", exe);
        throw new CreateException(exe.getMessage());
    }
    try {
        if (log.isDebugEnabled())
            log.debug("looking for talktimes to import for person " + person.getPersonId());
        Iterator itTTimes = XercesHelper.findNodes(ael, "./talktime");
        while (itTTimes.hasNext()) {
            Element elm = (Element) itTTimes.next();
            if (log.isDebugEnabled())
                log.debug("found talktime to import");
            TalktimeHbm local = createTalktimeHbm(elm, useNewIds);
            person.addTalktime(local);
        }
    } catch (Exception exe) {
        if (log.isWarnEnabled())
            log.warn("Error importing talktimes: ", exe);
        throw new Exception(exe.getMessage());
    }
    mappingPersons.put(Long.parseLong(ael.getAttribute("id")), person.getPersonId());
    return person;
}

From source file:net.sf.jasperreports.engine.xml.JRXmlConstants.java

/**
 * @deprecated Replaced by {@link WhenResourceMissingTypeEnum}.
 *//*from w  w w  .ja v a  2  s .c  om*/
public static Map getWhenResourceMissingTypeMap() {
    if (whenResourceMissingTypeMap == null) {
        Map map = new HashMap(11);
        map.put(WHEN_RESOURCE_MISSING_TYPE_NULL, new Byte(JRReport.WHEN_RESOURCE_MISSING_TYPE_NULL));
        map.put(WHEN_RESOURCE_MISSING_TYPE_EMPTY, new Byte(JRReport.WHEN_RESOURCE_MISSING_TYPE_EMPTY));
        map.put(WHEN_RESOURCE_MISSING_TYPE_KEY, new Byte(JRReport.WHEN_RESOURCE_MISSING_TYPE_KEY));
        map.put(WHEN_RESOURCE_MISSING_TYPE_ERROR, new Byte(JRReport.WHEN_RESOURCE_MISSING_TYPE_ERROR));
        map.put(new Byte(JRReport.WHEN_RESOURCE_MISSING_TYPE_NULL), WHEN_RESOURCE_MISSING_TYPE_NULL);
        map.put(new Byte(JRReport.WHEN_RESOURCE_MISSING_TYPE_EMPTY), WHEN_RESOURCE_MISSING_TYPE_EMPTY);
        map.put(new Byte(JRReport.WHEN_RESOURCE_MISSING_TYPE_KEY), WHEN_RESOURCE_MISSING_TYPE_KEY);
        map.put(new Byte(JRReport.WHEN_RESOURCE_MISSING_TYPE_ERROR), WHEN_RESOURCE_MISSING_TYPE_ERROR);
        whenResourceMissingTypeMap = Collections.unmodifiableMap(map);
    }

    return whenResourceMissingTypeMap;
}

From source file:net.sf.jasperreports.engine.xml.JRXmlConstants.java

/**
 * @deprecated Replaced by {@link MeterShapeEnum}
 *//*from  ww  w. ja  v  a2s.  co  m*/
public static Map getMeterShapeMap() {
    if (meterShapeMap == null) {
        Map map = new HashMap(11);
        map.put(METER_SHAPE_CHORD, new Byte(JRMeterPlot.SHAPE_CHORD));
        map.put(METER_SHAPE_CIRCLE, new Byte(JRMeterPlot.SHAPE_CIRCLE));
        map.put(METER_SHAPE_PIE, new Byte(JRMeterPlot.SHAPE_PIE));
        map.put(METER_SHAPE_DIAL, new Byte(JRMeterPlot.SHAPE_DIAL));
        map.put(new Byte(JRMeterPlot.SHAPE_CHORD), METER_SHAPE_CHORD);
        map.put(new Byte(JRMeterPlot.SHAPE_CIRCLE), METER_SHAPE_CIRCLE);
        map.put(new Byte(JRMeterPlot.SHAPE_PIE), METER_SHAPE_PIE);
        map.put(new Byte(JRMeterPlot.SHAPE_DIAL), METER_SHAPE_DIAL);
        meterShapeMap = Collections.unmodifiableMap(map);
    }

    return meterShapeMap;
}

From source file:de.juwimm.cms.remote.EditionServiceSpringImpl.java

/**
 * This create method takes only mandatory (non-nullable) parameters.
 * /*from  w  ww .ja v a2s  . c o m*/
 * When the client invokes a create method, the EJB container invokes the ejbCreate method. Typically, an ejbCreate method in an entity bean performs the following tasks:
 * <UL>
 * <LI>Inserts the entity state into the database.</LI>
 * <LI>Initializes the instance variables.</LI>
 * <LI>Returns the primary key.</LI>
 * </UL>
 * 
 * @param viewDocument
 *            a_ViewDocument
 * @param reference
 *            mandatory CMR field
 * @param displayLinkName
 *            mandatory CMR field
 * @param linkDescription
 *            mandatory CMR field
 * @param viewComponentId
 *            mandatory CMR field
 * @return A ViewComponentHbm instance
 * 
 */
private ViewComponentHbm createViewComponentHbm(ViewDocumentHbm viewDocument, String reference,
        String displayLinkName, String linkDescription, Integer viewComponentId) {
    ViewComponentHbm view = null;
    if (viewComponentId == null) {
        view = ViewComponentHbm.Factory.newInstance();
    } else {
        view = getViewComponentHbmDao().load(viewComponentId);
    }
    view.setDisplayLinkName(displayLinkName);
    view.setLinkDescription(linkDescription);
    // ?? view.setUrlLinkName(view.getViewComponentId().toString());

    if (reference.equals("root")) {
        view.setViewType(new Byte("1").byteValue());
    } else if (reference.startsWith("content:")) {
        view.setReference(reference.substring(8));
        view.setViewType(new Byte("1").byteValue());
    } else if (reference.startsWith("jump:")) {
        view.setReference(reference.substring(5));
        view.setViewType(new Byte("2").byteValue());
    } else if (reference.equalsIgnoreCase("SEPARATOR")) {
        view.setViewType(new Byte("7").byteValue());
    } else if (reference.startsWith("link:")) {
        view.setReference(reference.substring(5));
        view.setViewType(new Byte("3").byteValue());
    } else if (reference.startsWith("symlink:")) {
        view.setReference(reference.substring(8));
        view.setViewType(new Byte("6").byteValue());
    } else {
        view.setReference(reference);
    }
    view.setStatus(0);
    view.setOnline((byte) 0);
    view.setVisible(true);
    view.setSearchIndexed(true);
    view.setXmlSearchIndexed(true);
    return view;
}

From source file:edu.ku.brc.dbsupport.ImportExportDB.java

    protected Object findTypeSequential(Element compareMe, String dbTable, long parentId, String parentName) {
            try { // get the fieldinfo
                String lowerdbTable = dbTable.toLowerCase();
                DBTableInfo info = DBTableIdMgr.getInstance().getInfoByTableName(lowerdbTable);
                /*//  www .j a  v a 2s.c  o  m
                 * List<DBTableIdMgr.FieldInfo> list = info.getFields();
                 * //log.debug(compareMe.getName()); for( DBTableIdMgr.FieldInfo i: list){
                 * System.out.println(i.getName()); }
                 */
                // find element with compareme.getName()
                DBFieldInfo fieldInfo = info.getFieldByName(compareMe.getName());
                // if the element is an id, ignore it
                if (!compareMe.getName().equals(lowerFirstChar(dbTable) + "Id")) //$NON-NLS-1$
                {
                    // if it is a normal field
                    if (fieldInfo != null) {
                        String type = fieldInfo.getType();
                        // check the type
                        if (type.equals("java.lang.String") || type.equals("text")) //$NON-NLS-1$ //$NON-NLS-2$
                        {
                            return compareMe.getStringValue();

                        } else if (type.equals("java.util.Date")) //$NON-NLS-1$
                        {
                            Date dtTmp = new SimpleDateFormat("yy-MM-dd H:mm:ss").parse(compareMe //$NON-NLS-1$
                                    .getStringValue());
                            return dtTmp;

                        } else if (type.equals("java.sql.Timestamp")) //$NON-NLS-1$
                        {
                            Timestamp tmstmp = Timestamp.valueOf(compareMe.getStringValue());
                            return tmstmp;
                        } else if (type.equals("java.lang.Integer")) //$NON-NLS-1$
                        {
                            int num = new Integer(compareMe.getStringValue()).intValue();
                            return num;

                        } else if (type.equals("java.lang.Boolean")) //$NON-NLS-1$
                        {
                            Boolean bool = Boolean.valueOf(compareMe.getStringValue());
                            return bool;
                        } else if (type.equals("java.math.BigDecimal")) //$NON-NLS-1$
                        {
                            BigDecimal num = UIHelper.parseDoubleToBigDecimal(compareMe.getStringValue());
                            return num;
                        } else if (type.equals("java.lang.Double")) //$NON-NLS-1$
                        {
                            double num = new Double(compareMe.getStringValue()).doubleValue();
                            return num;
                        } else if (type.equals("java.lang.Float")) //$NON-NLS-1$
                        {
                            float num = new Float(compareMe.getStringValue()).floatValue();
                            return num;
                        } else if (type.equals("java.lang.Long")) //$NON-NLS-1$
                        {
                            long num = new Long(compareMe.getStringValue()).longValue();
                            return num;
                        } else if (type.equals("java.lang.Short")) //$NON-NLS-1$
                        {
                            short num = new Short(compareMe.getStringValue()).shortValue();
                            return num;
                        } else if (type.equals("java.lang.Byte")) //$NON-NLS-1$
                        {
                            byte num = new Byte(compareMe.getStringValue()).byteValue();
                            return num;
                        } else if (type.equals("java.util.Calendar")) //$NON-NLS-1$
                        {
                            Calendar date = dateString2Calendar(compareMe.getStringValue());
                            return date;
                        }
                    } else
                    // check if it is a many-to-one
                    {
                        DBRelationshipInfo tablerel = info.getRelationshipByName(compareMe.getName());
                        if (tablerel != null && tablerel.getType().name() == "ManyToOne") //$NON-NLS-1$
                        {
                            long num = new Long(compareMe.getStringValue()).longValue();

                            if (compareMe.getName().equals(lowerFirstChar(parentName)))// if they
                                                                                       // equal, load
                                                                                       // the parent
                                                                                       // from the
                                                                                       // database
                            {
                                String className = tablerel.getClassName().substring(29).toLowerCase();// strip
                                                                                                       // working
                                                                                                       // set
                                Object tableObject = genericDBObject2(className, parentId);
                                return tableObject;
                            }
                            // else check if the xml file is there,
                            // if so run it
                            // otherwise make a generic thing
                            // some things cant be generic
                            // also check the order of how buildsampledb does it ^.^
                            // a generic map
                            // get the classtype
                            /*
                             * if(compareMe.getName() == "deaccessionPreparation"){ String className =
                             * tablerel.getClassName().substring(29).toLowerCase();//strip working
                             * set Object tableObject2 = genericDBObject2(className, num); return
                             * tableObject2; }
                             */// else{
                                // if(compareMe.getName() == "referenceWork"){File path = new
                                // File(importFolderPath+"ReferenceWork"+".xml");
                            try {// if a generic exsists
                                File path = new File(
                                        importFolderPath + capFirstChar(compareMe.getName()) + "Generic.xml"); //$NON-NLS-1$
                                Element dbImport2 = XMLHelper.readFileToDOM4J(path);
                                Object tableObject = dynamicXMLImportRecReturn(dbImport2,
                                        capFirstChar(compareMe.getName()));
                                return tableObject;

                            } catch (FileNotFoundException e) {
                                edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ImportExportDB.class, e);
                                // normal
                                String className = tablerel.getClassName().substring(29).toLowerCase();// strip working set
                                Object tableObject = genericDBObject2(className, num);
                                return tableObject;
                            }
                            // }else{
                            /*
                             * Element dbImport = XMLHelper.readFileToDOM4J(path); Object
                             * tableObject = dynamicXMLImportRecReturn(dbImport,
                             * capFirstChar(compareMe.getName())); return tableObject;
                             */
                            // }
                            // check if its a collection (one-to-many)
                        } else if ((tablerel != null && tablerel.getType().name() == "OneToMany") //$NON-NLS-1$
                                || (tablerel != null && tablerel.getType().name() == "ManyToMany")) //$NON-NLS-1$
                        {
                            // if many-to-many
                            if (compareMe.getName().equals(parentName + "s")) {
//$NON-NLS-0$
                                return "ManyToMany"; //$NON-NLS-1$
                            }
                            // else one-to-many
                            return "OneToMany"; //$NON-NLS-1$
                        } else {
                            log.debug("could not import element: " + compareMe.getName() //$NON-NLS-1$
                                    + ", with data:" + compareMe.getData()); //$NON-NLS-1$
                        }
                    }
                }
            } catch (Exception ex) {
                edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ImportExportDB.class, ex);
                ex.printStackTrace();
            }
            return null;
        }

From source file:net.sf.jasperreports.engine.xml.JRXmlConstants.java

/**
 * @deprecated Replaced by {@link ValueLocationEnum}
 *//*from   www .j  a  va 2s.c  o m*/
public static Map getThermometerValueLocationMap() {
    if (thermometerValueLocationMap == null) {
        Map map = new HashMap(11);
        map.put(THERMOMETER_VALUE_LOCATION_NONE, new Byte(JRThermometerPlot.LOCATION_NONE));
        map.put(THERMOMETER_VALUE_LOCATION_LEFT, new Byte(JRThermometerPlot.LOCATION_LEFT));
        map.put(THERMOMETER_VALUE_LOCATION_RIGHT, new Byte(JRThermometerPlot.LOCATION_RIGHT));
        map.put(THERMOMETER_VALUE_LOCATION_BULB, new Byte(JRThermometerPlot.LOCATION_BULB));
        map.put(new Byte(JRThermometerPlot.LOCATION_NONE), THERMOMETER_VALUE_LOCATION_NONE);
        map.put(new Byte(JRThermometerPlot.LOCATION_LEFT), THERMOMETER_VALUE_LOCATION_LEFT);
        map.put(new Byte(JRThermometerPlot.LOCATION_RIGHT), THERMOMETER_VALUE_LOCATION_RIGHT);
        map.put(new Byte(JRThermometerPlot.LOCATION_BULB), THERMOMETER_VALUE_LOCATION_BULB);
        thermometerValueLocationMap = Collections.unmodifiableMap(map);
    }

    return thermometerValueLocationMap;
}

From source file:net.sf.jasperreports.engine.xml.JRXmlConstants.java

/**
 * @deprecated Replaced by {@link AxisPositionEnum}
 *//*from   w  ww.ja va 2 s  .c o  m*/
public static Map getAxisPositionMap() {
    if (axisPositionMap == null) {
        Map map = new HashMap(6);
        map.put(AXIS_POSITION_LEFT_OR_TOP, new Byte(JRChartAxis.POSITION_LEFT_OR_TOP));
        map.put(AXIS_POSITION_RIGHT_OR_BOTTOM, new Byte(JRChartAxis.POSITION_RIGHT_OR_BOTTOM));
        map.put(new Byte(JRChartAxis.POSITION_LEFT_OR_TOP), AXIS_POSITION_LEFT_OR_TOP);
        map.put(new Byte(JRChartAxis.POSITION_RIGHT_OR_BOTTOM), AXIS_POSITION_RIGHT_OR_BOTTOM);
        axisPositionMap = Collections.unmodifiableMap(map);
    }

    return axisPositionMap;
}

From source file:de.juwimm.cms.remote.ViewServiceSpringImpl.java

/**
 * Used for import single view component
 * @param parentId/* www .ja  v a 2 s  . c o m*/
 * @param doc
 * @param withChildren
 * @param picIds
 * @param docIds
 * @return 
 */
private ViewComponentHbm createViewComponentFromXml(Integer parentId, Document doc, boolean withChildren,
        Hashtable<Integer, Integer> picIds, Hashtable<Integer, Integer> docIds, boolean useNewIds,
        Integer siteId, Integer fulldeploy, Integer newUnitId) {
    ViewComponentHbm viewComponent = ViewComponentHbm.Factory.newInstance();
    ViewComponentHbm parent = getViewComponentHbmDao().load(parentId);

    try {
        Integer id = sequenceHbmDao.getNextSequenceNumber("viewcomponent.view_component_id");
        viewComponent.setViewComponentId(id);
    } catch (Exception e) {
        log.error("Error creating/setting primary key", e);
    }
    Iterator it = XercesHelper.findNodes(doc, "//viewcomponent");
    try {
        while (it.hasNext()) {
            Node nodeViewComponent = (Node) it.next();
            Integer vcId = new Integer(((Element) nodeViewComponent).getAttribute("id"));
            Node nodeRealm = XercesHelper.findNode(nodeViewComponent, "realm2viewComponent");
            /**import realms*/
            importRealms(nodeViewComponent, siteId, useNewIds);
            importViewComponentPictures(nodeViewComponent, viewComponent);
            importViewComponentDocuments(nodeViewComponent, viewComponent);
            String linkName = XercesHelper.getNodeValue(nodeViewComponent, "//linkName");
            String approvedLinkName = XercesHelper.getNodeValue(nodeViewComponent, "//approvedLinkName");
            String statusInfo = XercesHelper.getNodeValue(nodeViewComponent, "//statusInfo");
            String urlLinkName = XercesHelper.getNodeValue(nodeViewComponent, "//urlLinkName");
            viewComponent.setDisplayLinkName(linkName);
            viewComponent.setApprovedLinkName(approvedLinkName);
            viewComponent.setLinkDescription(statusInfo);
            viewComponent.setUrlLinkName(urlLinkName);
            byte viewType = new Byte(XercesHelper.getNodeValue(nodeViewComponent, "//viewType")).byteValue();
            boolean visible = Boolean.valueOf(XercesHelper.getNodeValue(nodeViewComponent, "//visible"))
                    .booleanValue();
            viewComponent.setMetaData(XercesHelper.getNodeValue(nodeViewComponent, "./metaKeywords"));
            viewComponent.setMetaDescription(XercesHelper.getNodeValue(nodeViewComponent, "./metaDescription"));
            String onlineStart = XercesHelper.getNodeValue(nodeViewComponent, "./onlineStart");
            if (!onlineStart.equals("")) {
                if (log.isDebugEnabled())
                    log.debug("OnlineStart: " + onlineStart);
                viewComponent.setOnlineStart(Long.parseLong(onlineStart));
            }
            String onlineStop = XercesHelper.getNodeValue(nodeViewComponent, "./onlineStop");
            if (!onlineStop.equals("")) {
                if (log.isDebugEnabled())
                    log.debug("OnlineStop: " + onlineStop);
                viewComponent.setOnlineStop(Long.parseLong(onlineStop));
            }
            viewComponent.setViewLevel(XercesHelper.getNodeValue(nodeViewComponent, "./viewLevel"));
            viewComponent.setViewIndex(XercesHelper.getNodeValue(nodeViewComponent, "./viewIndex"));
            viewComponent.setDisplaySettings(
                    Byte.parseByte(XercesHelper.getNodeValue(nodeViewComponent, "./displaySettings")));
            viewComponent
                    .setShowType(Byte.parseByte(XercesHelper.getNodeValue(nodeViewComponent, "./showType")));
            viewComponent.setViewType(viewType);
            viewComponent.setVisible(visible);
            viewComponent.setSearchIndexed(Boolean
                    .valueOf(XercesHelper.getNodeValue(nodeViewComponent, "./searchIndexed")).booleanValue());
            viewComponent.setXmlSearchIndexed(
                    Boolean.valueOf(XercesHelper.getNodeValue(nodeViewComponent, "./xmlSearchIndexed"))
                            .booleanValue());
            byte status = Constants.DEPLOY_STATUS_EDITED;
            viewComponent.setStatus(status);
            viewComponent.setOnline((byte) 0);
            Element cnde = (Element) XercesHelper.findNode(nodeViewComponent, "//content");
            if (cnde != null) {
                ContentHbm content = getContentHbmDao().createFromXml(cnde, false, false, picIds, docIds,
                        mappingPersons, newUnitId);
                viewComponent.setReference(content.getContentId().toString());
            }

            if (fulldeploy > 0) {
                // use new ids
                String neededrole = XercesHelper.getNodeValue(nodeRealm, "roleNeeded");
                String loginPage = XercesHelper.getNodeValue(nodeRealm, "loginPageId");
                if (loginPage != null && !"".equalsIgnoreCase(loginPage)) {
                    Integer loginPageId = null;
                    try {
                        loginPageId = Integer.valueOf(loginPage);
                    } catch (Exception e) {
                    }
                    if (loginPageId != null)
                        loginPagesRealm2vc.put(vcId, loginPageId);
                }
                Node relNode = XercesHelper.findNode(nodeRealm, "jdbcRealmId");
                if (relNode != null) {
                    Integer id = new Integer(XercesHelper.getNodeValue(relNode));
                    RealmJdbcHbm sqlrealm = super.getRealmJdbcHbmDao().load(mappingRealmsJdbc.get(id));
                    Realm2viewComponentHbm tempRealm = createTempRealm(viewComponent, neededrole, sqlrealm,
                            null, null, null);
                    Realm2viewComponentHbm r = super.getRealm2viewComponentHbmDao().create(tempRealm);
                    viewComponent.setRealm2vc(r);
                } else {
                    relNode = XercesHelper.findNode(nodeRealm, "simplePwRealmId");
                    if (relNode != null) {
                        Integer id = new Integer(XercesHelper.getNodeValue(relNode));
                        RealmSimplePwHbm realm = super.getRealmSimplePwHbmDao()
                                .load(mappingRealmsSimplePw.get(id));
                        Realm2viewComponentHbm tempRealm = createTempRealm(viewComponent, neededrole, null,
                                realm, null, null);
                        Realm2viewComponentHbm r = super.getRealm2viewComponentHbmDao().create(tempRealm);
                        viewComponent.setRealm2vc(r);
                    } else {
                        relNode = XercesHelper.findNode(nodeRealm, "ldapRealmId");
                        if (relNode != null) {
                            Integer id = new Integer(XercesHelper.getNodeValue(relNode));
                            RealmLdapHbm realm = super.getRealmLdapHbmDao().load(mappingRealmsLdap.get(id));
                            Realm2viewComponentHbm tempRealm = createTempRealm(viewComponent, neededrole, null,
                                    null, realm, null);
                            Realm2viewComponentHbm r = super.getRealm2viewComponentHbmDao().create(tempRealm);
                            viewComponent.setRealm2vc(r);
                        } else {
                            relNode = XercesHelper.findNode(nodeRealm, "jaasRealmId");
                            if (relNode != null) {
                                Integer id = new Integer(XercesHelper.getNodeValue(relNode));
                                RealmJaasHbm realm = super.getRealmJaasHbmDao().load(mappingRealmsJaas.get(id));
                                Realm2viewComponentHbm tempRealm = createTempRealm(viewComponent, neededrole,
                                        null, null, null, realm);
                                Realm2viewComponentHbm r = super.getRealm2viewComponentHbmDao()
                                        .create(tempRealm);
                                viewComponent.setRealm2vc(r);
                            }
                        }
                    }
                }
            } else {
                Realm2viewComponentHbm tempRealm = new Realm2viewComponentHbmImpl();
                tempRealm.setViewComponent(viewComponent);
                Realm2viewComponentHbm r = super.getRealm2viewComponentHbmDao().create(tempRealm);
                viewComponent.setRealm2vc(r);
                String loginPage = XercesHelper.getNodeValue(nodeRealm, "loginPageId");
                if (loginPage != null && !"".equalsIgnoreCase(loginPage)) {
                    Integer loginPageId = null;
                    try {
                        loginPageId = Integer.valueOf(loginPage);
                    } catch (Exception e) {
                    }
                }
            }

        }
    } catch (Exception e) {
        if (log.isDebugEnabled())
            log.debug("Error ar import viewcomponent");
    }
    viewComponent.setChildren(null);
    viewComponent.setViewDocument(parent.getViewDocument());
    return getViewComponentHbmDao().create(viewComponent);
}