1 18 23 package org.apache.roller.webservices.adminapi.sdk; 24 25 import java.util.ArrayList ; 26 import java.util.Iterator ; 27 import java.util.List ; 28 29 import org.jdom.Document; 30 import org.jdom.Element; 31 import org.jdom.Namespace; 32 import org.jdom.filter.Filter; 33 34 41 42 public class Service extends EntrySet { 43 44 public static class Workspace extends EntrySet { 45 46 public static class Collection extends Entry { 47 private static interface Tags { 48 public static final String MEMBER_TYPE = "member-type"; 49 } 50 51 private static interface Attributes { 52 public static final String TITLE = "title"; 53 } 54 55 private String title; 56 private String memberType; 57 58 public Collection() { 59 } 61 62 public String getType() { 63 return Types.COLLECTION; 64 } 65 66 public String getTitle() { 67 return title; 68 } 69 70 public void setTitle(String title) { 71 this.title = title; 72 } 73 74 75 public Document toDocument() { 76 Document doc = new Document(); 77 Element element = new Element(Types.COLLECTION, NAMESPACE); 78 doc.setRootElement(element); 79 80 element.setAttribute(Attributes.TITLE, getTitle()); 81 element.setAttribute(Entry.Attributes.HREF, getHref()); 82 83 Element memberType = new Element(Tags.MEMBER_TYPE, NAMESPACE); 84 memberType.setText(getMemberType()); 85 element.addContent(memberType); 86 87 return doc; 88 } 89 90 public String getMemberType() { 91 return memberType; 92 } 93 94 public void setMemberType(String memberType) { 95 this.memberType = memberType; 96 } 97 98 } 99 100 private static interface Attributes { 101 public static final String TITLE = "title"; 102 } 103 104 private String title = null; 105 106 public Workspace() { 107 } 108 109 public String getType() { 110 return Types.WORKSPACE; 111 } 112 113 public String getTitle() { 114 return title; 115 } 116 117 public void setTitle(String title) { 118 this.title = title; 119 } 120 121 122 public Document toDocument() { 123 Document doc = new Document(); 124 Element element = new Element(EntrySet.Types.WORKSPACE, NAMESPACE); 125 doc.setRootElement(element); 126 127 element.setAttribute(Attributes.TITLE, getTitle()); 128 for (int i = 0; i < getEntries().length; i++) { 129 Entry entry = getEntries()[i]; 130 element.addContent(entry.toDocument().detachRootElement()); 131 } 132 133 return doc; 134 } 135 } 136 137 public Service(String href) { 138 setHref(href); 139 } 140 141 public String getType() { 142 return Types.SERVICE; 143 } 144 145 public Document toDocument() { 146 Document doc = new Document(); 147 Element root = new Element(Types.SERVICE, NAMESPACE); 148 doc.setRootElement(root); 149 150 for (int i = 0; i < getEntries().length; i++) { 151 Entry entry = getEntries()[i]; 152 root.addContent(entry.toDocument().detachRootElement()); 153 } 154 155 return doc; 156 } 157 } 158 | Popular Tags |