[Castore-commits] ConsultationDocumentAspect.aj 1.1.2.1 1.1.2.2
GestionDocumentsAspect.aj 1.3 1.3.2.1
Stéphane Bouchet
sbouchet at adullact1.hosting.cri74.org
Lun 6 Mar 10:53:12 CET 2006
Update of /cvsroot/castore/castore-core/src/aspects/fr/emn/castor/documents/aspects
In directory adullact1:/tmp/cvs-serv20023/src/aspects/fr/emn/castor/documents/aspects
Modified Files:
Tag: v1_1_branch
ConsultationDocumentAspect.aj GestionDocumentsAspect.aj
Log Message:
correction bug du profil.
refactoring des aspects ( utilisation de target() )
Index: GestionDocumentsAspect.aj
===================================================================
RCS file: /cvsroot/castore/castore-core/src/aspects/fr/emn/castor/documents/aspects/GestionDocumentsAspect.aj,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -C2 -d -r1.3 -r1.3.2.1
*** GestionDocumentsAspect.aj 12 Oct 2005 15:36:57 -0000 1.3
--- GestionDocumentsAspect.aj 6 Mar 2006 09:53:10 -0000 1.3.2.1
***************
*** 39,43 ****
import java.util.ArrayList;
- import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
--- 39,42 ----
***************
*** 60,64 ****
public aspect GestionDocumentsAspect {
! private static Collection docsPrivesEnCours = new ArrayList();
private static String signatureSoumissionPrivee;
--- 59,63 ----
public aspect GestionDocumentsAspect {
! private static ArrayList<String> docsPrivesEnCours = new ArrayList<String>();
private static String signatureSoumissionPrivee;
***************
*** 66,86 ****
// ---- ---- POINTCUT :
//capture de l'evenement : choix du tuteur
! pointcut choixTuteur(String idDoc, String newTutorName, String aUser) : execution(
! String fr.emn.castor.documents.DocumentsProxy.finishSubmission(
! String,
! String,
! String))
! && args(idDoc, newTutorName, aUser);
//capture de l'evenement : validation d'une etape ...
! pointcut validationEtape(String idDoc, String aUser) : execution(
! String fr.emn.castor.documents.DocumentsProxy.nextValidationStep(
! String,
! String))
&& args(idDoc, aUser);
//capture de l'evenement : soumettre un document partage
! pointcut soumission(String idDoc) : execution(
! String fr.emn.castor.documents.DocumentsProxy.finishSubmission(String))
&& args(idDoc);
--- 65,83 ----
// ---- ---- POINTCUT :
//capture de l'evenement : choix du tuteur
! pointcut choixTuteur(DocumentsProxy proxy, String idDoc) : execution(
! void DocumentsProxy.setNewTutor(String, String, String, String))
! && target(proxy)
! && args(idDoc, *, *, *);
//capture de l'evenement : validation d'une etape ...
! pointcut validationEtape(DocumentsProxy proxy, String idDoc, String aUser) : execution(
! String DocumentsProxy.nextValidationStep(String, String))
! && target(proxy)
&& args(idDoc, aUser);
//capture de l'evenement : soumettre un document partage
! pointcut soumission(DocumentsProxy proxy, String idDoc) : execution(
! String DocumentsProxy.finishSubmission(String))
! && target(proxy)
&& args(idDoc);
***************
*** 88,151 ****
//cet evenement est utilise pour eventuellement
//determiner la fin de la soumission d'un document privé
! pointcut ajouterDocument(String idColl, String idDoc) : execution(
! void fr.emn.castor.collections.CollectionProxy.addDocumentInCollection(
! String,
! String))
! && args(idColl, idDoc);
// capture de l'evenement : soumettre un document prive dans le panier
! pointcut ajouterDocumentPanier(String username, String idDoc) : execution(
! void fr.emn.castor.collections.CollectionProxy.addDocumentToPanier(String, String))
! && args(username, idDoc);
//capture de l'evenement : soumettre un document prive
! pointcut soumissionPrivee(String idDoc, String soumetteur) : execution(
! String fr.emn.castor.documents.DocumentsProxy.putThisDocAsPrivate(String, String))
! && args(idDoc, soumetteur);
//capture de l'evenement : valider un document
! pointcut validationOK(String idDoc) : execution(
! boolean WorkflowManager.acceptDocument(
! String))
&& args(idDoc);
//capture de l'evenement : refuser un document
! pointcut validationNOK(String idDoc, String motif) : execution(
! String fr.emn.castor.documents.DocumentsProxy.refuseDocument(String, String))
! && args(idDoc, motif);
//capture de l'evenement suppression d'un document
! pointcut suppressionDocument(String idDoc) : execution(
! String fr.emn.castor.documents.DocumentsProxy.deleteDocument(String))
&& args(idDoc);
//capture de l'evenement suppression d'un document par un admnistrateur
! pointcut suppressionDocumentParUnAdmin(String idDoc) : execution(
! String fr.emn.castor.documents.DocumentsProxy.deleteDocumentByAdmin(String))
&& args(idDoc);
! // ---- ---- TRAITEMENTS :
! after(String idDoc,String aUser) : validationEtape(
! idDoc,
! aUser) {
try {
-
//signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
!
! DocumentsProxy docProxy = (DocumentsProxy) thisJoinPoint
! .getTarget();
! String acteur = docProxy.getUserOnLine();
!
! Map row = new HashMap();
//id du document
row.put(Constants.DOC_ID, idDoc);
row.put(UsersConstants.VALIDATOR, aUser);
- // row.put(UsersConstants.CURRENT_VALIDATION_STEP, currentStep);
Facade.getInstance().addNewEvent(eventSignature, acteur, row);
-
} catch (Exception e) {
if (AspectLog.getLog().isDebugEnabled()) {
--- 85,142 ----
//cet evenement est utilise pour eventuellement
//determiner la fin de la soumission d'un document privé
! pointcut ajouterDocument(CollectionProxy proxy, String idDoc) : execution(
! void CollectionProxy.addDocumentInCollection(String, String))
! && target(proxy)
! && args(*,idDoc) ;
// capture de l'evenement : soumettre un document prive dans le panier
! pointcut ajouterDocumentPanier(CollectionProxy proxy, String idDoc) : execution(
! void CollectionProxy.addDocumentToPanier(String, String))
! && target(proxy)
! && args(*,idDoc) ;
//capture de l'evenement : soumettre un document prive
! pointcut soumissionPrivee(String idDoc) : execution(
! String DocumentsProxy.putThisDocAsPrivate(String, String))
! && args(idDoc, *);
//capture de l'evenement : valider un document
! pointcut validationOK(String idDoc) : call(
! boolean WorkflowManager.acceptDocument(String))
&& args(idDoc);
//capture de l'evenement : refuser un document
! pointcut validationNOK(DocumentsProxy proxy, String idDoc) : execution(
! String DocumentsProxy.refuseDocument(String, String))
! && target(proxy)
! && args(idDoc, *);
//capture de l'evenement suppression d'un document
! pointcut suppressionDocument(DocumentsProxy proxy, String idDoc) : execution(
! String DocumentsProxy.deleteDocument(String))
! && target(proxy)
&& args(idDoc);
//capture de l'evenement suppression d'un document par un admnistrateur
! pointcut suppressionDocumentParUnAdmin(DocumentsProxy proxy, String idDoc) : execution(
! String DocumentsProxy.deleteDocumentByAdmin(String))
! && target(proxy)
&& args(idDoc);
! // -------- TRAITEMENTS :
! after(DocumentsProxy proxy, String idDoc, String aUser) : validationEtape(
! proxy, idDoc, aUser) {
try {
//signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
! String acteur = proxy.getUserOnLine();
! Map<String, String> row = new HashMap<String, String>();
//id du document
row.put(Constants.DOC_ID, idDoc);
row.put(UsersConstants.VALIDATOR, aUser);
Facade.getInstance().addNewEvent(eventSignature, acteur, row);
} catch (Exception e) {
if (AspectLog.getLog().isDebugEnabled()) {
***************
*** 153,169 ****
}
}
-
}
! after(String idDoc) : suppressionDocumentParUnAdmin(idDoc) {
!
//signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
!
! DocumentsProxy docProxy = (DocumentsProxy) thisJoinPoint.getTarget();
! String acteur = docProxy.getUserOnLine();
! Map row = new HashMap();
//id du document
row.put(Constants.DOC_ID, idDoc);
--- 144,156 ----
}
}
}
! after(DocumentsProxy proxy, String idDoc) : suppressionDocumentParUnAdmin(proxy, idDoc) {
//signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
! String acteur = proxy.getUserOnLine();
! Map<String, String> row = new HashMap<String, String>();
//id du document
row.put(Constants.DOC_ID, idDoc);
***************
*** 178,198 ****
}
}
-
}
! after(String idDoc) : suppressionDocument(idDoc) {
!
//signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
!
! DocumentsProxy docProxy = (DocumentsProxy) thisJoinPoint.getTarget();
! String acteur = docProxy.getUserOnLine();
!
! Map row = new HashMap();
//id du document
row.put(Constants.DOC_ID, idDoc);
-
//notification de l'evenement au profil et aux statistiques
try {
--- 165,179 ----
}
}
}
! after(DocumentsProxy proxy, String idDoc) : suppressionDocument(proxy, idDoc) {
//signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
! String acteur = proxy.getUserOnLine();
! Map<String, String> row = new HashMap<String, String>();
//id du document
row.put(Constants.DOC_ID, idDoc);
//notification de l'evenement au profil et aux statistiques
try {
***************
*** 208,230 ****
//apres l'evenement : choisir un tuteur ...
! after(String idDoc, String newTutorName, String aUser) : choixTuteur(
! idDoc,
! newTutorName,
! aUser) {
//signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
!
! DocumentsProxy docProxy = (DocumentsProxy) thisJoinPoint.getTarget();
! String acteur = docProxy.getUserOnLine();
!
//construction d'une map contenant les infos sur
//le document soumis
! Map row = new HashMap();
//id du document
row.put(Constants.DOC_ID, idDoc);
row.put(UsersConstants.STATEOFDOC, UsersConstants.INPROGRESS);
-
//notification de l'evenement au profil et aux statistiques
try {
--- 189,204 ----
//apres l'evenement : choisir un tuteur ...
! after(DocumentsProxy proxy, String idDoc) : choixTuteur(proxy, idDoc) {
//signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
! String acteur = proxy.getUserOnLine();
//construction d'une map contenant les infos sur
//le document soumis
! Map<String, String> row = new HashMap<String, String>();
//id du document
row.put(Constants.DOC_ID, idDoc);
row.put(UsersConstants.STATEOFDOC, UsersConstants.INPROGRESS);
//notification de l'evenement au profil et aux statistiques
try {
***************
*** 237,260 ****
}
}
-
}
//apres l'evenement : soumettre un document ...
! after(String idDoc) : soumission(idDoc) {
//signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
!
! DocumentsProxy docProxy = (DocumentsProxy) thisJoinPoint.getTarget();
! String acteur = docProxy.getUserOnLine();
!
//construction d'une map contenant les infos sur
//le document soumis
! Map row = new HashMap();
//id du document
row.put(Constants.DOC_ID, idDoc);
row.put(UsersConstants.STATEOFDOC, UsersConstants.INPROGRESS);
-
//notification de l'evenement au profil et aux statistiques
try {
--- 211,229 ----
}
}
}
//apres l'evenement : soumettre un document ...
! after(DocumentsProxy proxy, String idDoc) : soumission(proxy, idDoc) {
//signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
! String acteur = proxy.getUserOnLine();
//construction d'une map contenant les infos sur
//le document soumis
! Map<String, String> row = new HashMap<String, String>();
//id du document
row.put(Constants.DOC_ID, idDoc);
row.put(UsersConstants.STATEOFDOC, UsersConstants.INPROGRESS);
//notification de l'evenement au profil et aux statistiques
try {
***************
*** 267,313 ****
}
}
-
}
! after(String idColl, String idDoc) : ajouterDocument(idColl, idDoc) {
!
if (docsPrivesEnCours.contains(idDoc)) {
- CollectionProxy collProxy = (CollectionProxy) thisJoinPoint
- .getTarget();
- String acteur = collProxy.getUserOnLine();
this.genereEvenementSoumissionPrivee(idDoc, acteur);
}
-
docsPrivesEnCours.remove(idDoc);
-
}
! after(String username, String idDoc) : ajouterDocumentPanier(
! username,
! idDoc) {
!
! try {
! if (docsPrivesEnCours.contains(idDoc)) {
! CollectionProxy collProxy = (CollectionProxy) thisJoinPoint
! .getTarget();
! String acteur = collProxy.getUserOnLine();
! this.genereEvenementSoumissionPrivee(idDoc, acteur);
! }
! docsPrivesEnCours.remove(idDoc);
! } catch (Exception e) {
! e.printStackTrace();
}
!
}
private void genereEvenementSoumissionPrivee(String idDoc, String acteur) {
-
//construction d'une map contenant les infos sur
//le document soumis
! Map row = new HashMap();
//id du document
row.put(Constants.DOC_ID, idDoc);
row.put(UsersConstants.STATEOFDOC, UsersConstants.PRIVATE);
-
//notification de l'evenement au profil et aux statistiques
try {
--- 236,265 ----
}
}
}
! after(CollectionProxy proxy, String idDoc) : ajouterDocument(proxy, idDoc) {
! String acteur = proxy.getUserOnLine();
if (docsPrivesEnCours.contains(idDoc)) {
this.genereEvenementSoumissionPrivee(idDoc, acteur);
}
docsPrivesEnCours.remove(idDoc);
}
! after(CollectionProxy proxy, String idDoc) : ajouterDocumentPanier(
! proxy, idDoc) {
! String acteur = proxy.getUserOnLine();
! if (docsPrivesEnCours.contains(idDoc)) {
! this.genereEvenementSoumissionPrivee(idDoc, acteur);
}
! docsPrivesEnCours.remove(idDoc);
}
private void genereEvenementSoumissionPrivee(String idDoc, String acteur) {
//construction d'une map contenant les infos sur
//le document soumis
! Map<String, String> row = new HashMap<String, String>();
//id du document
row.put(Constants.DOC_ID, idDoc);
row.put(UsersConstants.STATEOFDOC, UsersConstants.PRIVATE);
//notification de l'evenement au profil et aux statistiques
try {
***************
*** 324,330 ****
//apres l'evenement : soumettre un document ...
! after(String idDoc, String soumetteur) : soumissionPrivee(
! idDoc,
! soumetteur) {
//cette evenement est genere pour 2 raisons differentes :
// - la privatisation d'un document refusé
--- 276,280 ----
//apres l'evenement : soumettre un document ...
! after(String idDoc) : soumissionPrivee(idDoc) {
//cette evenement est genere pour 2 raisons differentes :
// - la privatisation d'un document refusé
***************
*** 336,343 ****
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
-
- DocumentsProxy docProxy = (DocumentsProxy) thisJoinPoint.getTarget();
- String acteur = docProxy.getUserOnLine();
-
// - la soumission d'un document comme privé
// et dans ce cas on ajoute ce document à une liste
--- 286,289 ----
***************
*** 348,368 ****
//apres l'evenement : valider un document ...
! after(String idDoc) : validationOK(idDoc) {
!
//signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
-
- // DocumentsProxy docProxy = (DocumentsProxy) thisJoinPoint.getTarget();
- // String acteur = docProxy.getUserOnLine();
-
//construction d'une map contenant les infos sur
//le document validé
! Map row = new HashMap();
row.put(Constants.DOC_ID, idDoc);
String stateDoc = UsersConstants.ACCEPTED;
row.put(UsersConstants.STATEOFDOC, stateDoc);
-
//notification de l'evenement au profil et aux statistiques
try {
--- 294,308 ----
//apres l'evenement : valider un document ...
! after(String idDoc) : validationOK(idDoc) {
//signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
//construction d'une map contenant les infos sur
//le document validé
! Map<String, String> row = new HashMap<String, String>();
row.put(Constants.DOC_ID, idDoc);
String stateDoc = UsersConstants.ACCEPTED;
row.put(UsersConstants.STATEOFDOC, stateDoc);
//notification de l'evenement au profil et aux statistiques
try {
***************
*** 375,401 ****
}
}
!
! } //apres l'evenement : refuser un document ...
! after(String idDoc, String motif) : validationNOK(idDoc, motif) {
! System.out.println("etape 0");
//signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
! System.out.println("etape 1");
!
! DocumentsProxy docProxy = (DocumentsProxy) thisJoinPoint.getTarget();
! String acteur = docProxy.getUserOnLine();
!
! System.out.println("etape 2");
//construction d'une map contenant les infos sur
//le document refusé
! Map row = new HashMap();
row.put(Constants.DOC_ID, idDoc);
String stateDoc = UsersConstants.REFUSED;
row.put(UsersConstants.STATEOFDOC, stateDoc);
//notification de l'evenement au profil et aux statistiques
- System.out.println("etape 3");
try {
Facade.getInstance().addNewEvent(eventSignature, acteur, row);
--- 315,334 ----
}
}
! }
! //apres l'evenement : refuser un document ...
! after(DocumentsProxy proxy, String idDoc) : validationNOK(proxy, idDoc) {
//signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
! String acteur = proxy.getUserOnLine();
//construction d'une map contenant les infos sur
//le document refusé
! Map<String, String> row = new HashMap<String, String>();
row.put(Constants.DOC_ID, idDoc);
String stateDoc = UsersConstants.REFUSED;
row.put(UsersConstants.STATEOFDOC, stateDoc);
//notification de l'evenement au profil et aux statistiques
try {
Facade.getInstance().addNewEvent(eventSignature, acteur, row);
***************
*** 407,412 ****
}
}
- System.out.println("etape 4");
}
-
}
\ No newline at end of file
--- 340,343 ----
Index: ConsultationDocumentAspect.aj
===================================================================
RCS file: /cvsroot/castore/castore-core/src/aspects/fr/emn/castor/documents/aspects/ConsultationDocumentAspect.aj,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** ConsultationDocumentAspect.aj 4 Jan 2006 10:32:17 -0000 1.1.2.1
--- ConsultationDocumentAspect.aj 6 Mar 2006 09:53:10 -0000 1.1.2.2
***************
*** 56,92 ****
public aspect ConsultationDocumentAspect {
! pointcut consultDoc(String idDoc, String format) : execution(
! OutputStream fr.emn.castor.documents.DocumentsProxy.transformeDocument(String, String))
&& args(idDoc, format);
! after(String idDoc, String format) : consultDoc(idDoc, format) {
!
! HashMap userRow = new HashMap();
HashMap statRow = new HashMap();
userRow.put(Constants.DOC_ID, idDoc);
statRow.put(Constants.DOC_ID, idDoc);
-
if (format.equals(DocumentsConstants.HTML)) {
! statRow.put(StatistiquesConstants.TYPE_CONSULTATION, new Integer(
! StatistiquesConstants.TYPE_DOCUMENT_LECTURE));
} else {
! statRow.put(StatistiquesConstants.TYPE_CONSULTATION, new Integer(
! StatistiquesConstants.TYPE_DOCUMENT_TELECHARGEMENT));
}
-
//construction de la signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
!
! DocumentsProxy docProxy = (DocumentsProxy) thisJoinPoint.getTarget();
! String acteur = docProxy.getUserOnLine();
!
! //construction de l'evenement : consulter une collection
try {
fr.emn.castor.statistiques.Facade.getInstance().addNewEvent(
! eventSignature,acteur, statRow);
fr.emn.castor.users.Facade.getInstance().addNewEvent(
! eventSignature,acteur, userRow);
} catch (Exception e) {
--- 56,89 ----
public aspect ConsultationDocumentAspect {
! pointcut consultDoc(DocumentsProxy proxy, String idDoc, String format) : execution(
! OutputStream DocumentsProxy.transformeDocument(String, String))
! && target(proxy)
&& args(idDoc, format);
! after(DocumentsProxy proxy, String idDoc, String format) : consultDoc(proxy, idDoc, format) {
! HashMap<String, String> userRow = new HashMap<String, String>();
HashMap statRow = new HashMap();
userRow.put(Constants.DOC_ID, idDoc);
statRow.put(Constants.DOC_ID, idDoc);
if (format.equals(DocumentsConstants.HTML)) {
! statRow.put(
! StatistiquesConstants.TYPE_CONSULTATION, new Integer(
! StatistiquesConstants.TYPE_DOCUMENT_LECTURE));
} else {
! statRow.put(
! StatistiquesConstants.TYPE_CONSULTATION, new Integer(
! StatistiquesConstants.TYPE_DOCUMENT_TELECHARGEMENT));
}
//construction de la signature de l'evenement
String eventSignature = thisJoinPointStaticPart
.getSignature().getDeclaringTypeName()
+ "." + thisJoinPointStaticPart.getSignature().getName();
! String acteur = proxy.getUserOnLine();
! //construction de l'evenement : consulter un document
try {
fr.emn.castor.statistiques.Facade.getInstance().addNewEvent(
! eventSignature, acteur, statRow);
fr.emn.castor.users.Facade.getInstance().addNewEvent(
! eventSignature, acteur, userRow);
} catch (Exception e) {
Plus d'informations sur la liste de diffusion Castore-commits