sync
[Bookkeeping.git] / src / com / interrupt / bookkeeping / users / Groups.java
blob8607ce0adaa2ddc25cef77ec39a8f2ae265a9761
1 package com.interrupt.bookkeeping.users;
3 import java.util.Iterator;
5 import org.apache.log4j.Logger;
7 import com.interrupt.bob.base.IBob;
8 import com.interrupt.bookkeeping.system.BookkeepingSystemProperties;
9 import com.interrupt.spittoon.Spittoon;
11 public class Groups extends GGroups {
14 private Logger logger = Logger.getLogger(Groups.class);
15 private Spittoon spittoon = null;
16 public Groups() {
17 //spittoon = Spittoon.instance();
21 /**
22 * Persistable methods
24 class SavePersistor {
26 private String baseDir = null;
27 private String groupsDir = "system/groups/";
28 private BookkeepingSystemProperties bsprops = null;
29 private Spittoon spittoon = null;
31 public SavePersistor() {
32 bsprops = BookkeepingSystemProperties.instance();
34 public void setSpittoon(Spittoon spit) {
35 spittoon = spit;
37 public Spittoon getSpittoon() {
38 return spittoon;
40 public void setBaseDir(String bdir) {
41 baseDir = bdir;
43 public String getBaseDir() {
44 return baseDir;
46 /*public void visit(IBob persistable) {
48 if(persistable instanceof IGroups && ((IGroups)persistable).getId().equals("main.groups")) {
50 Iterator groupIter = ((IGroups)persistable).allGroup().iterator();
51 IGroup eachGroup = null;
52 while(groupIter.hasNext()) {
54 eachGroup = (IGroup)groupIter.next();
56 //** save to system/groups/
57 spittoon.updateDocument(
58 BookkeepingSystemProperties.instance().getProperty("db.url") + "system/groups/" + eachGroup.getId(),
59 eachGroup.getTagName(),
60 eachGroup.getAttributes().getValue("id"),
61 eachGroup);