tdraier 2005/10/20 18:30:31 CEST
Modified files:
core/src/java/org/jahia/services/importexport
ImportExportBaseService.java
ImportHandler.java
Log:
export/import category links
Revision Changes Path
1.36 +11 -0
jahia/core/src/java/org/jahia/services/importexport/ImportExportBaseService.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/importexport/ImportExportBaseService.java.diff?r1=1.35&r2=1.36&f=h
1.31 +12 -0
jahia/core/src/java/org/jahia/services/importexport/ImportHandler.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/importexport/ImportHandler.java.diff?r1=1.30&r2=1.31&f=h
Index: ImportExportBaseService.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/services/importexport/ImportExportBaseService.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- ImportExportBaseService.java 19 Oct 2005 16:13:52 -0000 1.35
+++ ImportExportBaseService.java 20 Oct 2005 16:30:31 -0000 1.36
@@ -18,6 +18,7 @@
import org.jahia.params.ProcessingContext;
import org.jahia.registries.ServicesRegistry;
import org.jahia.services.JahiaService;
+import org.jahia.services.categories.Category;
import org.jahia.services.acl.JahiaACLEntry;
import org.jahia.services.acl.JahiaBaseACL;
import org.jahia.services.acl.ACLNotFoundException;
@@ -361,6 +362,16 @@
}
}
}
+ String catString = "";
+ Set cats =
ServicesRegistry.getInstance().getCategoryService().getObjectCategories(object.getObjectKey());
+ for (Iterator iterator = cats.iterator();
iterator.hasNext();) {
+ Category cat = (Category) iterator.next();
+ catString += " " + cat.getKey();
+ }
+ if (catString.length()>0) {
+ catString = catString.substring(1);
+ attr.addAttribute(JAHIA_URI, "categories",
"jahia:categories", "CDATA", catString);
+ }
}
if (changedStatus != null) {
Index: ImportHandler.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/services/importexport/ImportHandler.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- ImportHandler.java 20 Oct 2005 14:54:33 -0000 1.30
+++ ImportHandler.java 20 Oct 2005 16:30:31 -0000 1.31
@@ -35,6 +35,8 @@
import org.jahia.services.version.VersioningDifferenceStatus;
import org.jahia.services.webdav.DAVFileAccess;
import org.jahia.services.webdav.JahiaWebdavBaseService;
+import org.jahia.services.categories.Category;
+import org.jahia.services.categories.CategoryService;
import org.jahia.utils.LanguageCodeConverters;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
@@ -765,6 +767,16 @@
jf.save(jParams);
}
}
+ String cats = attr.getValue(ImportExportService.JAHIA_URI,
"categories");
+ if (cats != null && cats.length() > 0) {
+ CategoryService categoryService =
ServicesRegistry.getInstance().getCategoryService();
+ StringTokenizer st = new StringTokenizer(cats, " ");
+ while (st.hasMoreTokens()) {
+ String catString = st.nextToken();
+ Category cat = categoryService.getCategory(catString);
+ categoryService.addObjectKeyToCategory(cat,
object.getObjectKey());
+ }
+ }
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (JahiaException e) {