KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > controllers > kernel > impl > simple > CmsJDOCallback


1 /* ===============================================================================
2  *
3  * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4  *
5  * ===============================================================================
6  *
7  * Copyright (C)
8  *
9  * This program is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License version 2, as published by the
11  * Free Software Foundation. See the file LICENSE.html for more information.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20  *
21  * ===============================================================================
22  */

23
24 package org.infoglue.cms.controllers.kernel.impl.simple;
25  
26 import org.apache.log4j.Logger;
27 import org.exolab.castor.jdo.CacheManager;
28 import org.exolab.castor.jdo.Database;
29 import org.exolab.castor.persist.spi.CallbackInterceptor;
30 import org.infoglue.cms.entities.content.Content;
31 import org.infoglue.cms.entities.content.ContentVersion;
32 import org.infoglue.cms.entities.content.impl.simple.ContentImpl;
33 import org.infoglue.cms.entities.content.impl.simple.ContentVersionImpl;
34 import org.infoglue.cms.entities.content.impl.simple.DigitalAssetImpl;
35 import org.infoglue.cms.entities.content.impl.simple.MediumContentImpl;
36 import org.infoglue.cms.entities.content.impl.simple.SmallContentImpl;
37 import org.infoglue.cms.entities.kernel.IBaseEntity;
38 import org.infoglue.cms.entities.management.impl.simple.AccessRightGroupImpl;
39 import org.infoglue.cms.entities.management.impl.simple.AccessRightImpl;
40 import org.infoglue.cms.entities.management.impl.simple.AccessRightRoleImpl;
41 import org.infoglue.cms.entities.management.impl.simple.AccessRightUserImpl;
42 import org.infoglue.cms.entities.management.impl.simple.AvailableServiceBindingImpl;
43 import org.infoglue.cms.entities.management.impl.simple.ContentTypeDefinitionImpl;
44 import org.infoglue.cms.entities.management.impl.simple.GroupImpl;
45 import org.infoglue.cms.entities.management.impl.simple.GroupPropertiesImpl;
46 import org.infoglue.cms.entities.management.impl.simple.InterceptionPointImpl;
47 import org.infoglue.cms.entities.management.impl.simple.InterceptorImpl;
48 import org.infoglue.cms.entities.management.impl.simple.LanguageImpl;
49 import org.infoglue.cms.entities.management.impl.simple.RegistryImpl;
50 import org.infoglue.cms.entities.management.impl.simple.RepositoryImpl;
51 import org.infoglue.cms.entities.management.impl.simple.RepositoryLanguageImpl;
52 import org.infoglue.cms.entities.management.impl.simple.RoleImpl;
53 import org.infoglue.cms.entities.management.impl.simple.RolePropertiesImpl;
54 import org.infoglue.cms.entities.management.impl.simple.SystemUserImpl;
55 import org.infoglue.cms.entities.management.impl.simple.TransactionHistoryImpl;
56 import org.infoglue.cms.entities.management.impl.simple.UserPropertiesImpl;
57 import org.infoglue.cms.entities.structure.SiteNode;
58 import org.infoglue.cms.entities.structure.SiteNodeVersion;
59 import org.infoglue.cms.entities.structure.impl.simple.SiteNodeImpl;
60 import org.infoglue.cms.entities.structure.impl.simple.SiteNodeVersionImpl;
61 import org.infoglue.cms.entities.workflow.impl.simple.WorkflowDefinitionImpl;
62 import org.infoglue.cms.exception.Bug;
63 import org.infoglue.cms.util.ChangeNotificationController;
64 import org.infoglue.cms.util.NotificationMessage;
65 import org.infoglue.cms.util.RemoteCacheUpdater;
66 import org.infoglue.deliver.util.CacheController;
67
68
69 /**
70  * CMSJDOCallback.java
71  * Created on 2002-okt-09
72  * @author Stefan Sik, ss@frovi.com
73  * ss
74  *
75  */

76 public class CmsJDOCallback implements CallbackInterceptor
77 {
78     private final static Logger logger = Logger.getLogger(CmsJDOCallback.class.getName());
79
80     public void using(Object JavaDoc object, Database db)
81     {
82         //System.out.println("Using " + object);
83
// ( (Persistent) object ).jdoPersistent( db );
84
}
85
86
87     public Class JavaDoc loaded(Object JavaDoc object, short accessMode) throws Exception JavaDoc
88     {
89         //System.out.println("Loaded " + object.getClass().getName() + " accessMode:" + accessMode);
90
// return ( (Persistent) object ).jdoLoad(accessMode);
91
return null;
92     }
93
94
95     public void storing(Object JavaDoc object, boolean modified) throws Exception JavaDoc
96     {
97         //System.out.println("storing...:" + object + ":" + modified);
98
// ( (Persistent) object ).jdoStore( modified );
99

100         //logger.info("Should we store -------------->" + object + ":" + modified);
101
if (TransactionHistoryImpl.class.getName().indexOf(object.getClass().getName()) == -1 && RegistryImpl.class.getName().indexOf(object.getClass().getName()) == -1 && modified)
102         {
103             //System.out.println("Actually stored it:" + object + ":" + modified);
104
logger.info("Actually stored it:" + object + ":" + modified);
105             
106             String JavaDoc userName = "SYSTEM";
107             NotificationMessage notificationMessage = new NotificationMessage("CmsJDOCallback", object.getClass().getName(), userName, NotificationMessage.TRANS_UPDATE, getObjectIdentity(object), object.toString());
108             ChangeNotificationController.getInstance().addNotificationMessage(notificationMessage);
109             if(object.getClass().getName().indexOf("org.infoglue.cms.entities.management") > -1 && !object.getClass().getName().equals(RegistryImpl.class.getName()))
110                 RemoteCacheUpdater.getSystemNotificationMessages().add(notificationMessage);
111                 
112             if(object.getClass().getName().equals(RepositoryImpl.class.getName()))
113             {
114                 CacheController.clearCache("repositoryCache");
115             }
116             else if(object.getClass().getName().equals(InterceptionPointImpl.class.getName()))
117             {
118                 CacheController.clearCache("interceptionPointCache");
119                 CacheController.clearCache("interceptorsCache");
120                 CacheController.clearCache("authorizationCache");
121             }
122             else if(object.getClass().getName().equals(InterceptorImpl.class.getName()))
123             {
124                 CacheController.clearCache("interceptionPointCache");
125                 CacheController.clearCache("interceptorsCache");
126                 CacheController.clearCache("authorizationCache");
127             }
128             else if(object.getClass().getName().equals(AccessRightImpl.class.getName()) || object.getClass().getName().equals(AccessRightRoleImpl.class.getName()) || object.getClass().getName().equals(AccessRightGroupImpl.class.getName()) || object.getClass().getName().equals(AccessRightUserImpl.class.getName()))
129             {
130                 CacheController.clearCache("interceptionPointCache");
131                 CacheController.clearCache("interceptorsCache");
132                 CacheController.clearCache("authorizationCache");
133             }
134             else if(object.getClass().getName().equals(ContentTypeDefinitionImpl.class.getName()))
135             {
136                 CacheController.clearCache("contentTypeDefinitionCache");
137             }
138             else if(object.getClass().getName().equals(ContentImpl.class.getName()))
139             {
140                 CacheController.clearCache("childContentCache");
141                 CacheController.clearCache("componentContentsCache");
142                 clearCache(SmallContentImpl.class);
143                 clearCache(MediumContentImpl.class);
144             }
145             else if(object.getClass().getName().equals(ContentVersionImpl.class.getName()))
146             {
147                 CacheController.clearCache("componentContentsCache");
148             }
149             else if(object.getClass().getName().equals(RepositoryLanguageImpl.class.getName()))
150             {
151                 CacheController.clearCache("masterLanguageCache");
152                 CacheController.clearCache("repositoryLanguageListCache");
153             }
154             else if(object.getClass().getName().equals(DigitalAssetImpl.class.getName()))
155             {
156                 //System.out.println("We should delete all images with digitalAssetId " + getObjectIdentity(object));
157
DigitalAssetController.deleteCachedDigitalAssets((Integer JavaDoc)getObjectIdentity(object));
158             }
159             else if(object.getClass().getName().equals(WorkflowDefinitionImpl.class.getName()))
160             {
161                 CacheController.clearCache("workflowCache");
162             }
163             else if(object.getClass().getName().equals(SystemUserImpl.class.getName()))
164             {
165                 CacheController.clearCache("principalCache");
166             }
167             else if(object.getClass().getName().equals(GroupImpl.class.getName()))
168             {
169                 CacheController.clearCache("groupListCache");
170                 CacheController.clearCache("groupVOListCache");
171             }
172             else if(object.getClass().getName().equals(RoleImpl.class.getName()))
173             {
174                 CacheController.clearCache("roleListCache");
175                 CacheController.clearCache("roleVOListCache");
176             }
177             else if(object.getClass().getName().equals(UserPropertiesImpl.class.getName()))
178             {
179                 CacheController.clearCache("principalPropertyValueCache");
180                 CacheController.clearCache("relatedCategoriesCache");
181             }
182             else if(object.getClass().getName().equals(GroupPropertiesImpl.class.getName()))
183             {
184                 CacheController.clearCache("principalPropertyValueCache");
185                 CacheController.clearCache("groupPropertiesCache");
186                 CacheController.clearCache("relatedCategoriesCache");
187             }
188             else if(object.getClass().getName().equals(RolePropertiesImpl.class.getName()))
189             {
190                 CacheController.clearCache("principalPropertyValueCache");
191                 CacheController.clearCache("rolePropertiesCache");
192                 CacheController.clearCache("relatedCategoriesCache");
193             }
194             else if(object.getClass().getName().equals(AvailableServiceBindingImpl.class.getName()))
195             {
196                 CacheController.clearCache("availableServiceBindingCache");
197             }
198             else if(object.getClass().getName().equals(LanguageImpl.class.getName()))
199             {
200                 CacheController.clearCache("languageCache");
201             }
202             
203         }
204     }
205
206     private synchronized void clearCache(Class JavaDoc c) throws Exception JavaDoc
207     {
208         Database db = CastorDatabaseService.getDatabase();
209
210         try
211         {
212             Class JavaDoc[] types = {c};
213             Class JavaDoc[] ids = {null};
214             CacheManager manager = db.getCacheManager();
215             manager.expireCache(types);
216             //db.expireCache(types, null);
217
}
218         catch(Exception JavaDoc e)
219         {
220             e.printStackTrace();
221         }
222         finally
223         {
224             db.close();
225         }
226     }
227
228     public void creating( Object JavaDoc object, Database db )
229         throws Exception JavaDoc
230     {
231         // ( (Persistent) object ).jdoBeforeCreate( db );
232
}
233
234
235     public void created(Object JavaDoc object) throws Exception JavaDoc
236     {
237         // ( (Persistent) object ).jdoAfterCreate();
238

239         // Write to trans-log
240

241         //String className = object.getClass().getName();
242
//if (CmsSystem.getTransactionHistoryEntityClassName().indexOf(className) == -1)
243
// CmsSystem.transactionLogEntry("CMSJDOCallback:" + object.getClass().getName(), CmsSystem.TRANS_CREATE, getEntityId(object), object.toString());
244
//System.out.println("created...:" + object);
245
logger.info("created..........................." + object);
246         if (TransactionHistoryImpl.class.getName().indexOf(object.getClass().getName()) == -1 && RegistryImpl.class.getName().indexOf(object.getClass().getName()) == -1)
247         {
248             String JavaDoc userName = "SYSTEM";
249             NotificationMessage notificationMessage = new NotificationMessage("CMSJDOCallback", object.getClass().getName(), userName, NotificationMessage.TRANS_CREATE, getObjectIdentity(object), object.toString());
250             ChangeNotificationController.getInstance().addNotificationMessage(notificationMessage);
251             if(object.getClass().getName().indexOf("org.infoglue.cms.entities.management") > -1 && !object.getClass().getName().equals(RegistryImpl.class.getName()))
252                 RemoteCacheUpdater.getSystemNotificationMessages().add(notificationMessage);
253
254             if(object.getClass().getName().equals(RepositoryImpl.class.getName()))
255             {
256                 CacheController.clearCache("repositoryCache");
257             }
258             else if(object.getClass().getName().equals(InterceptionPointImpl.class.getName()))
259             {
260                 CacheController.clearCache("interceptionPointCache");
261                 CacheController.clearCache("interceptorsCache");
262                 CacheController.clearCache("authorizationCache");
263             }
264             else if(object.getClass().getName().equals(InterceptorImpl.class.getName()))
265             {
266                 CacheController.clearCache("interceptionPointCache");
267                 CacheController.clearCache("interceptorsCache");
268                 CacheController.clearCache("authorizationCache");
269             }
270             else if(object.getClass().getName().equals(AccessRightImpl.class.getName()) || object.getClass().getName().equals(AccessRightRoleImpl.class.getName()) || object.getClass().getName().equals(AccessRightGroupImpl.class.getName()) || object.getClass().getName().equals(AccessRightUserImpl.class.getName()))
271             {
272                 CacheController.clearCache("interceptionPointCache");
273                 CacheController.clearCache("interceptorsCache");
274                 CacheController.clearCache("authorizationCache");
275             }
276             else if(object.getClass().getName().equals(ContentTypeDefinitionImpl.class.getName()))
277             {
278                 CacheController.clearCache("contentTypeDefinitionCache");
279             }
280             else if(object.getClass().getName().equals(ContentImpl.class.getName()))
281             {
282                 CacheController.clearCache("childContentCache");
283                 clearCache(SmallContentImpl.class);
284                 clearCache(MediumContentImpl.class);
285             }
286             else if(object.getClass().getName().equals(ContentVersionImpl.class.getName()))
287             {
288                 CacheController.clearCache("componentContentsCache");
289             }
290             else if(object.getClass().getName().equals(RepositoryLanguageImpl.class.getName()))
291             {
292                 CacheController.clearCache("masterLanguageCache");
293                 CacheController.clearCache("repositoryLanguageListCache");
294             }
295             else if(object.getClass().getName().equals(WorkflowDefinitionImpl.class.getName()))
296             {
297                 CacheController.clearCache("workflowCache");
298             }
299             else if(object.getClass().getName().equals(SystemUserImpl.class.getName()))
300             {
301                 CacheController.clearCache("principalCache");
302             }
303             else if(object.getClass().getName().equals(GroupImpl.class.getName()))
304             {
305                 CacheController.clearCache("groupListCache");
306             }
307             else if(object.getClass().getName().equals(RoleImpl.class.getName()))
308             {
309                 CacheController.clearCache("roleListCache");
310             }
311             else if(object.getClass().getName().equals(UserPropertiesImpl.class.getName()))
312             {
313                 CacheController.clearCache("principalPropertyValueCache");
314                 CacheController.clearCache("relatedCategoriesCache");
315             }
316             else if(object.getClass().getName().equals(GroupPropertiesImpl.class.getName()))
317             {
318                 CacheController.clearCache("principalPropertyValueCache");
319                 CacheController.clearCache("groupPropertiesCache");
320                 CacheController.clearCache("relatedCategoriesCache");
321             }
322             else if(object.getClass().getName().equals(RolePropertiesImpl.class.getName()))
323             {
324                 CacheController.clearCache("principalPropertyValueCache");
325                 CacheController.clearCache("rolePropertiesCache");
326                 CacheController.clearCache("relatedCategoriesCache");
327             }
328             else if(object.getClass().getName().equals(AvailableServiceBindingImpl.class.getName()))
329             {
330                 CacheController.clearCache("availableServiceBindingCache");
331             }
332             else if(object.getClass().getName().equals(LanguageImpl.class.getName()))
333             {
334                 CacheController.clearCache("languageCache");
335             }
336
337
338
339             //System.out.println("created end...:" + object);
340
}
341     }
342
343
344     public void removing( Object JavaDoc object )
345         throws Exception JavaDoc
346     {
347         // ( (Persistent) object ).jdoBeforeRemove();
348
}
349
350
351     public void removed( Object JavaDoc object ) throws Exception JavaDoc
352     {
353         //System.out.println("removed...:" + object);
354
// ( (Persistent) object ).jdoAfterRemove();
355

356         if (TransactionHistoryImpl.class.getName().indexOf(object.getClass().getName()) == -1 && RegistryImpl.class.getName().indexOf(object.getClass().getName()) == -1)
357         {
358             String JavaDoc userName = "SYSTEM";
359             NotificationMessage notificationMessage = new NotificationMessage("CMSJDOCallback", object.getClass().getName(), userName, NotificationMessage.TRANS_DELETE, getObjectIdentity(object), object.toString());
360             ChangeNotificationController.getInstance().addNotificationMessage(notificationMessage);
361             if(object.getClass().getName().indexOf("org.infoglue.cms.entities.management") > -1 && !object.getClass().getName().equals(RegistryImpl.class.getName()))
362                 RemoteCacheUpdater.getSystemNotificationMessages().add(notificationMessage);
363
364             if(object.getClass().getName().equals(RepositoryImpl.class.getName()))
365             {
366                 CacheController.clearCache("repositoryCache");
367             }
368             else if(object.getClass().getName().equals(InterceptionPointImpl.class.getName()))
369             {
370                 CacheController.clearCache("interceptionPointCache");
371                 CacheController.clearCache("interceptorsCache");
372                 CacheController.clearCache("authorizationCache");
373             }
374             else if(object.getClass().getName().equals(InterceptorImpl.class.getName()))
375             {
376                 CacheController.clearCache("interceptionPointCache");
377                 CacheController.clearCache("interceptorsCache");
378                 CacheController.clearCache("authorizationCache");
379             }
380             else if(object.getClass().getName().equals(AccessRightImpl.class.getName()) || object.getClass().getName().equals(AccessRightRoleImpl.class.getName()) || object.getClass().getName().equals(AccessRightGroupImpl.class.getName()) || object.getClass().getName().equals(AccessRightUserImpl.class.getName()))
381             {
382                 CacheController.clearCache("interceptionPointCache");
383                 CacheController.clearCache("interceptorsCache");
384                 CacheController.clearCache("authorizationCache");
385             }
386             else if(object.getClass().getName().equals(ContentTypeDefinitionImpl.class.getName()))
387             {
388                 CacheController.clearCache("contentTypeDefinitionCache");
389             }
390             else if(object.getClass().getName().equals(ContentImpl.class.getName()))
391             {
392                 CacheController.clearCache("childContentCache");
393                 clearCache(SmallContentImpl.class);
394                 clearCache(MediumContentImpl.class);
395
396                 RegistryController.getController().clearRegistryForReferencedEntity(Content.class.getName(), getObjectIdentity(object).toString());
397                 RegistryController.getController().clearRegistryForReferencingEntityCompletingName(Content.class.getName(), getObjectIdentity(object).toString());
398             }
399             else if(object.getClass().getName().equals(ContentVersionImpl.class.getName()))
400             {
401                 CacheController.clearCache("componentContentsCache");
402                 RegistryController.getController().clearRegistryForReferencingEntityName(ContentVersion.class.getName(), getObjectIdentity(object).toString());
403             }
404             else if(object.getClass().getName().equals(RepositoryLanguageImpl.class.getName()))
405             {
406                 CacheController.clearCache("masterLanguageCache");
407                 CacheController.clearCache("repositoryLanguageListCache");
408             }
409             else if(object.getClass().getName().equals(DigitalAssetImpl.class.getName()))
410             {
411                 //logger.info("We should delete all images with digitalAssetId " + getObjectIdentity(object));
412
DigitalAssetController.deleteCachedDigitalAssets((Integer JavaDoc)getObjectIdentity(object));
413             }
414             else if(object.getClass().getName().equals(SiteNodeImpl.class.getName()))
415             {
416                 RegistryController.getController().clearRegistryForReferencedEntity(SiteNode.class.getName(), getObjectIdentity(object).toString());
417                 RegistryController.getController().clearRegistryForReferencingEntityCompletingName(SiteNode.class.getName(), getObjectIdentity(object).toString());
418             }
419             else if(object.getClass().getName().equals(SiteNodeVersionImpl.class.getName()))
420             {
421                 RegistryController.getController().clearRegistryForReferencingEntityName(SiteNodeVersion.class.getName(), getObjectIdentity(object).toString());
422             }
423             else if(object.getClass().getName().equals(WorkflowDefinitionImpl.class.getName()))
424             {
425                 CacheController.clearCache("workflowCache");
426             }
427             else if(object.getClass().getName().equals(SystemUserImpl.class.getName()))
428             {
429                 CacheController.clearCache("principalCache");
430             }
431             else if(object.getClass().getName().equals(GroupImpl.class.getName()))
432             {
433                 CacheController.clearCache("groupListCache");
434             }
435             else if(object.getClass().getName().equals(RoleImpl.class.getName()))
436             {
437                 CacheController.clearCache("roleListCache");
438             }
439             else if(object.getClass().getName().equals(UserPropertiesImpl.class.getName()))
440             {
441                 CacheController.clearCache("principalPropertyValueCache");
442                 CacheController.clearCache("relatedCategoriesCache");
443             }
444             else if(object.getClass().getName().equals(GroupPropertiesImpl.class.getName()))
445             {
446                 CacheController.clearCache("principalPropertyValueCache");
447                 CacheController.clearCache("groupPropertiesCache");
448                 CacheController.clearCache("relatedCategoriesCache");
449             }
450             else if(object.getClass().getName().equals(RolePropertiesImpl.class.getName()))
451             {
452                 CacheController.clearCache("principalPropertyValueCache");
453                 CacheController.clearCache("rolePropertiesCache");
454                 CacheController.clearCache("relatedCategoriesCache");
455             }
456             else if(object.getClass().getName().equals(AvailableServiceBindingImpl.class.getName()))
457             {
458                 CacheController.clearCache("availableServiceBindingCache");
459             }
460             else if(object.getClass().getName().equals(LanguageImpl.class.getName()))
461             {
462                 CacheController.clearCache("languageCache");
463             }
464
465
466         }
467     }
468
469
470     public void releasing(Object JavaDoc object, boolean committed)
471     {
472         //System.out.println("releasing...:" + object + ":" + committed);
473
// ( (Persistent) object ).jdoTransient();
474

475         /*
476         System.out.println("releasing...:" + object + ":" + committed);
477         if(DigitalAssetImpl.class.getName().equals(object.getClass().getName()) && committed)
478         {
479             System.out.println("releasing...:" + object + ":" + committed);
480             logger.info("Actually releasing it:" + object + ":" + committed);
481             String userName = "SYSTEM";
482             NotificationMessage notificationMessage = new NotificationMessage("CmsJDOCallback", object.getClass().getName(), userName, NotificationMessage.TRANS_UPDATE, getObjectIdentity(object), object.toString());
483             ChangeNotificationController.getInstance().addNotificationMessage(notificationMessage);
484         }
485         */

486
487     }
488
489
490     public void updated(Object JavaDoc object) throws Exception JavaDoc
491     {
492         //System.out.println("updated...:" + object);
493
// ( (Persistent) object ).jdoUpdate();
494

495         //String className = object.getClass().getName();
496
//if (CmsSystem.getTransactionHistoryEntityClassName().indexOf(className) == -1)
497
// CmsSystem.transactionLogEntry("CMSJDOCallback:" + object.getClass().getName(), CmsSystem.TRANS_UPDATE, getEntityId(object), object.toString());
498

499 // logger.info("updated..........................." + object);
500
/*
501         if (TransactionHistoryImpl.class.getName().indexOf(object.getClass().getName()) == -1)
502         {
503             String userName = "Fix later";
504             NotificationMessage notificationMessage = new NotificationMessage("CMSJDOCallback:" + object.getClass().getName(), object.getClass().getName(), userName, CmsSystem.TRANS_UPDATE, getEntityId(object), object.toString());
505             ChangeNotificationController.getInstance().addNotificationMessage(notificationMessage);
506         }
507 */

508      }
509
510
511     private Integer JavaDoc getEntityId(Object JavaDoc entity) throws Bug
512     {
513         Integer JavaDoc entityId = new Integer JavaDoc(-1);
514         
515         try
516         {
517             entityId = ((IBaseEntity) entity).getId();
518         }
519         catch (Exception JavaDoc e)
520         {
521             e.printStackTrace();
522             throw new Bug("Unable to retrieve object id");
523         }
524         
525         return entityId;
526     }
527
528     private Object JavaDoc getObjectIdentity(Object JavaDoc entity) throws Bug
529     {
530         Object JavaDoc objectIdentity = new Integer JavaDoc(-1);
531         
532         try
533         {
534             objectIdentity = ((IBaseEntity) entity).getIdAsObject();
535         }
536         catch (Exception JavaDoc e)
537         {
538             e.printStackTrace();
539             throw new Bug("Unable to retrieve object identity");
540         }
541         
542         return objectIdentity;
543     }
544
545 }
546
547
Popular Tags