public int compare(JSNVPElement o1, JSNVPElement o2) { int result = 0; String o1Category = o1.getAttribute("category"); String o2Category = o2.getAttribute("category"); if (o1Category != null && o2Category != null) { result = o1Category.compareTo(o2Category); } if (result == 0) { result = o1.getKey().compareTo(o2.getKey()); } return result; } };
public void setSecurityAttributes(Map<String, SecurityAttribute> sa) { for (Map.Entry<String, SecurityAttribute> e : sa.entrySet()) { SecurityAttribute attrib = e.getValue(); JSNVPElement element = new JSNVPElement(attrib.getName(), attrib.getStringValue()); element.setReadOnly(attrib.isReadOnly()); element.setAttribute("datatype",attrib.getDataType().name()); element.setAttribute("registered",Boolean.toString(attrib.isRegistered())); element.setAttribute("required",Boolean.toString(attrib.isRequired())); element.setAttribute("category",attrib.getCategory()); secAttrs.add(element); } }
public void setAttribute(String key, String value) { if (key != null && value != null && key.trim().length() > 0) { if (READONLY.equals(key)) { setReadOnly(Boolean.parseBoolean(value)); } else if (NULLVALUE.equals(key)) { setNullValue(Boolean.parseBoolean(value)); } else { attributes.put(key,value); } } }
if (element.getValues() == null) portletPreference.put(element.getKey(), new JetspeedPreferenceImpl(element.getKey(), new String[] { element.getValue() }, element.isReadOnly())); portletPreference.put(element.getKey(), new JetspeedPreferenceImpl(element.getKey(), element.getValues(), element.isReadOnly()));
for (JSNVPElement element : ((JSNVPElements)o1).getValues()) JSNVPElement clonedElement = new JSNVPElement(element.getKey(), element.getValue()); g.attributes.add(clonedElement);
xml.setAttribute(READONLY, e.isReadOnly() ? "true" : "false"); for (Map.Entry<String,String> entry : e.attributes.entrySet()) if (e.isNullValue()) else if (e.getValue() != null)
JSNVPElement element = new JSNVPElement(); element.setKey(pKey); element.setValues(portletPreference.getValues()); element.setReadOnly(portletPreference.isReadOnly()); v.add(element);
g.setAttribute(_key,_value); } catch (Exception e) g.key = g.getAttributes().get("name"); if (g.key == null) if (g.key != null && !g.isNullValue()) g.value = g.getAttributes().get("value"); if (g.value == null)
public void setSecurityAttributes(Map<String, SecurityAttribute> sa) { this.attributes = new JSSecurityAttributes(); for (Map.Entry<String, SecurityAttribute> e : sa.entrySet()) { SecurityAttribute attrib = e.getValue(); JSNVPElement element = new JSNVPElement(attrib.getName(), attrib.getStringValue()); this.attributes.add(element); } }
String userInfoKey = element.getKey(); String securityAttributeKey = userInfoKey; if (userInfoKey.equals(USER_INFO_SUBSITE)) String securityAttributeValue = element.getValue(); userSecAttrs.getAttribute(element.getKey(), true).setStringValue(element.getValue()); principal.getSecurityAttributes().getAttribute(elem.getKey(), true).setStringValue(elem.getValue());
public void read(InputElement xml, Object o) { try { JSNVPElements g = (JSNVPElements) o; while (xml.hasNext()) { // Allow any sub element as long as it has name-value pair. //JSNVPElement elem = (JSNVPElement)xml.get(g.getItemElementName(), JSNVPElement.class); JSNVPElement elem = (JSNVPElement)xml.getNext(); if (elem.getKey() != null) { g.add(elem); } } } catch (Exception e) { /** * while annoying invalid entries in the file should be * just disregarded */ e.printStackTrace(); } } };
public void setUserInfo(Map<String, SecurityAttribute> sa) { this.userInfo = new JSUserAttributes(); for (Map.Entry<String, SecurityAttribute> e : sa.entrySet()) { SecurityAttribute attrib = e.getValue(); JSNVPElement element = new JSNVPElement(attrib.getName(), attrib.getStringValue()); this.userInfo.add(element); } }