1 7 package org.exoplatform.services.portletcontainer.impl.portletAPIImp.helpers; 8 9 10 19 public class SharedSessionUtil { 20 21 private static final char SEPARATOR = '$'; 22 23 public static String encodePortletSessionAttribute(String portletApplicationId, 24 String attributeName) { 25 StringBuffer sB = new StringBuffer (); 26 sB.append(portletApplicationId); 27 sB.append(".data"); 28 sB.append(SEPARATOR); 29 sB.append(attributeName); 30 return sB.toString(); 31 } 32 33 public static String encodePortletSessionMetaDataAttribute(String portletApplicationId, 34 String attributeName) { 35 StringBuffer sB = new StringBuffer (); 36 sB.append(portletApplicationId); 37 sB.append(".metaData"); 38 sB.append(SEPARATOR); 39 sB.append(attributeName); 40 return sB.toString(); 41 } 42 43 public static String decodePortletSessionMetaDataAttribute(String portletApplicationId, 44 String attributeName) { 45 if (attributeName.startsWith(portletApplicationId + ".metaData" + SEPARATOR)) { 46 int index = attributeName.indexOf(SEPARATOR); 47 if (index > -1) { 48 attributeName = attributeName.substring(index + 1); 49 } 50 } 51 return attributeName; 52 } 53 54 public static boolean isMetaDataAttribute(String portletApplicationId, 55 String attributeName) { 56 if (attributeName.startsWith(portletApplicationId + ".metaData" + SEPARATOR)) 57 return true; 58 else 59 return false; 60 } 61 62 public static String decodePortletSessionAttribute(String portletApplicationId, 63 String attributeName) { 64 if (attributeName.startsWith(portletApplicationId + ".data" + SEPARATOR)) { 65 int index = attributeName.indexOf(SEPARATOR); 66 if (index > -1) { 67 attributeName = attributeName.substring(index + 1); 68 } 69 } 70 return attributeName; 71 } 72 73 public static boolean isAttribute(String portletApplicationId, String s) { 74 if (s.startsWith(portletApplicationId + ".data" + SEPARATOR)) 75 return true; 76 else 77 return false; 78 } 79 80 81 } 82 | Popular Tags |