Example usage for java.util TreeMap values

List of usage examples for java.util TreeMap values

Introduction

In this page you can find the example usage for java.util TreeMap values.

Prototype

public Collection<V> values() 

Source Link

Document

Returns a Collection view of the values contained in this map.

Usage

From source file:org.kalypso.project.database.server.ProjectDatabase.java

@Override
public KalypsoProjectBean[] getProjectHeads(final String projectType) {
    synchronized (this) {
        /** Getting the Session Factory and session */
        final Session session = FACTORY.getCurrentSession();

        /** Starting the Transaction */
        final Transaction tx = session.beginTransaction();

        /* names of existing projects */
        final List<?> names = session.createQuery(String.format(
                "select m_unixName from KalypsoProjectBean where m_projectType = '%s' ORDER by m_name", //$NON-NLS-1$
                projectType)).list();//from  w ww.  ja  v  a  2  s. co  m
        tx.commit();

        final Set<String> projects = new HashSet<>();

        for (final Object object : names) {
            if (!(object instanceof String))
                continue;

            final String name = object.toString();
            projects.add(name);
        }

        final List<KalypsoProjectBean> projectBeans = new ArrayList<>();

        for (final String project : projects) {
            final TreeMap<Integer, KalypsoProjectBean> myBeans = new TreeMap<>();

            final Session mySession = FACTORY.getCurrentSession();
            final Transaction myTx = mySession.beginTransaction();
            final List<?> beans = mySession.createQuery(String.format(
                    "from KalypsoProjectBean where m_unixName = '%s'  ORDER by m_projectVersion", project)) //$NON-NLS-1$
                    .list();
            myTx.commit();

            for (final Object object : beans) {
                if (!(object instanceof KalypsoProjectBean))
                    continue;

                final KalypsoProjectBean b = (KalypsoProjectBean) object;
                myBeans.put(b.getProjectVersion(), b);
            }

            final Integer[] keys = myBeans.keySet().toArray(new Integer[] {});

            /* determine head */
            final KalypsoProjectBean head = myBeans.get(keys[keys.length - 1]);

            KalypsoProjectBean[] values = myBeans.values().toArray(new KalypsoProjectBean[] {});
            values = ArrayUtils.remove(values, values.length - 1); // remove last entry -> cycle!

            // TODO check needed? - order by clauses
            Arrays.sort(values, new Comparator<KalypsoProjectBean>() {
                @Override
                public int compare(final KalypsoProjectBean o1, final KalypsoProjectBean o2) {
                    return o1.getProjectVersion().compareTo(o2.getProjectVersion());
                }
            });

            head.setChildren(values);
            projectBeans.add(head);
        }

        return projectBeans.toArray(new KalypsoProjectBean[] {});
    }

}

From source file:ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition.java

private void scanCompositeElementForChildren() {
    Set<String> elementNames = new HashSet<String>();
    TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> orderToElementDef = new TreeMap<Integer, BaseRuntimeDeclaredChildDefinition>();
    TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> orderToExtensionDef = new TreeMap<Integer, BaseRuntimeDeclaredChildDefinition>();

    scanCompositeElementForChildren(elementNames, orderToElementDef, orderToExtensionDef);

    if (forcedOrder != null) {
        /* //from  w  ww . ja  v  a 2  s.co  m
         * Find out how many elements don't match any entry in the list
         * for forced order. Those elements come first.
         */
        TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> newOrderToExtensionDef = new TreeMap<Integer, BaseRuntimeDeclaredChildDefinition>();
        int unknownCount = 0;
        for (BaseRuntimeDeclaredChildDefinition nextEntry : orderToElementDef.values()) {
            if (!forcedOrder.containsKey(nextEntry.getElementName())) {
                newOrderToExtensionDef.put(unknownCount, nextEntry);
                unknownCount++;
            }
        }
        for (BaseRuntimeDeclaredChildDefinition nextEntry : orderToElementDef.values()) {
            if (forcedOrder.containsKey(nextEntry.getElementName())) {
                Integer newOrder = forcedOrder.get(nextEntry.getElementName());
                newOrderToExtensionDef.put(newOrder + unknownCount, nextEntry);
            }
        }
        orderToElementDef = newOrderToExtensionDef;
    }

    // while (orderToElementDef.size() > 0 && orderToElementDef.firstKey() <
    // 0) {
    // BaseRuntimeDeclaredChildDefinition elementDef =
    // orderToElementDef.remove(orderToElementDef.firstKey());
    // if (elementDef.getElementName().equals("identifier")) {
    // orderToElementDef.put(theIdentifierOrder, elementDef);
    // } else {
    // throw new ConfigurationException("Don't know how to handle element: "
    // + elementDef.getElementName());
    // }
    // }

    TreeSet<Integer> orders = new TreeSet<Integer>();
    orders.addAll(orderToElementDef.keySet());
    orders.addAll(orderToExtensionDef.keySet());

    for (Integer i : orders) {
        BaseRuntimeChildDefinition nextChild = orderToElementDef.get(i);
        if (nextChild != null) {
            this.addChild(nextChild);
        }
        BaseRuntimeDeclaredChildDefinition nextExt = orderToExtensionDef.get(i);
        if (nextExt != null) {
            this.addExtension((RuntimeChildDeclaredExtensionDefinition) nextExt);
        }
    }

}

From source file:org.apache.felix.webconsole.internal.compendium.ComponentsServlet.java

private void renderServletResult(final PrintWriter printWriter, final Component component) throws IOException {
    final JSONWriter jsonWriter = new JSONWriter(printWriter);
    try {/*from  ww  w . ja  v  a 2s .c o  m*/
        jsonWriter.object();

        final ScrService scrService = getScrService();
        if (scrService == null) {
            jsonWriter.key("status");
            jsonWriter.value("Apache Felix Declarative Service required for this function");
        } else {
            final Component[] serviceComponents = scrService.getComponents();

            if (serviceComponents == null || serviceComponents.length == 0) {
                jsonWriter.key("status");
                jsonWriter.value("No components installed currently");
            } else {
                // order components by name
                TreeMap componentMap = new TreeMap();
                for (int i = 0; i < serviceComponents.length; i++) {
                    Component tempComp = serviceComponents[i];
                    componentMap.put(tempComp.getName(), tempComp);
                }

                final StringBuffer strBuffer = new StringBuffer();
                strBuffer.append(componentMap.size());
                strBuffer.append(" component");
                if (componentMap.size() != 1) {
                    strBuffer.append('s');
                }
                strBuffer.append(" installed.");
                jsonWriter.key("status");
                jsonWriter.value(strBuffer.toString());

                // render components
                jsonWriter.key("data");
                jsonWriter.array();
                if (component != null) {
                    jsonComponent(jsonWriter, component, true);
                } else {
                    for (Iterator ci = componentMap.values().iterator(); ci.hasNext();) {
                        jsonComponent(jsonWriter, (Component) ci.next(), false);
                    }
                }
                jsonWriter.endArray();
            }
        }

        jsonWriter.endObject();
    } catch (JSONException je) {
        throw new IOException(je.toString());
    }
}

From source file:net.sf.sessionAnalysis.SessionVisitorArrivalAndCompletionRate.java

/**
 * Note that metrics other than max, min are more difficult, as we need to include the duration
 * that this number of sessions is present in the interval (e.g., for mean, median, ...).
 *//*  w  ww  . j  av  a2s.com*/
private void computeMaxSessionsPerInterval() {
    final long durationNanos = this.maxTimestampNanos - this.minTimestampNanos;
    final int numBuckets = (int) Math.ceil((double) durationNanos / this.resolutionValueNanos);

    // Note that the map must not be filled with 0's, because this introduces errors for 
    // intervals without events.
    TreeMap<Integer, Integer> numSessionsPerInterval = new TreeMap<Integer, Integer>();

    for (Entry<Long, Integer> numSessionChangeEvent : this.numConcurrentSessionsOverTime.entrySet()) {
        final long eventTimeStamp = numSessionChangeEvent.getKey();
        final int numSessionsAtTime = numSessionChangeEvent.getValue();

        final int eventTimeStampBucket = (int) ((eventTimeStamp - this.minTimestampNanos)
                / this.resolutionValueNanos);

        Integer lastMaxNumForBucket = numSessionsPerInterval.get(eventTimeStampBucket);
        if (lastMaxNumForBucket == null || numSessionsAtTime > lastMaxNumForBucket) {
            numSessionsPerInterval.put(eventTimeStampBucket, numSessionsAtTime);
        }
    }

    // Now we need to fill intervals without values with the last non-null value
    int lastNonNullValue = 0;
    for (int i = 0; i < numBuckets; i++) {
        Integer curVal = numSessionsPerInterval.get(i);
        if (curVal == null) {
            numSessionsPerInterval.put(i, lastNonNullValue);
        } else {
            lastNonNullValue = curVal;
        }
    }

    this.maxNumSessionsPerInterval = ArrayUtils
            .toPrimitive(numSessionsPerInterval.values().toArray(new Integer[0]));
}

From source file:my.mavenproject10.FileuploadController.java

@RequestMapping(method = RequestMethod.POST)
ModelAndView upload(HttpServletRequest request, HttpServletResponse response) {

    boolean isMultipart = ServletFileUpload.isMultipartContent(request);
    String fileName = "";
    int size = 0;
    ArrayList<String> result = new ArrayList<String>();
    if (isMultipart) {
        FileItemFactory factory = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(factory);

        try {//from  w  w  w  . ja v  a 2 s  .  c om
            List items = upload.parseRequest(request);
            Iterator iterator = items.iterator();
            while (iterator.hasNext()) {
                FileItem item = (FileItem) iterator.next();
                fileName = item.getName();
                System.out.println("file name " + item.getName());
                JAXBContext jc = JAXBContext.newInstance(CustomersType.class);
                SAXParserFactory spf = SAXParserFactory.newInstance();
                XMLReader xmlReader = spf.newSAXParser().getXMLReader();
                InputSource inputSource = new InputSource(
                        new InputStreamReader(item.getInputStream(), "UTF-8"));
                SAXSource source = new SAXSource(xmlReader, inputSource);
                Unmarshaller unmarshaller = jc.createUnmarshaller();
                CustomersType data2 = (CustomersType) unmarshaller.unmarshal(source);
                //System.out.println("size " + data2.getCustomer().size());
                size = data2.getCustomer().size();
                for (CustomerType customer : data2.getCustomer()) {
                    System.out.println(customer.toString());
                }
                //  
                double summ = 0.0;
                HashMap<Integer, Float> ordersMap = new HashMap<Integer, Float>();
                for (CustomerType customer : data2.getCustomer()) {
                    for (OrderType orderType : customer.getOrders().getOrder()) {
                        Float summPerOrder = 0.0f;
                        //System.out.println(orderType);
                        for (PositionType positionType : orderType.getPositions().getPosition()) {
                            //System.out.println(positionType);
                            summPerOrder += positionType.getCount() * positionType.getPrice();
                            summ += positionType.getCount() * positionType.getPrice();
                        }
                        ordersMap.put(orderType.getId(), summPerOrder);
                    }
                }
                summ = new BigDecimal(summ).setScale(2, RoundingMode.UP).doubleValue();
                System.out.println("   " + summ);
                result.add("   " + summ);

                //    
                HashMap<Integer, Float> customersMap = new HashMap<Integer, Float>();
                for (CustomerType customer : data2.getCustomer()) {
                    Float summPerCust = 0.0f;
                    customersMap.put(customer.getId(), summPerCust);
                    for (OrderType orderType : customer.getOrders().getOrder()) {
                        for (PositionType positionType : orderType.getPositions().getPosition()) {
                            summPerCust += positionType.getCount() * positionType.getPrice();
                        }
                    }
                    //System.out.println(customer.getId() + " orders " + summPerCust);
                    customersMap.put(customer.getId(), summPerCust);
                }
                TreeMap sortedMap = sortByValue(customersMap);
                System.out.println(" " + sortedMap.keySet().toArray()[0]
                        + "    : " + sortedMap.get(sortedMap.firstKey()));
                result.add(" " + sortedMap.keySet().toArray()[0] + "    : "
                        + sortedMap.get(sortedMap.firstKey()));

                //  
                TreeMap sortedMapOrders = sortByValue(ordersMap);
                System.out.println("   " + sortedMapOrders.keySet().toArray()[0]
                        + " : " + sortedMapOrders.get(sortedMapOrders.firstKey()));
                result.add("   " + sortedMapOrders.keySet().toArray()[0] + " : "
                        + sortedMapOrders.get(sortedMapOrders.firstKey()));

                //  
                System.out.println("   "
                        + sortedMapOrders.keySet().toArray()[sortedMapOrders.keySet().toArray().length - 1]
                        + " : " + sortedMapOrders.get(sortedMapOrders.lastKey()));
                result.add("   "
                        + sortedMapOrders.keySet().toArray()[sortedMapOrders.keySet().toArray().length - 1]
                        + " : " + sortedMapOrders.get(sortedMapOrders.lastKey()));

                // 
                System.out.println("  " + sortedMapOrders.size());
                result.add("  " + sortedMapOrders.size());

                //  
                ArrayList<Float> floats = new ArrayList<Float>(sortedMapOrders.values());
                Float summAvg = 0.0f;
                Float avg = 0.0f;
                for (Float f : floats) {
                    summAvg += f;
                }
                avg = new BigDecimal(summAvg / floats.size()).setScale(2, RoundingMode.UP).floatValue();
                System.out.println("   " + avg);
                result.add("   " + avg);

            }
        } catch (FileUploadException e) {
            System.out.println("FileUploadException:- " + e.getMessage());
        } catch (JAXBException ex) {
            //Logger.getLogger(FileuploadController.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedEncodingException ex) {
            Logger.getLogger(FileuploadController.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(FileuploadController.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ParserConfigurationException ex) {
            Logger.getLogger(FileuploadController.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SAXException ex) {
            Logger.getLogger(FileuploadController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    ModelAndView modelAndView = new ModelAndView("fileuploadsuccess");
    modelAndView.addObject("files", result);
    modelAndView.addObject("name", fileName);
    modelAndView.addObject("size", size);
    return modelAndView;

}

From source file:org.jvnet.hudson.update_center.Main.java

/**
 * Identify the latest core, populates the htaccess redirect file, optionally download the core wars and build the index.html
 * @return the JSON for the core Jenkins
 *//*from  w  w  w. j  a va 2  s  . c  o  m*/
protected JSONObject buildCore(MavenRepository repository, PrintWriter redirect) throws Exception {
    TreeMap<VersionNumber, HudsonWar> wars = repository.getHudsonWar();
    if (wars.isEmpty())
        return null;

    HudsonWar latest = wars.get(wars.firstKey());
    JSONObject core = latest.toJSON("core");
    System.out.println("core\n=> " + core);

    redirect.printf("Redirect 302 /latest/jenkins.war %s\n", latest.getURL().getPath());
    redirect.printf(
            "Redirect 302 /latest/debian/jenkins.deb http://pkg.jenkins-ci.org/debian/binary/jenkins_%s_all.deb\n",
            latest.getVersion());
    redirect.printf(
            "Redirect 302 /latest/redhat/jenkins.rpm http://pkg.jenkins-ci.org/redhat/RPMS/noarch/jenkins-%s-1.1.noarch.rpm\n",
            latest.getVersion());
    redirect.printf(
            "Redirect 302 /latest/opensuse/jenkins.rpm http://pkg.jenkins-ci.org/opensuse/RPMS/noarch/jenkins-%s-1.1.noarch.rpm\n",
            latest.getVersion());

    if (latestCoreTxt != null)
        writeToFile(latest.getVersion().toString(), latestCoreTxt);

    if (download != null) {
        // build the download server layout
        for (HudsonWar w : wars.values()) {
            stage(w, new File(download, "war/" + w.version + "/" + w.getFileName()));
        }
    }

    if (www != null)
        buildIndex(new File(www, "download/war/"), "jenkins.war", wars.values(), "/latest/jenkins.war");

    return core;
}

From source file:nl.b3p.gis.viewer.ViewerAction.java

private void convertTreeOrderPlim(JSONObject treeObject) throws JSONException {
    if (!treeObject.isNull("children")) {
        JSONArray childArray = treeObject.getJSONArray("children");
        TreeMap tm = new TreeMap();
        for (int i = 0; i < childArray.length(); i++) {
            JSONObject childObject = childArray.getJSONObject(i);
            convertTreeOrderPlim(childObject);
            String title = childObject.getString("title");
            tm.put(title, childObject);/*w  w  w.j  a  va  2 s.  c o m*/
        }
        Collection c = tm.values();
        treeObject.put("children", c);
    }
    return;
}

From source file:com.mirth.connect.client.ui.components.MirthTreeTable.java

public void restoreColumnPreferences() {
    if (StringUtils.isNotEmpty(prefix)) {
        try {//from   w  w w .j  av  a2 s  .  c o  m
            TableColumnModelExt columnModel = (TableColumnModelExt) getTableHeader().getColumnModel();
            TreeMap<Integer, Integer> columnOrder = new TreeMap<Integer, Integer>();

            int columnIndex = 0;
            for (TableColumn column : columnModel.getColumns(true)) {
                String columnName = (String) column.getIdentifier();
                Integer viewIndex = columnOrderMap.get(columnName);
                TableColumnExt columnExt = getColumnExt(columnName);

                boolean visible = false;
                if (viewIndex == null) {
                    visible = defaultVisibleColumns == null || defaultVisibleColumns.contains(columnName);
                } else {
                    visible = viewIndex > -1;
                }

                columnExt.setVisible(visible);
                if (viewIndex != null && viewIndex > -1) {
                    columnOrder.put(viewIndex, columnIndex);
                }

                columnIndex++;
            }

            int viewIndex = 0;
            for (int index : columnOrder.values()) {
                columnModel.moveColumn(convertColumnIndexToView(index), viewIndex++);
            }

            // MetaDataColumns are restored here by comparing them against the customHiddenColumnMap which contains a list of all columns that should be hidden
            if (CollectionUtils.isNotEmpty(metaDataColumns)) {
                Set<String> cachedColumns = customHiddenColumnMap.get(channelId);

                if (cachedColumns != null) {
                    for (String column : metaDataColumns) {
                        getColumnExt(column).setVisible(!cachedColumns.contains(column));
                    }
                }
            }

            // After restoring column order, restore sort order
            SortableTreeTableModel model = (SortableTreeTableModel) getTreeTableModel();
            if (sortOrderColumn > -1 && sortOrderColumn < model.getColumnCount()) {
                model.setColumnAndToggleSortOrder(sortOrderColumn);
                model.setSortOrder(sortOrder);

                // Update sorting Icons
                ((SortableHeaderCellRenderer) getTableHeader().getDefaultRenderer()).setSortingIcon(sortOrder);
                ((SortableHeaderCellRenderer) getTableHeader().getDefaultRenderer())
                        .setColumnIndex(sortOrderColumn);
            }
        } catch (Exception e) {
            restoreDefaultColumnPreferences();
        }
    }
}

From source file:com.eurelis.opencms.workflows.ui.toolobject.WorkflowMenuItemLoader.java

/**
 * Get the list of all collected Menu items, sorted by the index position
 * /*ww w.  ja v a2 s.c  o  m*/
 * @return the list of WorkflowMenuItem that must be displayed
 */
public List<WorkflowMenuItem> getMenuItems() {
    // Create the map that will store the WorkflowMenuItem by position
    TreeMap<Float, WorkflowMenuItem> sortedMapByPosition = new TreeMap<Float, WorkflowMenuItem>();

    LOGGER.debug(ErrorFormatter.formatMap(_mapOfItems, "WF | _mapOfItems"));

    /*
     * add the map elements into the sorted map if none object with the same
     * position exists
     */
    Iterator<WorkflowMenuItem> mapOfItemIterator = this._mapOfItems.values().iterator();
    while (mapOfItemIterator.hasNext()) {
        WorkflowMenuItem workflowMenuItem = mapOfItemIterator.next();
        Float position = new Float(workflowMenuItem.get_position());
        // check if an object with such position exist
        if (!sortedMapByPosition.containsKey(position)) {
            sortedMapByPosition.put(position, workflowMenuItem);
        } else {
            // if two object with same position exists, then the second one
            // is not added into the map of object to display and a warning
            // message is return to the user.
            LOGGER.warn("WF | Two objects with position " + position + " exists. The menu "
                    + workflowMenuItem.get_name() + " will not be displayed");
        }
    }

    // return the list of menu item sorted by position
    return new ArrayList<WorkflowMenuItem>(sortedMapByPosition.values());
}

From source file:org.opentaps.gwt.messages.GwtLabelsGeneratorContainer.java

/** {@inheritDoc} */
public boolean start() throws ContainerException {

    // *** Configuration

    // directory containing the template
    String templatePath = "opentaps/opentaps-common/templates/";
    // template to use
    String templateFile = "BaseGWTUILabel.ftl";

    // the path to the GWT module configuration that defines the target locale, should be common.gwt.xml
    String gwtModuleConfigurationFile = "opentaps/opentaps-common/src/common/org/opentaps/gwt/common/common.gwt.xml";

    // directory where the labels are generated (must end with '/')
    String gwtPropertiesDir = "opentaps/opentaps-common/src/common/org/opentaps/gwt/common/client/messages/";
    // the class name of the GWT message interface to generate in the gwtPropertiesDir
    //  this will generate <gwtPropertiesDir>/<gwtLabelFileName>.java as the interface
    //  <gwtPropertiesDir>/<gwtLabelFileName>.properties as the properties files containing the default label definitions (corresponding to DEFAULT_LOCALE)
    //  <gwtPropertiesDir>/<gwtLabelFileName>_<locale>.properties as the properties files containing the label definitions for other locales specified in the GWT configuration (common.gwt.xml)
    String gwtLabelFileName = "CommonMessages";

    // load the list of UI labels to use as a source
    Properties sources = loadPropertiesFile("opentaps/opentaps-common/config/LabelConfiguration.properties");

    try {// ww  w  .  jav a  2 s  .  c  o  m

        // read the target locales from the GWT module configuration (common.gwt.xml)
        // by parsing the XML structure
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document document = builder.parse(new File(gwtModuleConfigurationFile));
        Element rootElement = document.getDocumentElement();
        // each locale is listed as a distinct "extend-property" XML tag, ie: <extend-property name="locale" values="fr"/>
        NodeList list = rootElement.getElementsByTagName("extend-property");
        // the list to store the locale 
        List<String> extendLocales = new ArrayList<String>();
        // loop through all "extend-property tags
        for (int i = 0; i < list.getLength(); i++) {
            Element element = (Element) list.item(i);
            // check if the tag defines a locale
            if (element.getAttribute("name").equals("locale")) {
                // each tag only defines one locale
                String locale = element.getAttribute("values");
                if (!extendLocales.contains(locale) && !DEFAULT_LOCALE.equals(locale)) {
                    extendLocales.add(locale);
                }
            }
        }

        // use the default label definitions to generate the Java interface file
        TreeMap<String, GwtLabelDefinition> defaultGwtLabelDefinitionsMaps = new TreeMap<String, GwtLabelDefinition>();
        Set<Entry<Object, Object>> entries = sources.entrySet();
        for (Entry<Object, Object> entry : entries) {
            try {
                String fileName = (String) entry.getValue();
                readLabelsFromSourcePropertiesFile(fileName, DEFAULT_LOCALE, defaultGwtLabelDefinitionsMaps);
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            }
        }

        // render the GWT message interface Java file from the FTL template
        Writer writer = new StringWriter();
        Configuration ftlConfig = new Configuration();
        ftlConfig.setDirectoryForTemplateLoading(new File(templatePath));
        Template t = ftlConfig.getTemplate(templateFile);
        Map<String, Object> context = new HashMap<String, Object>();
        // label keys are sorted alphabetically by the TreeMap, so the values() collection is sorted automatically
        context.put("functions", defaultGwtLabelDefinitionsMaps.values());
        t.process(context, writer);

        // write the GWT message interface Java file
        File javaFile = new File(gwtPropertiesDir + gwtLabelFileName + ".java");
        FileUtils.writeStringToFile(javaFile, writer.toString(), "UTF-8");

        // write the properties files
        writeGwtLocaleProperties(defaultGwtLabelDefinitionsMaps, DEFAULT_LOCALE, gwtPropertiesDir,
                gwtLabelFileName);
        for (String locale : extendLocales) {
            // iterator all locale and write gwt labels properties file
            writeGwtLocaleProperties(defaultGwtLabelDefinitionsMaps, locale, gwtPropertiesDir,
                    gwtLabelFileName);
        }

    } catch (Exception e) {
        Debug.logError(e, MODULE);
        return false;
    }
    return true;
}