SHARE
TWEET

Untitled

a guest Jan 30th, 2017 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     @Override
  2.     public void onUpdateNode(NodeRef content) {
  3.         if (0 == nodeService.getType(content).compareTo(T_BILL)) {
  4.             this.assignProperties(content);
  5.             //AlfrescoTransactionSupport.bindListener(transactionListener);
  6.         }
  7.     }
  8.  
  9.     private void assignProperties(NodeRef node) {
  10.         Map<QName, Serializable> props = new HashMap<QName, Serializable>();
  11.         SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyy");
  12.         String nodeName = (String) nodeService.getProperty(node, ContentModel.PROP_NAME);
  13.         String[] nameParts = nodeName.split("_");
  14.  
  15.         nodeService.setType(node, T_BILL);
  16.  
  17.         props.put(P_PROVIDER, nameParts[0]);
  18.         props.put(P_ID, nameParts[1]);
  19.  
  20.         try {
  21.             props.put(P_DATE, sdf.parse(nameParts[2]));
  22.         } catch (ParseException e) {
  23.             logger.error(e.getMessage());
  24.         }
  25.  
  26.         nodeService.addProperties(node, props);
  27.     }
RAW Paste Data
Top