Ejemplo n.º 1
0
 /**
  * create a map when the node's status is changed or empty
  *
  * @param messageFiles
  * @return
  */
 private Map<String, Map<String, String>> createChangedOrEmptyBody(final String[] messageFiles) {
   Map<String, Map<String, String>> resultMap = new TreeMap<String, Map<String, String>>();
   for (INode node : NodeAssistant.getInstance().getData().getChildren()) {
     Map<String, String> cellMap = new LinkedHashMap<String, String>();
     if (Type.LEAF == node.getType()) {
       if (i18ntool.consts.Status.CHANGED == ((TreeNode) node).getStatus()
           || i18ntool.consts.Status.SAVE_NEED_COMPLETE == ((TreeNode) node).getStatus()
           || i18ntool.consts.Status.LOAD_NEED_COMPLETE == ((TreeNode) node).getStatus()
           || i18ntool.consts.Status.SAVE_CHANGED_OR_EMPTY == ((TreeNode) node).getStatus()) {
         Map<String, ValueEntity> valueMap = ((TreeNode) node).getValueMap();
         for (String messageFile : messageFiles) {
           if (valueMap.isEmpty()) {
             cellMap.put(messageFile, Constants.EMPTY_STRING);
           } else if (null == valueMap.get(messageFile)
               || Constants.EMPTY_STRING.equals(valueMap.get(messageFile).getCurrent())) {
             cellMap.put(messageFile, Constants.EMPTY_STRING);
           } else if (i18ntool.consts.Status.SAVE_NEED_COMPLETE == ((TreeNode) node).getStatus()) {
             if (i18ntool.consts.Status.SAVE_NEED_COMPLETE
                 == ((TreeNode) node).getStatusMap().get(messageFile)) {
               cellMap.put(messageFile, Constants.EMPTY_STRING);
             } else if (i18ntool.consts.Status.CHANGED
                 == ((TreeNode) node).getStatusMap().get(messageFile)) {
               cellMap.put(messageFile, valueMap.get(messageFile).getCurrent());
             }
           } else if (i18ntool.consts.Status.CHANGED == ((TreeNode) node).getStatus()) {
             cellMap.put(messageFile, valueMap.get(messageFile).getCurrent());
           } else if (i18ntool.consts.Status.LOAD_NEED_COMPLETE == ((TreeNode) node).getStatus()) {
             if (i18ntool.consts.Status.LOAD_NEED_COMPLETE
                 == ((TreeNode) node).getStatusMap().get(messageFile)) {
               cellMap.put(messageFile, Constants.EMPTY_STRING);
             }
           } else if (i18ntool.consts.Status.SAVE_CHANGED_OR_EMPTY
               == ((TreeNode) node).getStatus()) {
             if (i18ntool.consts.Status.CHANGED
                 == ((TreeNode) node).getStatusMap().get(messageFile)) {
               cellMap.put(messageFile, valueMap.get(messageFile).getCurrent());
             }
           }
         }
         resultMap.put(node.getName(), cellMap);
       }
     }
   }
   return resultMap;
 }
Ejemplo n.º 2
0
 /**
  * record all the node's status is normal
  *
  * @param messageFiles
  * @return <key, Map<language, Excel-Entity>>
  */
 private Map<String, Map<String, String>> createNormalBody(final String[] messageFiles) {
   Map<String, Map<String, String>> resultMap = new TreeMap<String, Map<String, String>>();
   for (INode node : NodeAssistant.getInstance().getData().getChildren()) {
     Map<String, String> cellMap = new LinkedHashMap<String, String>();
     if (Type.LEAF == node.getType()) {
       Map<String, ValueEntity> valueMap = ((TreeNode) node).getValueMap();
       for (String messageFile : messageFiles) {
         if (valueMap.isEmpty()) {
           cellMap.put(messageFile, Constants.EMPTY_STRING);
         }
         if (null == valueMap.get(messageFile)
             || Constants.EMPTY_STRING.equals(valueMap.get(messageFile).getCurrent())) {
           cellMap.put(messageFile, Constants.EMPTY_STRING);
         } else {
           cellMap.put(messageFile, valueMap.get(messageFile).getCurrent());
         }
       }
     }
     resultMap.put(node.getName(), cellMap);
   }
   return resultMap;
 }