}
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
try {
if (localName.equals("category")) {
Category c;
String key = attributes.getValue(ImportExportBaseService.JAHIA_URI, "key");
if (cats.isEmpty()) {
cats.push(rootCategory);
return;
} else {
String parentPath;
Category parent = cats.peek();
if (parent == null) {
try {
parentPath = cs.getCategoriesRoot().getPath();
} catch (RepositoryException e) {
throw new SAXException(e);
}
} else {
parentPath = parent.getCategoryPath();
}
Category cat = cs.getCategoryByPath(parentPath + "/" + key);
if (cat == null) {
c = Category.createCategory(key,parent);
} else {
c = cat;
}
}
for (int i = 0; i < attributes.getLength(); i++) {
String k = (String) attributes.getLocalName(i);
if (k.startsWith("title_")) {
c.setTitle(LanguageCodeConverters.languageCodeToLocale(k.substring(6)), attributes.getValue(i));
}
}
String acl = attributes.getValue(ImportExportBaseService.JAHIA_URI, "acl");
if (acl != null) {
// TODO: commented while shifting from DB to JCR, needs to be finished
// fillAcl(c.getACL(), acl);
}
cats.push(c);
}
if (localName.equals("property")) {
String key = attributes.getValue(ImportExportBaseService.JAHIA_URI, "key");
String value = attributes.getValue(ImportExportBaseService.JAHIA_URI, "value");
if (!cats.empty()) {
Category c = cats.peek();
if (key != null && value != null) {
if (key.startsWith("homepage")) {
uuidProps.add(new String[] {c.getKey(),key,value});
}
c.setProperty(key, value);
}
}
}
} catch (JahiaException e) {
throw new SAXException(e);