Changeset 18861
- Timestamp:
- 05/16/07 21:07:37 (3 years ago)
- Files:
-
- org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-api/src/main/java/org/nuxeo/ecm/platform/relations/api/event (added)
- org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-api/src/main/java/org/nuxeo/ecm/platform/relations/api/event/RelationEvents.java (added)
- org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/java/org/nuxeo/ecm/platform/relations/web/listener/RelationActions.java (modified) (1 diff)
- org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/java/org/nuxeo/ecm/platform/relations/web/listener/ejb/RelationActionsBean.java (modified) (8 diffs)
- org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/resources/META-INF/MANIFEST.MF (modified) (1 diff)
- org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/resources/OSGI-INF/audit-contrib.xml (added)
- org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/resources/OSGI-INF/deployment-fragment.xml (modified) (2 diffs)
- org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/resources/OSGI-INF/l10n/messages.properties (deleted)
- org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/resources/OSGI-INF/l10n/messages_de.properties (modified) (3 diffs)
- org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/resources/OSGI-INF/l10n/messages_en.properties (modified) (1 diff)
- org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/resources/OSGI-INF/l10n/messages_fr.properties (modified) (1 diff)
- org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/resources/OSGI-INF/l10n/messages_it.properties (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/java/org/nuxeo/ecm/platform/relations/web/listener/RelationActions.java
r18850 r18861 73 73 public String addStatement() throws ClientException; 74 74 75 public String deleteStatement(Statement selectedStatement); 75 public String deleteStatement(Statement selectedStatement) 76 throws ClientException; 76 77 77 78 public QNameResource getDocumentResource(); org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/java/org/nuxeo/ecm/platform/relations/web/listener/ejb/RelationActionsBean.java
r18850 r18861 19 19 20 20 import java.util.ArrayList; 21 import java.util.HashMap; 21 22 import java.util.List; 23 import java.util.Map; 22 24 23 25 import javax.ejb.PostActivate; … … 38 40 import org.jboss.seam.annotations.Observer; 39 41 import org.jboss.seam.annotations.Scope; 42 import org.nuxeo.ecm.core.NXCore; 40 43 import org.nuxeo.ecm.core.api.ClientException; 44 import org.nuxeo.ecm.core.api.CoreSession; 41 45 import org.nuxeo.ecm.core.api.DocumentModel; 42 46 import org.nuxeo.ecm.core.api.Filter; 43 47 import org.nuxeo.ecm.core.api.ejb.EJBExceptionHandler; 48 import org.nuxeo.ecm.core.api.event.CoreEvent; 49 import org.nuxeo.ecm.core.api.event.CoreEventConstants; 50 import org.nuxeo.ecm.core.api.event.impl.CoreEventImpl; 44 51 import org.nuxeo.ecm.core.api.impl.FacetFilter; 52 import org.nuxeo.ecm.core.listener.CoreEventListenerService; 45 53 import org.nuxeo.ecm.platform.relations.api.Node; 46 54 import org.nuxeo.ecm.platform.relations.api.QNameResource; … … 48 56 import org.nuxeo.ecm.platform.relations.api.Resource; 49 57 import org.nuxeo.ecm.platform.relations.api.Statement; 58 import org.nuxeo.ecm.platform.relations.api.event.RelationEvents; 50 59 import org.nuxeo.ecm.platform.relations.api.impl.LiteralImpl; 51 60 import org.nuxeo.ecm.platform.relations.api.impl.QNameResourceImpl; … … 86 95 public static final String DOCUMENT_NAMESPACE = "http://www.nuxeo.org/document/uid/"; 87 96 97 @In(create = true, required = false) 98 CoreSession documentManager; 99 88 100 @In(create = true) 89 101 RelationManager relationManager; … … 281 293 } 282 294 295 protected void notifyEvent(String eventId, DocumentModel source, 296 Map<String, Object> options, String comment) { 297 CoreEvent coreEvent = new CoreEventImpl(eventId, source, options, 298 documentManager.getPrincipal(), RelationEvents.CATEGORY, 299 comment); 300 CoreEventListenerService service = NXCore.getCoreEventListenerService(); 301 if (service != null) { 302 log.debug("Notify RepositoryEventListener listeners list for event=" 303 + eventId); 304 service.notifyEventListeners(coreEvent); 305 } else { 306 log.error("Impossible to notify core events ! " 307 + "CoreEventListenerService service is missing..."); 308 } 309 } 310 283 311 public String addStatement() throws ClientException { 284 if (getDocumentResource() == null) { 312 Resource documentResource = getDocumentResource(); 313 if (documentResource == null) { 285 314 throw new ClientException( 286 315 "Document resource could not be retrieved"); … … 301 330 } 302 331 303 Statement stmt = new StatementImpl(getDocumentResource(), predicate, 304 object); 332 Statement stmt = new StatementImpl(documentResource, predicate, object); 305 333 if (!outgoingStatementList.contains(stmt)) { 306 334 // add statement to the graph 307 335 List<Statement> stmts = new ArrayList<Statement>(); 336 String eventComment = null; 308 337 if (comment != null) { 309 338 comment = comment.trim(); … … 312 341 "http://www.nuxeo.org/comment"); 313 342 stmt.addProperty(commentPred, new LiteralImpl(comment)); 343 eventComment = comment; 314 344 } 315 345 } 316 346 stmts.add(stmt); 347 348 // notifications 349 350 Map<String, Object> options = new HashMap<String, Object>(); 351 DocumentModel source = navigationContext.getCurrentDocument(); 352 String currentLifeCycleState = source.getCurrentLifeCycleState(); 353 options.put(CoreEventConstants.DOC_LIFE_CYCLE, 354 currentLifeCycleState); 355 options.put(RelationEvents.NEW_STATEMENT_EVENT_KEY, stmt); 356 357 // before notification 358 notifyEvent(RelationEvents.BEFORE_RELATION_CREATION, source, 359 options, eventComment); 360 361 // add statement 317 362 relationManager.add(GRAPH_NAME, stmts); 363 364 // after notification 365 notifyEvent(RelationEvents.AFTER_RELATION_CREATION, source, 366 options, eventComment); 367 318 368 outgoingStatementList.add(stmt); 319 369 // take care of relation to oneself … … 348 398 } 349 399 350 public String deleteStatement(Statement selectedOutgoingStatement) { 400 public String deleteStatement(Statement selectedOutgoingStatement) 401 throws ClientException { 351 402 if (selectedOutgoingStatement != null 352 403 && outgoingStatementList.contains(selectedOutgoingStatement)) { 404 // notifications 405 Map<String, Object> options = new HashMap<String, Object>(); 406 DocumentModel source = navigationContext.getCurrentDocument(); 407 String currentLifeCycleState = source.getCurrentLifeCycleState(); 408 options.put(CoreEventConstants.DOC_LIFE_CYCLE, 409 currentLifeCycleState); 410 options.put(RelationEvents.NEW_STATEMENT_EVENT_KEY, 411 selectedOutgoingStatement); 412 413 // before notification 414 notifyEvent(RelationEvents.BEFORE_RELATION_CREATION, source, 415 options, null); 416 417 // remove statement 353 418 List<Statement> stmts = new ArrayList<Statement>(); 354 419 stmts.add(selectedOutgoingStatement); 355 420 relationManager.remove(GRAPH_NAME, stmts); 421 422 // after notification 423 notifyEvent(RelationEvents.AFTER_RELATION_CREATION, source, 424 options, null); 425 356 426 outgoingStatementList.remove(selectedOutgoingStatement); 357 427 // take care of relation to oneself org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/resources/META-INF/MANIFEST.MF
r15967 r18861 6 6 Require-Bundle: org.nuxeo.ecm.webapp.core 7 7 Nuxeo-Component: OSGI-INF/actions-contrib.xml, 8 OSGI-INF/audit-contrib.xml, 8 9 OSGI-INF/directories-contrib.xml 9 10 Nuxeo-RequiredBy: org.nuxeo.ecm.war org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/resources/OSGI-INF/deployment-fragment.xml
r16248 r18861 74 74 </unzip> 75 75 76 <append from="NXRelationsWeb.tmp/OSGI-INF/l10n/messages .properties"76 <append from="NXRelationsWeb.tmp/OSGI-INF/l10n/messages_en.properties" 77 77 to="nuxeo.war/WEB-INF/classes/messages.properties" addNewLine="true" /> 78 78 <append from="NXRelationsWeb.tmp/OSGI-INF/l10n/messages_en.properties" … … 82 82 <append from="NXRelationsWeb.tmp/OSGI-INF/l10n/messages_de.properties" 83 83 to="nuxeo.war/WEB-INF/classes/messages_de.properties" addNewLine="true" /> 84 <append from="NXRelationsWeb.tmp/OSGI-INF/l10n/messages_it.properties" 85 to="nuxeo.war/WEB-INF/classes/messages_it.properties" addNewLine="true" /> 84 86 85 87 <copy from="NXRelationsWeb.tmp/META-INF/nxrelations.taglib.xml" org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/resources/OSGI-INF/l10n/messages_de.properties
r16025 r18861 5 5 #Verbesserungen wären natürlich sehr herzlich willkommen 6 6 7 action.view.relation =Relationen7 action.view.relations=Relationen 8 8 9 9 command.show.create.relation=Eine Relation erstellen … … 12 12 title.create.relation=Eine Relation erstellen 13 13 title.relation.outgoing=Ausgehende Relationen 14 title.relation.in going=Einkomennde Relationen14 title.relation.incoming=Einkomennde Relationen 15 15 16 16 label.relation.subject=Subjekt … … 45 45 label.relation.deleted=Relation deleted 46 46 47 afterRelationCreation=Relation created 48 afterRelationModification=Relation modified 49 afterRelationRemoval=Relation deleted 50 relationNotificationCategory=Relations org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/resources/OSGI-INF/l10n/messages_en.properties
r16025 r18861 39 39 label.relation.deleted=Relation deleted 40 40 41 # for notification logs 42 afterRelationCreation=Relation created 43 afterRelationModification=Relation modified 44 afterRelationRemoval=Relation deleted 45 relationNotificationCategory=Relations org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/resources/OSGI-INF/l10n/messages_fr.properties
r16025 r18861 37 37 label.relation.created=Relation créée 38 38 label.relation.already.exists=La relation existe déjà 39 label.relation.deleted=Relation effacée39 label.relation.deleted=Relation supprimée 40 40 41 41 afterRelationCreation=Relation créée 42 afterRelationModification=Relation modifiée 43 afterRelationRemoval=Relation supprimée 44 relationNotificationCategory=Relations org.nuxeo.ecm.platform/trunk/nuxeo-platform-relations-web/src/main/resources/OSGI-INF/l10n/messages_it.properties
r18411 r18861 1 2 action.view.relation = Relazione3 1 action.view.relations = Relazioni 4 2 … … 36 34 title.create.relation = Aggiungere una nuova relazione 37 35 title.relation.incoming = Relazioni in ingresso 38 title.relation.ingoing = Relazioni in ingresso39 36 title.relation.outgoing = Relazioni in uscita 37 38 afterRelationCreation=Relation created 39 afterRelationModification=Relation modified 40 afterRelationRemoval=Relation deleted 41 relationNotificationCategory=Relations
