<dependency>
<groupId>org.nuxeo.ecm.automation</groupId>
<artifactId>nuxeo-automation-io</artifactId>
- <version>${nuxeo.core.version}</version>
</dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<dependency>
<groupId>org.nuxeo.ecm.core</groupId>
<artifactId>nuxeo-core-storage-sql</artifactId>
- <version>${nuxeo.core.version}</version>
</dependency>
<dependency>
<groupId>org.nuxeo.ecm.platform</groupId>
package org.collectionspace.services.listener.botgarden;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.movement.nuxeo.MovementConstants;
import org.collectionspace.services.nuxeo.listener.AbstractCSEventListenerImpl;
import org.nuxeo.ecm.core.event.Event;
import org.nuxeo.ecm.core.event.EventContext;
import org.nuxeo.ecm.core.event.impl.DocumentEventContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class CreateVersionListener extends AbstractCSEventListenerImpl {
public static final String SKIP_PROPERTY = "CreateVersionListener.SKIP";
- final Log logger = LogFactory.getLog(CreateVersionListener.class);
+ final Logger logger = LoggerFactory.getLogger(CreateVersionListener.class);
@Override
public void handleEvent(Event event) {
logger.debug("docType=" + doc.getType());
- if (doc.getType().startsWith(MovementConstants.NUXEO_DOCTYPE) &&
- !doc.isVersion() &&
+ if (doc.getType().startsWith(MovementConstants.NUXEO_DOCTYPE) &&
+ !doc.isVersion() &&
!doc.isProxy() &&
!doc.getCurrentLifeCycleState().equals(WorkflowClient.WORKFLOWSTATE_DELETED)) {
// Version the document
- DocumentRef versionRef = doc.checkIn(VersioningOption.MINOR, null);
+ DocumentRef versionRef = doc.checkIn(VersioningOption.MINOR, null);
DocumentModel versionDoc = context.getCoreSession().getDocument(versionRef);
logger.debug("created version: id=" + versionDoc.getId() + " csid=" + versionDoc.getName());
}
}
}
-}
\ No newline at end of file
+}
package org.collectionspace.services.listener.botgarden;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.movement.nuxeo.MovementBotGardenConstants;
import org.collectionspace.services.movement.nuxeo.MovementConstants;
import org.nuxeo.ecm.core.event.Event;
import org.nuxeo.ecm.core.event.EventContext;
import org.nuxeo.ecm.core.event.impl.DocumentEventContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class DeleteDeadLocationListener extends AbstractCSEventListenerImpl {
- final Log logger = LogFactory.getLog(DeleteDeadLocationListener.class);
+ final Logger logger = LoggerFactory.getLogger(DeleteDeadLocationListener.class);
- /*
- * Delete dead locations.
+ /*
+ * Delete dead locations.
*/
@Override
public void handleEvent(Event event) {
DocumentModel doc = context.getSourceDocument();
if (doc.getType().startsWith(MovementConstants.NUXEO_DOCTYPE) &&
- !doc.isVersion() &&
- !doc.isProxy() &&
+ !doc.isVersion() &&
+ !doc.isProxy() &&
!doc.getCurrentLifeCycleState().equals(WorkflowClient.WORKFLOWSTATE_DELETED)) {
- String actionCode = (String) doc.getProperty(MovementBotGardenConstants.ACTION_CODE_SCHEMA_NAME,
+ String actionCode = (String) doc.getProperty(MovementBotGardenConstants.ACTION_CODE_SCHEMA_NAME,
MovementBotGardenConstants.ACTION_CODE_FIELD_NAME);
-
+
logger.debug("actionCode=" + actionCode);
-
+
if (actionCode != null && actionCode.equals(MovementBotGardenConstants.DEAD_ACTION_CODE)) {
CoreSession session = context.getCoreSession();
-
+
if (session.getAllowedStateTransitions(doc.getRef()).contains(WorkflowClient.WORKFLOWTRANSITION_DELETE)) {
session.followTransition(doc.getRef(), WorkflowClient.WORKFLOWTRANSITION_DELETE);
}
}
}
}
-}
\ No newline at end of file
+}
import java.util.Set;
import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.collectionspace.services.batch.nuxeo.UpdateAccessCodeBatchJob;
import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectBotGardenConstants;
import org.nuxeo.ecm.core.event.Event;
import org.nuxeo.ecm.core.event.EventContext;
import org.nuxeo.ecm.core.event.impl.DocumentEventContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A listener that updates the access code on taxon records when collectionobjects
* or taxon records are created or modified.
- *
+ *
* @see org.collectionspace.services.batch.nuxeo.UpdateAccessCodeBatchJob
* @author ray
*
*/
public class UpdateAccessCodeListener extends AbstractCSEventListenerImpl {
- final Log logger = LogFactory.getLog(UpdateAccessCodeListener.class);
+ final Logger logger = LoggerFactory.getLogger(UpdateAccessCodeListener.class);
public static final String PREVIOUS_DEAD_FLAG_PROPERTY_NAME = "UpdateAccessCodeListener.previousDeadFlag";
public static final String PREVIOUS_TAXON_NAMES_PROPERTY_NAME = "UpdateAccessCodeListener.previousTaxonNames";
public static final String PREVIOUS_ACCESS_CODE_PROPERTY_NAME = "UpdateAccessCodeListener.previousAccessCode";
public static final String DELETED_RELATION_PARENT_CSID_PROPERTY_NAME = "UpdateAccessCodeListener.deletedRelationParentCsid";
-
+
private static final String[] TAXON_PATH_ELEMENTS = CollectionObjectBotGardenConstants.TAXON_FIELD_NAME.split("/");
private static final String TAXONOMIC_IDENT_GROUP_LIST_FIELD_NAME = TAXON_PATH_ELEMENTS[0];
private static final String TAXON_FIELD_NAME = TAXON_PATH_ELEMENTS[2];
@Override
public void handleEvent(Event event) {
EventContext ec = event.getContext();
-
+
if (isRegistered(event) && ec instanceof DocumentEventContext) {
DocumentEventContext context = (DocumentEventContext) ec;
DocumentModel doc = context.getSourceDocument();
logger.debug("docType=" + doc.getType());
if (doc.getType().startsWith(CollectionObjectConstants.NUXEO_DOCTYPE) &&
- !doc.isVersion() &&
- !doc.isProxy() &&
+ !doc.isVersion() &&
+ !doc.isProxy() &&
!doc.getCurrentLifeCycleState().equals(WorkflowClient.WORKFLOWSTATE_DELETED)) {
-
+
if (event.getName().equals(DocumentEventTypes.BEFORE_DOC_UPDATE)) {
// Stash the previous dead flag and taxonomic ident values, so they can be retrieved in the documentModified handler.
-
+
DocumentModel previousDoc = (DocumentModel) context.getProperty(CoreEventConstants.PREVIOUS_DOCUMENT_MODEL);
- String previousDeadFlag = (String) previousDoc.getProperty(CollectionObjectBotGardenConstants.DEAD_FLAG_SCHEMA_NAME,
+ String previousDeadFlag = (String) previousDoc.getProperty(CollectionObjectBotGardenConstants.DEAD_FLAG_SCHEMA_NAME,
CollectionObjectBotGardenConstants.DEAD_FLAG_FIELD_NAME);
context.setProperty(PREVIOUS_DEAD_FLAG_PROPERTY_NAME, previousDeadFlag);
-
+
List<String> previousTaxonNames = getTaxonNames(previousDoc);
context.setProperty(PREVIOUS_TAXON_NAMES_PROPERTY_NAME, previousTaxonNames.toArray(new String[previousTaxonNames.size()]));
}
boolean deadFlagChanged = false;
Set<String> deletedTaxonNames = null;
Set<String> addedTaxonNames = null;
-
- if (event.getName().equals(DocumentEventTypes.DOCUMENT_UPDATED)) {
+
+ if (event.getName().equals(DocumentEventTypes.DOCUMENT_UPDATED)) {
// As an optimization, check if the dead flag of the collectionobject has
// changed, or if the taxonomic identification has changed. If so, we need to
// update the access codes of referenced taxon records.
String previousDeadFlag = (String) context.getProperty(PREVIOUS_DEAD_FLAG_PROPERTY_NAME);
- String currentDeadFlag = (String) doc.getProperty(CollectionObjectBotGardenConstants.DEAD_FLAG_SCHEMA_NAME,
+ String currentDeadFlag = (String) doc.getProperty(CollectionObjectBotGardenConstants.DEAD_FLAG_SCHEMA_NAME,
CollectionObjectBotGardenConstants.DEAD_FLAG_FIELD_NAME);
if (previousDeadFlag == null) {
previousDeadFlag = "";
}
-
+
if (currentDeadFlag == null) {
currentDeadFlag = "";
}
-
+
if (previousDeadFlag.equals(currentDeadFlag)) {
logger.debug("dead flag not changed: previousDeadFlag=" + previousDeadFlag + " currentDeadFlag=" + currentDeadFlag);
}
logger.debug("dead flag changed: previousDeadFlag=" + previousDeadFlag + " currentDeadFlag=" + currentDeadFlag);
deadFlagChanged = true;
}
-
+
List<String> previousTaxonNames = Arrays.asList((String[]) context.getProperty(PREVIOUS_TAXON_NAMES_PROPERTY_NAME));
List<String> currentTaxonNames = getTaxonNames(doc);
-
+
deletedTaxonNames = findDeletedTaxonNames(previousTaxonNames, currentTaxonNames);
logger.debug("found deleted taxon names: " + StringUtils.join(deletedTaxonNames, ", "));
addedTaxonNames = findAddedTaxonNames(previousTaxonNames, currentTaxonNames);
- logger.debug("found added taxon names: " + StringUtils.join(addedTaxonNames, ", "));
+ logger.debug("found added taxon names: " + StringUtils.join(addedTaxonNames, ", "));
}
else if (event.getName().equals(DocumentEventTypes.DOCUMENT_CREATED)) {
deadFlagChanged = true;
}
-
+
UpdateAccessCodeBatchJob updater = createUpdater();
-
+
if (deadFlagChanged) {
String collectionObjectCsid = doc.getName();
-
+
try {
// Pass false for the second parameter to updateReferencedAccessCodes, so that it doesn't
// propagate changes up the taxon hierarchy. Propagation is taken care of by this
// event handler: As taxon records are modified, this handler executes, and updates the
// parent.
-
+
InvocationResults results = updater.updateReferencedAccessCodes(collectionObjectCsid, false);
-
+
logger.debug("updateReferencedAccessCodes complete: numAffected=" + results.getNumAffected() + " userNote=" + results.getUserNote());
}
catch (Exception e) {
else {
// If the dead flag didn't change, we still need to recalculate the access codes of
// any taxonomic idents that were added.
-
+
if (addedTaxonNames != null) {
for (String addedTaxonName : addedTaxonNames) {
logger.debug("updating added taxon: " + addedTaxonName);
- try {
+ try {
InvocationResults results = updater.updateAccessCode(addedTaxonName, false);
-
+
logger.debug("updateAccessCode complete: numAffected=" + results.getNumAffected() + " userNote=" + results.getUserNote());
}
catch (Exception e) {
logger.error(e.getMessage(), e);
- }
- }
+ }
+ }
}
}
-
+
if (deletedTaxonNames != null) {
// If any taxonomic idents were removed from the collectionobject, they need to have their
// access codes recalculated.
for (String deletedTaxonName : deletedTaxonNames) {
logger.debug("updating deleted taxon: " + deletedTaxonName);
- try {
+ try {
InvocationResults results = updater.updateAccessCode(deletedTaxonName, false);
-
+
logger.debug("updateAccessCode complete: numAffected=" + results.getNumAffected() + " userNote=" + results.getUserNote());
}
catch (Exception e) {
logger.error(e.getMessage(), e);
- }
+ }
}
}
}
}
else if (doc.getType().startsWith(TaxonConstants.NUXEO_DOCTYPE) &&
- !doc.isVersion() &&
- !doc.isProxy() &&
+ !doc.isVersion() &&
+ !doc.isProxy() &&
!doc.getCurrentLifeCycleState().equals(WorkflowClient.WORKFLOWSTATE_DELETED)) {
-
- if (event.getName().equals(DocumentEventTypes.BEFORE_DOC_UPDATE)) {
+
+ if (event.getName().equals(DocumentEventTypes.BEFORE_DOC_UPDATE)) {
// Stash the previous access code value, so it can be retrieved in the documentModified handler.
DocumentModel previousDoc = (DocumentModel) context.getProperty(CoreEventConstants.PREVIOUS_DOCUMENT_MODEL);
else {
boolean updateRequired = false;
- if (event.getName().equals(DocumentEventTypes.DOCUMENT_UPDATED)) {
+ if (event.getName().equals(DocumentEventTypes.DOCUMENT_UPDATED)) {
// As an optimization, check if the access code of the taxon has
// changed. We only need to update the access code of the parent taxon
// record if it has.
if (previousAccessCode == null) {
previousAccessCode = "";
}
-
+
if (currentAccessCode == null) {
currentAccessCode = "";
}
-
+
if (previousAccessCode.equals(currentAccessCode)) {
logger.debug("update not required: previousAccessCode=" + previousAccessCode + " currentAccessCode=" + currentAccessCode);
}
}
}
else if (event.getName().equals(DocumentEventTypes.DOCUMENT_CREATED)) {
- updateRequired = true;
+ updateRequired = true;
}
-
+
if (updateRequired) {
String taxonCsid = doc.getName();
-
+
try {
// Pass false for the second parameter to updateReferencedAccessCodes, so that it doesn't
// propagate changes up the taxon hierarchy. Propagation is taken care of by this
// event handler: As taxon records are modified, this handler executes, and updates the
// parent.
-
+
InvocationResults results = createUpdater().updateParentAccessCode(taxonCsid, false);
-
+
logger.debug("updateParentAccessCode complete: numAffected=" + results.getNumAffected() + " userNote=" + results.getUserNote());
}
catch (Exception e) {
}
}
else if (doc.getType().equals(RelationConstants.NUXEO_DOCTYPE) &&
- !doc.isVersion() &&
+ !doc.isVersion() &&
!doc.isProxy()) {
-
+
if (event.getName().equals(DocumentEventTypes.DOCUMENT_CREATED)) {
String subjectDocType = (String) doc.getProperty(RelationConstants.SUBJECT_DOCTYPE_SCHEMA_NAME, RelationConstants.SUBJECT_DOCTYPE_FIELD_NAME);
String objectDocType = (String) doc.getProperty(RelationConstants.OBJECT_DOCTYPE_SCHEMA_NAME, RelationConstants.OBJECT_DOCTYPE_FIELD_NAME);;
String relationType = (String) doc.getProperty(RelationConstants.TYPE_SCHEMA_NAME, RelationConstants.TYPE_FIELD_NAME);
-
+
logger.debug("subjectDocType=" + subjectDocType + " objectDocType=" + objectDocType + " relationType=" + relationType);
-
+
if (subjectDocType.equals(TaxonConstants.NUXEO_DOCTYPE) && objectDocType.equals(TaxonConstants.NUXEO_DOCTYPE) && relationType.equals(RelationConstants.BROADER_TYPE)) {
String parentTaxonCsid = (String) doc.getProperty(RelationConstants.OBJECT_CSID_SCHEMA_NAME, RelationConstants.OBJECT_CSID_FIELD_NAME);
logger.debug("child added, updating parent taxon: parentTaxonCsid=" + parentTaxonCsid);
-
- try {
+
+ try {
InvocationResults results = createUpdater().updateAccessCode(parentTaxonCsid, false);
-
+
logger.debug("updateAccessCode complete: numAffected=" + results.getNumAffected() + " userNote=" + results.getUserNote());
}
catch (Exception e) {
String subjectDocType = (String) doc.getProperty(RelationConstants.SUBJECT_DOCTYPE_SCHEMA_NAME, RelationConstants.SUBJECT_DOCTYPE_FIELD_NAME);
String objectDocType = (String) doc.getProperty(RelationConstants.OBJECT_DOCTYPE_SCHEMA_NAME, RelationConstants.OBJECT_DOCTYPE_FIELD_NAME);;
String relationType = (String) doc.getProperty(RelationConstants.TYPE_SCHEMA_NAME, RelationConstants.TYPE_FIELD_NAME);
-
+
logger.debug("subjectDocType=" + subjectDocType + " objectDocType=" + objectDocType + " relationType=" + relationType);
if (subjectDocType.equals(TaxonConstants.NUXEO_DOCTYPE) && objectDocType.equals(TaxonConstants.NUXEO_DOCTYPE) && relationType.equals(RelationConstants.BROADER_TYPE)) {
String parentTaxonCsid = (String) doc.getProperty(RelationConstants.OBJECT_CSID_SCHEMA_NAME, RelationConstants.OBJECT_CSID_FIELD_NAME);
-
+
// Stash the parent taxon csid, so it can be retrieved in the documentRemoved handler.
logger.debug("about to delete taxon hierarchy relation: parentTaxonCsid=" + parentTaxonCsid);
context.setProperty(DELETED_RELATION_PARENT_CSID_PROPERTY_NAME, parentTaxonCsid);
}
else if (event.getName().equals(DocumentEventTypes.DOCUMENT_REMOVED)) {
String parentTaxonCsid = (String) context.getProperty(DELETED_RELATION_PARENT_CSID_PROPERTY_NAME);
-
+
if (StringUtils.isNotEmpty(parentTaxonCsid)) {
logger.debug("child removed, updating parent taxon: parentTaxonCsid=" + parentTaxonCsid);
- try {
+ try {
InvocationResults results = createUpdater().updateAccessCode(parentTaxonCsid, false);
-
+
logger.debug("updateAccessCode complete: numAffected=" + results.getNumAffected() + " userNote=" + results.getUserNote());
}
catch (Exception e) {
logger.error(e.getMessage(), e);
- }
+ }
}
}
}
}
}
-
+
private List<String> getTaxonNames(DocumentModel doc) {
- List<Map<String, Object>> taxonomicIdentGroupList = (List<Map<String, Object>>) doc.getProperty(CollectionObjectBotGardenConstants.TAXON_SCHEMA_NAME,
+ List<Map<String, Object>> taxonomicIdentGroupList = (List<Map<String, Object>>) doc.getProperty(CollectionObjectBotGardenConstants.TAXON_SCHEMA_NAME,
TAXONOMIC_IDENT_GROUP_LIST_FIELD_NAME);
List<String> taxonNames = new ArrayList<String>();
private Set<String> findDeletedTaxonNames(List<String> previousTaxonNames, List<String> currentTaxonNames) {
Set<String> currentTaxonNameSet = new HashSet<String>(currentTaxonNames);
Set<String> deletedTaxonNameSet = new HashSet<String>();
-
+
for (String previousTaxonName : previousTaxonNames) {
if (!currentTaxonNameSet.contains(previousTaxonName)) {
deletedTaxonNameSet.add(previousTaxonName);
}
}
-
+
return deletedTaxonNameSet;
}
-
+
private Set<String> findAddedTaxonNames(List<String> previousTaxonNames, List<String> currentTaxonNames) {
Set<String> previousTaxonNameSet = new HashSet<String>(previousTaxonNames);
Set<String> addedTaxonNameSet = new HashSet<String>();
-
+
for (String currentTaxonName : currentTaxonNames) {
if (!previousTaxonNameSet.contains(currentTaxonName)) {
addedTaxonNameSet.add(currentTaxonName);
}
}
-
+
return addedTaxonNameSet;
}
-
+
private UpdateAccessCodeBatchJob createUpdater() {
ResourceMap resourceMap = ResteasyProviderFactory.getContextData(ResourceMap.class);
return updater;
}
-}
\ No newline at end of file
+}
package org.collectionspace.services.listener.botgarden;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.collectionspace.services.batch.nuxeo.UpdateDeadFlagBatchJob;
import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectConstants;
import org.nuxeo.ecm.core.event.Event;
import org.nuxeo.ecm.core.event.EventContext;
import org.nuxeo.ecm.core.event.impl.DocumentEventContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class UpdateDeadFlagListener extends AbstractCSEventListenerImpl {
- final Log logger = LogFactory.getLog(UpdateDeadFlagListener.class);
+ final Logger logger = LoggerFactory.getLogger(UpdateDeadFlagListener.class);
- /*
+ /*
* Set the dead flag and dead date on collectionobjects related to a new or modified movement record.
*/
@Override
/*
* Handle the case where a new movement is created with action code revive, and then related
* to a collectionobject. The movement won't have any relations at the time it's created,
- * so we need to capture the creation of the relation.
+ * so we need to capture the creation of the relation.
*/
if (doc.getType().equals(RelationConstants.NUXEO_DOCTYPE) &&
- !doc.isVersion() &&
+ !doc.isVersion() &&
!doc.isProxy()) {
String subjectDocType = (String) doc.getProperty(RelationConstants.SUBJECT_DOCTYPE_SCHEMA_NAME, RelationConstants.SUBJECT_DOCTYPE_FIELD_NAME);
String objectDocType = (String) doc.getProperty(RelationConstants.OBJECT_DOCTYPE_SCHEMA_NAME, RelationConstants.OBJECT_DOCTYPE_FIELD_NAME);;
logger.debug("updateDeadFlag complete: numAffected=" + results.getNumAffected() + " userNote=" + results.getUserNote());
} catch (Exception e) {
logger.error(e.getMessage(), e);
- }
+ }
}
}
}
else {
/*
- * Handle document modification. If the modified document was a movement record, and
+ * Handle document modification. If the modified document was a movement record, and
* its action code is dead or revived, update the dead flag. We don't actually have to
* check the action code here, since it will be checked inside UpdateDeadFlagBatchJob.updateRelatedDeadFlags,
* but it is an optimization.
*/
if (doc.getType().startsWith(MovementConstants.NUXEO_DOCTYPE) &&
- !doc.isVersion() &&
- !doc.isProxy() &&
+ !doc.isVersion() &&
+ !doc.isProxy() &&
!doc.getCurrentLifeCycleState().equals(WorkflowClient.WORKFLOWSTATE_DELETED)) {
- String actionCode = (String) doc.getProperty(MovementBotGardenConstants.ACTION_CODE_SCHEMA_NAME, MovementBotGardenConstants.ACTION_CODE_FIELD_NAME);
+ String actionCode = (String) doc.getProperty(MovementBotGardenConstants.ACTION_CODE_SCHEMA_NAME, MovementBotGardenConstants.ACTION_CODE_FIELD_NAME);
logger.debug("actionCode=" + actionCode);
return updater;
}
-}
\ No newline at end of file
+}
package org.collectionspace.services.listener.botgarden;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.movement.nuxeo.MovementBotGardenConstants;
import org.collectionspace.services.movement.nuxeo.MovementConstants;
import org.nuxeo.ecm.core.event.Event;
import org.nuxeo.ecm.core.event.EventContext;
import org.nuxeo.ecm.core.event.impl.DocumentEventContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class UpdateLocationListener extends AbstractCSEventListenerImpl {
- final Log logger = LogFactory.getLog(UpdateLocationListener.class);
+ final Logger logger = LoggerFactory.getLogger(UpdateLocationListener.class);
- /*
+ /*
* Set the currentLocation and previousLocation fields in a Current Location record
* to appropriate values.
- *
+ *
* <ul>
* <li>If the plant is dead, set currentLocation to none</li>
* <li>Set the previousLocation field to the previous value of the currentLocation field</li>
DocumentEventContext context = (DocumentEventContext) ec;
DocumentModel doc = context.getSourceDocument();
- if (doc.getType().startsWith(MovementConstants.NUXEO_DOCTYPE) &&
- !doc.isVersion() &&
- !doc.isProxy() &&
+ if (doc.getType().startsWith(MovementConstants.NUXEO_DOCTYPE) &&
+ !doc.isVersion() &&
+ !doc.isProxy() &&
!doc.getCurrentLifeCycleState().equals(WorkflowClient.WORKFLOWSTATE_DELETED)) {
- String actionCode = (String) doc.getProperty(MovementBotGardenConstants.ACTION_CODE_SCHEMA_NAME,
+ String actionCode = (String) doc.getProperty(MovementBotGardenConstants.ACTION_CODE_SCHEMA_NAME,
MovementBotGardenConstants.ACTION_CODE_FIELD_NAME);
logger.debug("actionCode=" + actionCode);
/*
* Special case for a document that is created with an action code of dead.
* In this case, we'll set the currentLocation to none, and the previousLocation to
- * the current value of currentLocation, since there isn't a previous value. To do
+ * the current value of currentLocation, since there isn't a previous value. To do
* this, we can simply save the document, which will cause the beforeDocumentModification
* event to fire, taking us into the other branch of this code, with the current document
* becoming the previous document.
ec.setProperty(CreateVersionListener.SKIP_PROPERTY, true);
}
}
- else {
+ else {
if (actionCode != null && actionCode.equals(MovementBotGardenConstants.DEAD_ACTION_CODE)) {
doc.setProperty(MovementConstants.CURRENT_LOCATION_SCHEMA_NAME, MovementConstants.CURRENT_LOCATION_FIELD_NAME, MovementConstants.NONE_LOCATION);
}
- DocumentModel previousDoc = (DocumentModel) context.getProperty(CoreEventConstants.PREVIOUS_DOCUMENT_MODEL);
+ DocumentModel previousDoc = (DocumentModel) context.getProperty(CoreEventConstants.PREVIOUS_DOCUMENT_MODEL);
String previousLocation = (String) previousDoc.getProperty(MovementConstants.CURRENT_LOCATION_SCHEMA_NAME, MovementConstants.CURRENT_LOCATION_FIELD_NAME);
logger.debug("previousLocation=" + previousLocation);
}
}
}
-}
\ No newline at end of file
+}
import java.util.List;
import java.util.Map;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.collectionspace.services.batch.nuxeo.UpdateRareFlagBatchJob;
import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectBotGardenConstants;
import org.nuxeo.ecm.core.event.Event;
import org.nuxeo.ecm.core.event.EventContext;
import org.nuxeo.ecm.core.event.impl.DocumentEventContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A listener that updates the rare flag on collectionobjects when collectionobjects
* are created or modified, and when taxon records are modified.
- *
+ *
* @see org.collectionspace.services.batch.nuxeo.UpdateRareFlagBatchJob
* @author ray
*
*/
public class UpdateRareFlagListener extends AbstractCSEventListenerImpl {
- final Log logger = LogFactory.getLog(UpdateRareFlagListener.class);
+ final Logger logger = LoggerFactory.getLogger(UpdateRareFlagListener.class);
public static final String PREVIOUS_TAXON_PROPERTY_NAME = "UpdateRareFlagListener.previousTaxon";
public static final String PREVIOUS_HAS_RARE_CONSERVATION_CATEGORY_PROPERTY_NAME = "UpdateRareFlagListener.previousHasRareConservationCategory";
-
+
private static final String[] CONSERVATION_CATEGORY_PATH_ELEMENTS = TaxonBotGardenConstants.CONSERVATION_CATEGORY_FIELD_NAME.split("/");
private static final String PLANT_ATTRIBUTES_GROUP_LIST_FIELD_NAME = CONSERVATION_CATEGORY_PATH_ELEMENTS[0];
private static final String CONSERVATION_CATEGORY_FIELD_NAME = CONSERVATION_CATEGORY_PATH_ELEMENTS[2];
logger.debug("docType=" + doc.getType());
if (doc.getType().startsWith(CollectionObjectConstants.NUXEO_DOCTYPE) &&
- !doc.isVersion() &&
- !doc.isProxy() &&
+ !doc.isVersion() &&
+ !doc.isProxy() &&
!doc.getCurrentLifeCycleState().equals(WorkflowClient.WORKFLOWSTATE_DELETED)) {
-
+
if (event.getName().equals(DocumentEventTypes.BEFORE_DOC_UPDATE)) {
// Stash the previous primary taxonomic ident, so it can be retrieved in the documentModified handler.
-
+
DocumentModel previousDoc = (DocumentModel) context.getProperty(CoreEventConstants.PREVIOUS_DOCUMENT_MODEL);
- String previousTaxon = (String) previousDoc.getProperty(CollectionObjectBotGardenConstants.TAXON_SCHEMA_NAME,
+ String previousTaxon = (String) previousDoc.getProperty(CollectionObjectBotGardenConstants.TAXON_SCHEMA_NAME,
CollectionObjectBotGardenConstants.PRIMARY_TAXON_FIELD_NAME);
context.setProperty(PREVIOUS_TAXON_PROPERTY_NAME, previousTaxon);
}
else {
boolean updateRequired = false;
-
+
if (event.getName().equals(DocumentEventTypes.DOCUMENT_UPDATED)) {
// A collectionobject was modified. As an optimization, check if the primary taxonomic determination
// of the collectionobject has changed. We only need to update the rare flag if it has.
String previousTaxon = (String) context.getProperty(PREVIOUS_TAXON_PROPERTY_NAME);
- String currentTaxon = (String) doc.getProperty(CollectionObjectBotGardenConstants.TAXON_SCHEMA_NAME,
+ String currentTaxon = (String) doc.getProperty(CollectionObjectBotGardenConstants.TAXON_SCHEMA_NAME,
CollectionObjectBotGardenConstants.PRIMARY_TAXON_FIELD_NAME);
-
+
if (previousTaxon == null) {
previousTaxon = "";
}
-
+
if (currentTaxon == null) {
currentTaxon = "";
}
-
+
if (previousTaxon.equals(currentTaxon)) {
logger.debug("update not required: previousTaxon=" + previousTaxon + " currentTaxon=" + currentTaxon);
}
else {
logger.debug("update required: previousTaxon=" + previousTaxon + " currentTaxon=" + currentTaxon);
updateRequired = true;
- }
+ }
}
else if (event.getName().equals(DocumentEventTypes.DOCUMENT_CREATED)) {
// A collectionobject was created. Always update the rare flag.
-
+
updateRequired = true;
}
-
+
if (updateRequired) {
String collectionObjectCsid = doc.getName();
-
+
try {
InvocationResults results = createUpdater().updateRareFlag(collectionObjectCsid);
-
+
logger.debug("updateRareFlag complete: numAffected=" + results.getNumAffected() + " userNote=" + results.getUserNote());
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
else if (doc.getType().startsWith(TaxonConstants.NUXEO_DOCTYPE) &&
- !doc.isVersion() &&
- !doc.isProxy() &&
+ !doc.isVersion() &&
+ !doc.isProxy() &&
!doc.getCurrentLifeCycleState().equals(WorkflowClient.WORKFLOWSTATE_DELETED)) {
-
+
if (event.getName().equals(DocumentEventTypes.BEFORE_DOC_UPDATE)) {
// Stash whether there was previously a non-empty conservation category, so it can be retrieved in the documentModified handler.
-
+
DocumentModel previousDoc = (DocumentModel) context.getProperty(CoreEventConstants.PREVIOUS_DOCUMENT_MODEL);
boolean previousHasRareConservationCategory = hasRareConservationCategory(previousDoc);
-
+
context.setProperty(PREVIOUS_HAS_RARE_CONSERVATION_CATEGORY_PROPERTY_NAME, new Boolean(previousHasRareConservationCategory));
}
else {
boolean updateRequired = false;
-
+
if (event.getName().equals(DocumentEventTypes.DOCUMENT_UPDATED)) {
// A taxon record was modified. As an optimization, check if there is now a rare
// conservation category when there wasn't before, or vice versa. We only need to update
boolean currentHasRareConservationCategory = hasRareConservationCategory(doc);
if (previousHasRareConservationCategory == currentHasRareConservationCategory) {
- logger.debug("update not required: previousHasRareConservationCategory=" + previousHasRareConservationCategory +
+ logger.debug("update not required: previousHasRareConservationCategory=" + previousHasRareConservationCategory +
" currentHasRareConservationCategory=" + currentHasRareConservationCategory);
}
else {
if (updateRequired) {
String taxonCsid = doc.getName();
-
+
try {
InvocationResults results = createUpdater().updateReferencingRareFlags(taxonCsid);
-
+
logger.debug("updateReferencingRareFlags complete: numAffected=" + results.getNumAffected() + " userNote=" + results.getUserNote());
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
}
-
+
private boolean hasRareConservationCategory(DocumentModel doc) {
List<Map<String, Object>> plantAttributesGroupList = (List<Map<String, Object>>) doc.getProperty(TaxonBotGardenConstants.CONSERVATION_CATEGORY_SCHEMA_NAME,
PLANT_ATTRIBUTES_GROUP_LIST_FIELD_NAME);
if (plantAttributesGroupList.size() > 0) {
Map<String, Object> plantAttributesGroup = plantAttributesGroupList.get(0);
String conservationCategory = (String) plantAttributesGroup.get(CONSERVATION_CATEGORY_FIELD_NAME);
-
+
if (UpdateRareFlagBatchJob.isRare(conservationCategory)) {
hasRareConservationCategory = true;
}
}
-
+
// for (Map<String, Object> plantAttributesGroup : plantAttributesGroupList) {
// String conservationCategory = (String) plantAttributesGroup.get(CONSERVATION_CATEGORY_FIELD_NAME);
//
// break;
// }
// }
-
+
return hasRareConservationCategory;
}
return updater;
}
-}
\ No newline at end of file
+}
package org.collectionspace.services.listener.botgarden;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jboss.resteasy.spi.ResteasyProviderFactory;
import org.collectionspace.services.batch.nuxeo.FormatVoucherNameBatchJob;
import org.nuxeo.ecm.core.event.Event;
import org.nuxeo.ecm.core.event.EventContext;
import org.nuxeo.ecm.core.event.impl.DocumentEventContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class UpdateStyledNameListener extends AbstractCSEventListenerImpl {
public static final String RUN_AFTER_MODIFIED_PROPERTY = "UpdateStyledNameListener.RUN_AFTER_MODIFIED";
- final Log logger = LogFactory.getLog(UpdateStyledNameListener.class);
+ final Logger logger = LoggerFactory.getLogger(UpdateStyledNameListener.class);
@Override
public void handleEvent(Event event) {
DocumentModel doc = context.getSourceDocument();
logger.debug("docType=" + doc.getType());
-
- if (doc.getType().startsWith(LoanoutConstants.NUXEO_DOCTYPE) &&
- !doc.isVersion() &&
- !doc.isProxy() &&
+
+ if (doc.getType().startsWith(LoanoutConstants.NUXEO_DOCTYPE) &&
+ !doc.isVersion() &&
+ !doc.isProxy() &&
!doc.getCurrentLifeCycleState().equals(WorkflowClient.WORKFLOWSTATE_DELETED)) {
-
+
if (event.getName().equals(DocumentEventTypes.BEFORE_DOC_UPDATE)) {
- DocumentModel previousDoc = (DocumentModel) context.getProperty(CoreEventConstants.PREVIOUS_DOCUMENT_MODEL);
-
+ DocumentModel previousDoc = (DocumentModel) context.getProperty(CoreEventConstants.PREVIOUS_DOCUMENT_MODEL);
+
String previousLabelRequested = (String) previousDoc.getProperty(LoanoutBotGardenConstants.LABEL_REQUESTED_SCHEMA_NAME,
LoanoutBotGardenConstants.LABEL_REQUESTED_FIELD_NAME);
String labelRequested = (String) doc.getProperty(LoanoutBotGardenConstants.LABEL_REQUESTED_SCHEMA_NAME,
LoanoutBotGardenConstants.LABEL_REQUESTED_FIELD_NAME);
-
+
logger.debug("previousLabelRequested=" + previousLabelRequested + " labelRequested=" + labelRequested);
-
- if ((previousLabelRequested == null || previousLabelRequested.equals(LoanoutBotGardenConstants.LABEL_REQUESTED_NO_VALUE)) &&
+
+ if ((previousLabelRequested == null || previousLabelRequested.equals(LoanoutBotGardenConstants.LABEL_REQUESTED_NO_VALUE)) &&
labelRequested.equals(LoanoutBotGardenConstants.LABEL_REQUESTED_YES_VALUE)) {
// The label request is changing from no to yes, so we should update the styled name.
ec.setProperty(RUN_AFTER_MODIFIED_PROPERTY, true);
}
else {
boolean doUpdate = false;
-
+
if (event.getName().equals(DocumentEventTypes.DOCUMENT_CREATED)) {
- String labelRequested = (String) doc.getProperty(LoanoutBotGardenConstants.LABEL_REQUESTED_SCHEMA_NAME,
+ String labelRequested = (String) doc.getProperty(LoanoutBotGardenConstants.LABEL_REQUESTED_SCHEMA_NAME,
LoanoutBotGardenConstants.LABEL_REQUESTED_FIELD_NAME);
-
+
doUpdate = (labelRequested != null && labelRequested.equals(LoanoutBotGardenConstants.LABEL_REQUESTED_YES_VALUE));
} else {
doUpdate = ec.hasProperty(RUN_AFTER_MODIFIED_PROPERTY) && ((Boolean) ec.getProperty(RUN_AFTER_MODIFIED_PROPERTY));
}
-
+
if (doUpdate) {
logger.debug("Updating styled name");
-
+
String voucherCsid = doc.getName();
-
+
try {
createFormatter().formatVoucherName(voucherCsid);
} catch (Exception e) {
}
}
}
-
+
private FormatVoucherNameBatchJob createFormatter() {
ResourceMap resourceMap = ResteasyProviderFactory.getContextData(ResourceMap.class);
return formatter;
}
-}
\ No newline at end of file
+}
<dependency>
<groupId>org.nuxeo.ecm.core</groupId>
<artifactId>nuxeo-core-storage-sql</artifactId>
- <version>${nuxeo.core.version}</version>
</dependency>
<dependency>
<groupId>org.nuxeo.ecm.platform</groupId>
import java.util.Map;
import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.common.api.RefName;
import org.collectionspace.services.common.api.TaxonFormatter;
import org.nuxeo.ecm.core.event.Event;
import org.nuxeo.ecm.core.event.EventContext;
import org.nuxeo.ecm.core.event.impl.DocumentEventContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class UpdateFormattedDisplayNameListener extends AbstractCSEventListenerImpl {
public static final String RUN_AFTER_MODIFIED_PROPERTY = "UpdateFormattedDisplayNameListener.RUN_AFTER_MODIFIED";
private static final String[] DISPLAY_NAME_PATH_ELEMENTS = TaxonConstants.DISPLAY_NAME_FIELD_NAME.split("/");
private static final String TERM_GROUP_LIST_FIELD_NAME = DISPLAY_NAME_PATH_ELEMENTS[0];
private static final String DISPLAY_NAME_FIELD_NAME = DISPLAY_NAME_PATH_ELEMENTS[2];
-
+
private static final String[] FORMATTED_DISPLAY_NAME_PATH_ELEMENTS = TaxonConstants.FORMATTED_DISPLAY_NAME_FIELD_NAME.split("/");
private static final String FORMATTED_DISPLAY_NAME_FIELD_NAME = FORMATTED_DISPLAY_NAME_PATH_ELEMENTS[2];
- final Log logger = LogFactory.getLog(UpdateFormattedDisplayNameListener.class);
-
+ final Logger logger = LoggerFactory.getLogger(UpdateFormattedDisplayNameListener.class);
+
@Override
public void handleEvent(Event event) {
EventContext ec = event.getContext();
DocumentModel doc = context.getSourceDocument();
logger.debug("docType=" + doc.getType());
-
- if (doc.getType().startsWith(TaxonConstants.NUXEO_DOCTYPE) &&
- !doc.isVersion() &&
- !doc.isProxy() &&
+
+ if (doc.getType().startsWith(TaxonConstants.NUXEO_DOCTYPE) &&
+ !doc.isVersion() &&
+ !doc.isProxy() &&
!doc.getCurrentLifeCycleState().equals(WorkflowClient.WORKFLOWSTATE_DELETED)) {
-
+
String refName = (String) doc.getProperty(TaxonConstants.REFNAME_SCHEMA_NAME, TaxonConstants.REFNAME_FIELD_NAME);
RefName.AuthorityItem item = RefName.AuthorityItem.parse(refName);
String parentShortId = item.getParentShortIdentifier();
-
+
logger.debug("parentShortId=" + parentShortId);
-
+
if (!parentShortId.equals(TaxonBotGardenConstants.COMMON_VOCABULARY_SHORTID)) {
if (event.getName().equals(DocumentEventTypes.DOCUMENT_CREATED)) {
// Save the document, to get the BEFORE_DOC_UPDATE branch to run.
doc.getCoreSession().saveDocument(doc);
}
else if (event.getName().equals(DocumentEventTypes.BEFORE_DOC_UPDATE)) {
- DocumentModel previousDoc = (DocumentModel) context.getProperty(CoreEventConstants.PREVIOUS_DOCUMENT_MODEL);
-
+ DocumentModel previousDoc = (DocumentModel) context.getProperty(CoreEventConstants.PREVIOUS_DOCUMENT_MODEL);
+
updateFormattedDisplayNames(doc, previousDoc);
}
}
}
}
}
-
+
private void updateFormattedDisplayNames(DocumentModel doc, DocumentModel previousDoc) {
//Set<String> previousDisplayNames = getDisplayNames(previousDoc);
TaxonFormatter formatter = new TaxonFormatter();
for (Map<String, Object> termGroup : termGroupList) {
String displayName = (String) termGroup.get(DISPLAY_NAME_FIELD_NAME);
String formattedDisplayName = (String) termGroup.get(FORMATTED_DISPLAY_NAME_FIELD_NAME);
-
+
if (StringUtils.isBlank(formattedDisplayName)) {
formattedDisplayName = "";
-
+
if (StringUtils.isNotBlank(displayName)) {
formattedDisplayName = formatter.format(displayName);
}
-
+
termGroup.put(FORMATTED_DISPLAY_NAME_FIELD_NAME, formattedDisplayName);
}
}
-
+
Map<String, Object> updateMap = new HashMap<String, Object>();
updateMap.put(TERM_GROUP_LIST_FIELD_NAME, termGroupList);
-
+
doc.setProperties(TaxonConstants.DISPLAY_NAME_SCHEMA_NAME, updateMap);
}
-
+
/*
private Set<String> getDisplayNames(DocumentModel doc) throws ClientException {
Set<String> displayNames = new HashSet<String>();
for (Map<String, Object> termGroup : termGroupList) {
String displayName = (String) termGroup.get(DISPLAY_NAME_FIELD_NAME);
-
+
if (displayName != null) {
displayNames.add(displayName);
}
}
-
+
return displayNames;
}
*/
-}
\ No newline at end of file
+}
<dependency>
<groupId>org.nuxeo.ecm.core</groupId>
<artifactId>nuxeo-core-storage-sql</artifactId>
- <version>${nuxeo.core.version}</version>
</dependency>
<dependency>
<groupId>org.nuxeo.ecm.platform</groupId>
import java.io.Serializable;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.collectionspace.services.common.api.CommonAPI;
import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
import org.collectionspace.services.nuxeo.client.java.CoreSessionWrapper;
import org.nuxeo.ecm.core.event.impl.DocumentEventContext;
//import org.nuxeo.ecm.platform.picture.api.ImagingDocumentConstants;
import org.nuxeo.ecm.platform.picture.api.ImagingDocumentConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class UpdateImageDerivatives extends AbstractCSEventListenerImpl {
// CoreSessionInterface coreSession = new
// CoreSessionWrapper(docEventContext.getCoreSession());
- // FIXME: We might experiment here with using log4j instead of Apache
- // Commons Logging; am using the latter to follow Ray's pattern for now
- private final static Log logger = LogFactory.getLog(UpdateImageDerivatives.class);
+ private final static Logger logger = LoggerFactory.getLogger(UpdateImageDerivatives.class);
@Override
public void handleEvent(Event event) {
// just disassociates the blob content (aka, the original image) from the document.
//
docModel.setPropertyValue("file:content", (Serializable) null);
-
+
//
// Removing this facet ensures the original derivatives are unchanged when
// we call the save method. If we didn't remove the face, then all the
// Nuxeo will still tread this document as a Picture document.
//
NuxeoUtils.addFacet(docModel, ImagingDocumentConstants.PICTURE_FACET);
-
+
//
// Finally, we need to remove the actual blob/image bits that are store on disk.
//
DocumentBlobHolder docBlobHolder = (DocumentBlobHolder) docModel.getAdapter(BlobHolder.class);
- Blob blob = docBlobHolder.getBlob();
+ Blob blob = docBlobHolder.getBlob();
if (blob == null) {
logger.error(String.format("Could not get blob for original image. Trying to delete original for: '%s'",
docModel.getTitle()));
logger.debug(String.format("Started thread '%s' to delete file of blob '%s'.",
thread.getId(), blob.getFilename()));
}
-
+
if (logger.isTraceEnabled()) {
- logger.trace(String.format("Exiting handleEvent in '%s'.", getClass().getName()));
- }
+ logger.trace(String.format("Exiting handleEvent in '%s'.", getClass().getName()));
+ }
}
-
+
private boolean shouldProcessEvent(Event event) {
boolean result = false;
return result;
}
-}
\ No newline at end of file
+}
import java.util.Map;
import java.util.Set;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.collectionspace.services.client.LocationAuthorityClient;
import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectConstants;
import org.nuxeo.ecm.core.api.impl.DocumentModelListImpl;
import org.nuxeo.ecm.core.event.Event;
import org.nuxeo.ecm.core.event.impl.DocumentEventContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public abstract class AbstractUpdateObjectLocationValues extends AbstractCSEventListenerImpl {
-
- // FIXME: We might experiment here with using log4j instead of Apache Commons Logging;
- // am using the latter to follow Ray's pattern for now
- private final static Log logger = LogFactory.getLog(AbstractUpdateObjectLocationValues.class);
+ private final static Logger logger = LoggerFactory.getLogger(AbstractUpdateObjectLocationValues.class);
// FIXME: Make the following message, or its equivalent, a constant usable by all event listeners
private final static String NO_FURTHER_PROCESSING_MESSAGE =
try {
relationDocModels = coreSession.query(query);
} catch (DocumentException e) {
- logger.error(e);
+ logger.error(e.getMessage());
}
if (relationDocModels == null || relationDocModels.isEmpty()) {
try {
relationDocModels = session.query(query);
} catch (DocumentException e) {
- logger.error(e);
+ logger.error(e.getMessage());
return null;
}
package org.collectionspace.services.listener;
import java.io.Serializable;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.collectionspace.services.common.api.RefNameUtils;
import org.collectionspace.services.common.api.Tools;
import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.DocumentModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class UpdateObjectLocationAndCrateOnMove extends UpdateObjectLocationOnMove {
-
- // FIXME: We might experiment here with using log4j instead of Apache Commons Logging;
- // am using the latter to follow Ray's pattern for now
- private final Log logger = LogFactory.getLog(UpdateObjectLocationAndCrateOnMove.class);
+ private final Logger logger = LoggerFactory.getLogger(UpdateObjectLocationAndCrateOnMove.class);
// FIXME: Get values below from external constants
private final static String COLLECTIONOBJECTS_ANTHROPOLOGY_SCHEMA = "collectionobjects_anthropology";
private final static String MOVEMENTS_ANTHROPOLOGY_SCHEMA = "movements_anthropology";
String mostRecentLocation) throws ClientException {
boolean flag = super.updateCollectionObjectLocation(collectionObjectDocModel, movementDocModel, mostRecentLocation);
collectionObjectDocModel = updateComputedCrateValue(collectionObjectDocModel, movementDocModel);
-
+
return flag;
}
private DocumentModel updateComputedCrateValue(DocumentModel collectionObjectDocModel,
DocumentModel movementDocModel)
throws ClientException {
-
+
// Get the current crate value from the Movement (the "new" value)
String crateRefName =
(String) movementDocModel.getProperty(MOVEMENTS_ANTHROPOLOGY_SCHEMA, CRATE_PROPERTY);
logger.trace("crate refName does NOT require updating.");
}
}
-
+
return collectionObjectDocModel;
}
-}
\ No newline at end of file
+}
package org.collectionspace.services.listener;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.collectionspace.services.common.api.RefNameUtils;
import org.collectionspace.services.common.api.Tools;
import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.DocumentModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class UpdateObjectLocationOnMove extends AbstractUpdateObjectLocationValues {
-
- // FIXME: We might experiment here with using log4j instead of Apache Commons Logging;
- // am using the latter to follow Ray's pattern for now
- private final Log logger = LogFactory.getLog(UpdateObjectLocationOnMove.class);
+ private final Logger logger = LoggerFactory.getLogger(UpdateObjectLocationOnMove.class);
@Override
protected boolean updateCollectionObjectLocation(DocumentModel collectionObjectDocModel,
movementRecordsLocation));
return result;
}
-
+
// Get the computed current location value of the CollectionObject.
String existingComputedCurrentLocation = (String) collectionObjectDocModel.getProperty(COLLECTIONOBJECTS_COMMON_SCHEMA,
COMPUTED_CURRENT_LOCATION_PROPERTY);
COMPUTED_CURRENT_LOCATION_PROPERTY, movementRecordsLocation);
result = true; // We've updated the location field.
}
-
+
return result;
}
-}
\ No newline at end of file
+}
import java.util.IllegalFormatException;
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.common.document.DocumentException;
import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
import org.nuxeo.ecm.core.event.Event;
import org.nuxeo.ecm.core.event.EventContext;
import org.nuxeo.ecm.core.event.impl.DocumentEventContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class UpdateRelationsOnDelete extends AbstractCSEventListenerImpl {
+ final Logger logger = LoggerFactory.getLogger(UpdateRelationsOnDelete.class);
- // FIXME: We might experiment here with using log4j instead of Apache Commons Logging;
- // am using the latter to follow Ray's pattern for now
- final Log logger = LogFactory.getLog(UpdateRelationsOnDelete.class);
-
// FIXME: Get these constant values from external sources rather than redeclaring here
final static String RELATION_DOCTYPE = "Relation";
final static String RELATIONS_COMMON_SUBJECT_CSID_FIELD = "relations_common:subjectCsid";
@Override
public void handleEvent(Event event) {
logger.trace("In handleEvent in UpdateRelationsOnDelete ...");
-
+
EventContext eventContext = event.getContext();
if (isRegistered(event) && isDocumentSoftDeletedEvent(eventContext)) {
-
+
logger.trace("A soft deletion event was received by UpdateRelationsOnDelete ...");
-
+
DocumentEventContext docContext = (DocumentEventContext) eventContext;
DocumentModel docModel = docContext.getSourceDocument();
-
+
// Exclude soft deletion events involving Relation records themselves
// from handling by this event handler.
if (docModel != null && docModel.getType().startsWith(RELATION_DOCTYPE)) {
return;
}
-
+
// Retrieve a list of relation records, where the soft deleted
// document provided in the context of the current event is
// either the subject or object of any relation
-
+
// Build a query string
String csid = docModel.getName();
-
+
String queryString;
try {
queryString =
logger.warn("Actions in this event listener will NOT be performed, as a result of a previous Exception.");
return;
}
-
+
// Create a filter to exclude from the list results any records
// that have already been soft deleted or are locked
List<String> workflowStatesToFilter = new ArrayList<String>();
workflowStatesToFilter.add(WorkflowClient.WORKFLOWSTATE_LOCKED);
workflowStatesToFilter.add(WorkflowClient.WORKFLOWSTATE_LOCKED_DELETED);
workflowStatesToFilter.add(WorkflowClient.WORKFLOWSTATE_REPLICATED_DELETED);
-
+
LifeCycleFilter workflowStateFilter = new LifeCycleFilter(null, workflowStatesToFilter);
-
+
// Perform the filtered query
CoreSessionInterface session = new CoreSessionWrapper(docModel.getCoreSession());
DocumentModelList matchingDocuments;
}
}
-
+
// FIXME: Generic methods like the following might be split off
// into an event utilities class. - ADR 2012-12-05
/**
* Identifies whether a supplied event concerns a document that has
* been transitioned to the 'deleted' workflow state.
- *
+ *
* @param eventContext an event context
- *
+ *
* @return true if this event concerns a document that has
* been transitioned to the 'deleted' workflow state.
*/
private boolean isDocumentSoftDeletedEvent(EventContext eventContext) {
boolean isSoftDeletedEvent = false;
-
+
if (eventContext instanceof DocumentEventContext) {
if (eventContext.getProperties().containsKey(WorkflowClient.WORKFLOWTRANSITION_TO)
&&
isSoftDeletedEvent = true;
}
}
-
+
return isSoftDeletedEvent;
}
}
<groupId>org.nuxeo.ecm.core</groupId>
<artifactId>nuxeo-core-event</artifactId>
<version>${nuxeo.core.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.nuxeo.ecm.core</groupId>
</dependency>
<dependency>
<groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-javaee</artifactId>
+ <artifactId>jboss-javaee</artifactId>
</dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- <scope>provided</scope>
- </dependency>
-
<!-- test dependencies -->
<dependency>
<scope>test</scope>
</dependency>
</dependencies>
-
+
<build>
<plugins>
<plugin>
</plugin>
</plugins>
</build>
-
+
</project>
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.nuxeo.common.utils.IdUtils;
import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.ClientRuntimeException;
import org.collectionspace.ecm.platform.quote.api.QuoteManager;
import org.collectionspace.ecm.platform.quote.service.QuoteServiceConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* @author <a href="mailto:glefter@nuxeo.com">George Lefter</a>
*
*/
public class QuoteManagerImpl implements QuoteManager {
- private static final Log log = LogFactory.getLog(QuoteManagerImpl.class);
+ private static final Logger logger = LoggerFactory.getLogger(QuoteManagerImpl.class);
final SimpleDateFormat timeFormat = new SimpleDateFormat("dd-HHmmss.S");
protected CoreSession openCoreSession(String repositoryName)
throws ClientException {
CoreSession result = null;
-
+
try {
result = CoreInstance.openCoreSession(repositoryName);
} catch (Exception e) {
throw new ClientException(e);
}
-
+
return result;
}
package org.collectionspace.ecm.platform.quote.listener;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.nuxeo.ecm.core.api.CoreSession;
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.core.api.event.DocumentEventTypes;
import org.collectionspace.ecm.platform.quote.service.QuoteServiceConfig;
import org.collectionspace.ecm.platform.quote.service.QuoteServiceHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public abstract class AbstractQuoteListener {
- private static final Log log = LogFactory.getLog(AbstractQuoteListener.class);
+ private static final Logger logger = LoggerFactory.getLogger(AbstractQuoteListener.class);
public void handleEvent(EventBundle events) {
for (Event event : events) {
*/
/*
- * An example Nuxeo event listener.
+ * An example Nuxeo event listener.
*/
package org.collectionspace.ecm.platform.quote.listener;
-
-
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.CoreSession;
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.platform.relations.api.Resource;
import org.nuxeo.ecm.platform.relations.api.Statement;
import org.nuxeo.ecm.platform.relations.api.impl.StatementImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class DocumentRemovedQuoteEventListener extends
AbstractQuoteListener implements PostCommitEventListener {
- private static final Log log = LogFactory.getLog(DocumentRemovedQuoteEventListener.class);
+ private static final Logger logger = LoggerFactory.getLogger(DocumentRemovedQuoteEventListener.class);
@Override
protected void doProcess(CoreSession coreSession,
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.CoreSession;
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.platform.relations.api.Statement;
import org.nuxeo.ecm.platform.relations.api.impl.StatementImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.collectionspace.ecm.platform.quote.service.QuoteServiceConfig;
public class QuoteRemovedEventListener extends AbstractQuoteListener
implements EventListener {
- private static final Log log = LogFactory.getLog(QuoteRemovedEventListener.class);
+ private static final Logger logger = LoggerFactory.getLogger(QuoteRemovedEventListener.class);
@Override
protected void doProcess(CoreSession coreSession,
package org.collectionspace.ecm.platform.quote.service;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.nuxeo.runtime.model.ComponentInstance;
import org.nuxeo.runtime.model.DefaultComponent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.collectionspace.ecm.platform.quote.api.QuoteManager;
import org.collectionspace.ecm.platform.quote.impl.QuoteManagerImpl;
public static final String VERSIONING_EXTENSION_POINT_RULES = "rules";
- private static final Log log = LogFactory.getLog(QuoteService.class);
+ private static final Logger logger = LoggerFactory.getLogger(QuoteService.class);
private QuoteManager quoteManager;
<dependency>
<groupId>org.nuxeo.ecm.core</groupId>
<artifactId>nuxeo-core-storage-sql</artifactId>
- <version>${nuxeo.core.version}</version>
</dependency>
<dependency>
<groupId>org.nuxeo.ecm.platform</groupId>
import java.util.Calendar;
import java.util.GregorianCalendar;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.nuxeo.ecm.core.api.Blob;
import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.CoreSession;
import org.nuxeo.ecm.core.convert.api.ConversionService;
import org.nuxeo.ecm.platform.filemanager.api.FileManager;
import org.nuxeo.runtime.api.Framework;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class AddThumbnailUnrestricted extends UnrestrictedSessionRunner {
-
- private static final Log logger = LogFactory
- .getLog(AddThumbnailUnrestricted.class);
-
+
+ private static final Logger logger = LoggerFactory
+ .getLogger(AddThumbnailUnrestricted.class);
+
protected ConversionService cs;
-
+
protected DocumentModel doc;
-
+
protected BlobHolder blobHolder;
-
+
protected Thumbnail thumbnail = null;
-
+
public AddThumbnailUnrestricted(CoreSession coreSession, DocumentModel doc,
BlobHolder blobHolder) {
super(coreSession);
this.doc = doc;
this.blobHolder = blobHolder;
}
-
+
/*
* (non-Javadoc)
* @see org.nuxeo.ecm.core.api.UnrestrictedSessionRunner#run()
- *
+ *
* Creates a new thumbnail image and associates it with the document blob by adding a "Thumbnail" facet
* to the document blob.
*/
public void run() throws ClientException {
String errMsg = "Error while adding preview thumbnail.";
String documentId = doc.getId();
-
+
try {
Blob blob = blobHolder.getBlob();
if (blob != null) {
if (doc.hasFacet(ThumbnailConstants.THUMBNAIL_FACET) == false) { // Make sure we don't already have a "Thumbnail" facet
- cs = Framework.getService(ConversionService.class);
- ensureModificationDateExists(doc); // For some reason, the ConversionService service requires the modification date of the blob is not null so we need to ensure it is not null.
+ cs = Framework.getService(ConversionService.class);
+ ensureModificationDateExists(doc); // For some reason, the ConversionService service requires the modification date of the blob is not null so we need to ensure it is not null.
BlobHolder thumbnailBlobHolder = cs.convert(ThumbnailConstants.THUMBNAIL_CONVERTER_NAME,
blobHolder, null /*no params*/);
if (thumbnailBlobHolder != null && thumbnailBlobHolder.getBlob() != null) {
// Give the thumbnail blob a name.
String thumbnailName = documentId + ThumbnailConstants.THUMBNAIL_PROPERTY_NAME;
thumbnailBlobHolder.getBlob().setFilename(thumbnailName); // Give it a name so we can manually search for it in the "nuxeo" database
-
+
doc.setProperty(ThumbnailConstants.THUMBNAIL_SCHEMA_NAME,
ThumbnailConstants.THUMBNAIL_FILENAME_PROPERTY_NAME,
(Serializable) thumbnailName);
// Save the new Thumnail facet data (including the new thumbnail image). The save triggers a new create event and recurses us back to
// this method, but the next time we'll have a Thumbnail facet and bypass this save -sparing us from an infinite event loop.
//
- doc = session.saveDocument(doc);
+ doc = session.saveDocument(doc);
} else {
logger.warn("Could not create a preview thumbnail image for Nuxeo blob document: " + doc.getId());
}
logger.warn(errMsg, e);
}
}
-
+
private String computeDigest(FileManager fileManager, Blob blob) throws Exception {
String result = null;
-
+
// Compute the digest
// result = fileManager.computeDigest(blob); // REM - Warning: Why is this operation so slow?
result = blob.getDigest();
-
+
return result;
}
-
+
private String ensureModificationDateExists(DocumentModel docModel) throws Exception {
Calendar modificationDate = (Calendar)doc.getProperty("dublincore", "modified");
if (modificationDate == null) {
}
doc.setProperty("dublincore", "modified", modificationDate);
}
-
+
return modificationDate.toString();
}
-
+
public Thumbnail getAdapter() {
return thumbnail;
}
-
+
}
import java.io.Serializable;
import java.util.Map;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.nuxeo.ecm.core.api.Blob;
import org.nuxeo.ecm.core.api.blobholder.BlobHolder;
import org.nuxeo.ecm.core.api.impl.blob.FileBlob;
//import org.nuxeo.runtime.services.streaming.FileSource;
//import org.nuxeo.runtime.services.streaming.StreamSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class ThumbnailConverter extends IMImageUtils implements Converter {
- private static final Log logger = LogFactory.getLog(ThumbnailConverter.class);
+ private static final Logger logger = LoggerFactory.getLogger(ThumbnailConverter.class);
@Override
public BlobHolder convert(BlobHolder blobHolder,
// StreamSource source = streamingBlob.getStreamSource();
// inputFile = ((FileSource) source).getFile();
// }
-
+
if (inputFile == null) {
logger.error("Blob from blob holder was null.");
return null; // Add a log message here
<groupId>org.nuxeo.ecm.platform</groupId>
<artifactId>nuxeo-platform-ws-sun-jaxws</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<spring.security.version>4.1.1.RELEASE</spring.security.version>
<spring.security.oauth2.version>2.0.10.RELEASE</spring.security.oauth2.version>
<aspectj.version>1.7.4</aspectj.version>
+ <log4j.version>2.12.0</log4j.version>
</properties>
<distributionManagement>
<dependencyManagement>
<dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.1</version>
- <scope>test</scope>
- </dependency>
+ <!-- Ensure transitive dependencies on slf4j and log4j libraries all use the same version. -->
+ <!-- These jars are all provided, in services/common/lib/slf4j. -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.6.1</version>
+ <version>1.7.21</version>
+ <scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.6.1</version>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <version>${log4j.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ <version>${log4j.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>${log4j.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- commons-logging is provided by jcl-over-slf4j, in services/common/lib/slf4j. -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <!-- End of logging dependencies. -->
+ <dependency>
+ <groupId>ch.elca.el4j.modules</groupId>
+ <artifactId>module-xml_merge-common</artifactId>
+ <version>3.1</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.1</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.1.1</version>
- <!-- <version>5.6</version> -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.nuxeo.ecm.core</groupId>
<artifactId>nuxeo-core</artifactId>
<version>${nuxeo.core.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.nuxeo.ecm.core</groupId>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
</exclusion>
- <!-- <exclusion>
- <artifactId>jboss-remoting</artifactId>
- <groupId>jboss</groupId>
- </exclusion> -->
</exclusions>
</dependency>
<dependency>
<groupId>org.nuxeo.ecm.core</groupId>
<artifactId>nuxeo-core-storage-sql</artifactId>
<version>${nuxeo.core.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.nuxeo.ecm.core</groupId>
<artifactId>jersey-servlet</artifactId>
<groupId>com.sun.jersey</groupId>
</exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionObject dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<version>6.6.1</version>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- <scope>provided</scope>
- </dependency>
- <!-- somewhere dependency is added 1.6.1 unnecessarily -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.6.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <version>1.6.1</version>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.authorization.service</artifactId>
<version>${project.version}</version>
- <exclusions>
- <exclusion>
- <artifactId>jboss-logging-log4j</artifactId>
- <groupId>org.jboss.logging</groupId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.authorization-mgt.service</artifactId>
<version>${project.version}</version>
<exclusions>
- <exclusion>
- <artifactId>jboss-logging-log4j</artifactId>
- <groupId>org.jboss.logging</groupId>
- </exclusion>
<exclusion>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.authorization-mgt.import</artifactId>
<dependency>
<groupId>org.nuxeo.ecm.core</groupId>
<artifactId>nuxeo-core</artifactId>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.nuxeo.ecm.core</groupId>
-#
-# The default logging level
-#
-log4j.rootLogger=WARN, error, cspace_appender
+log4j.rootLogger=ERROR, stdout
-#
-# The stdout appender
-#
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n
-
-#
-# An appender that shows just ERROR log messsages
-#
-log4j.appender.error=org.apache.log4j.ConsoleAppender
-log4j.appender.error.layout=org.apache.log4j.PatternLayout
-# Pattern to output the caller's file name and line number.
-log4j.appender.error.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n
-log4j.appender.error.Threshold=WARN
-
-#
-# The "cspace_appender" appender - the standout CollectionSpace services log file appender
-#
-log4j.appender.cspace_appender=org.apache.log4j.RollingFileAppender
-log4j.appender.cspace_appender.File=${catalina.base}/logs/cspace-services.log
-log4j.appender.cspace_appender.MaxFileSize=5000KB
-# Keep ten backup files
-log4j.appender.cspace_appender.MaxBackupIndex=10
-log4j.appender.cspace_appender.layout=org.apache.log4j.PatternLayout
-log4j.appender.cspace_appender.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n
-
-#
-# CollectionSpace Services Performance appender
-#
-log4j.appender.cspace_perf_appender=org.apache.log4j.RollingFileAppender
-log4j.appender.cspace_perf_appender.File=${catalina.base}/logs/cspace-services-perf.log
-log4j.appender.cspace_perf_appender.MaxFileSize=5000KB
-# Keep ten backup files
-log4j.appender.cspace_perf_appender.MaxBackupIndex=10
-log4j.appender.cspace_perf_appender.layout=org.apache.log4j.PatternLayout
-log4j.appender.cspace_perf_appender.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n
-
-#
-# This logger uses the "cspace_perf_appender" appender to log performance profiling information.
-#
-log4j.logger.perf.collectionspace=WARN, cspace_perf_appender, stdout
-# send the logs only to our appender -no inheritence.
-log4j.additivity.perf.collectionspace=false
-
-#
-# CollectionSpace loggers and default levels - all loggers using the rootLogger if not otherwise specified
-#
-log4j.logger.org.collectionspace=DEBUG
-#log4j.logger.org.collectionspace.services.common.query.nuxeo.QueryManagerNuxeoImpl=TRACE
-log4j.logger.org.collectionspace.services.authorization.spring.SpringPermissionManager=ERROR
-log4j.logger.org.collectionspace.services.listener.AbstractUpdateObjectLocationValues=INFO
-log4j.logger.org.collectionspace.services.common.context.AbstractServiceContextImpl=ERROR
-log4j.logger.org.collectionspace.services.common.ServiceMain=INFO
-log4j.logger.org.collectionspace.authentication.realm.db.CSpaceDbRealm=ERROR
-log4j.logger.org.collectionspace.services.nuxeo.client.java.CoreSessionWrapper=ERROR
-log4j.logger.org.collectionspace.services.nuxeo.client.java.NuxeoConnectorEmbedded=ERROR
-log4j.logger.org.collectionspace.services.common.authorization_mgt.AuthorizationCommon=ERROR
-log4j.logger.org.collectionspace.services.nuxeo.client.java.TenantRepository=ERROR
-log4j.logger.org.collectionspace.services.common.init=ERROR
-log4j.logger.org.collectionspace.services.common.config.ServiceConfigUtils=ERROR
-log4j.logger.org.collectionspace.services.report.nuxeo.ReportPostInitHandler=ERROR
-log4j.logger.org.collectionspace.services.client.AbstractServiceClientImpl=ERROR
-#log4j.logger.org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl=ERROR
-log4j.logger.org.collectionspace.services.common.security.SecurityInterceptor=ERROR
-#log4j.logger.org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl=DEBUG
-#log4j.logger.org.collectionspace.services.nuxeo.client.java=ERROR
-log4j.logger.org.collectionspace.services.common.storage.JDBCTools=ERROR
-#log4j.logger.org.collectionspace.services.common.profile.CSpaceFilter=ERROR
-
-#log4j.logger.org.collectionspace.services.common.vocabulary.nuxeo=TRACE
-
-#
-# Nuxeo loggers, levels, and associated appenders
-#
-log4j.logger.org.nuxeo=WARN
-log4j.logger.org.nuxeo.elasticsearch=INFO
-#log4j.logger.org.nuxeo.ecm.core.storage.sql=TRACE
-
-#
-# Misc loggers, levels
-#
-log4j.logger.org.apache=WARN
-log4j.logger.httpclient=WARN
-log4j.logger.org.jboss.resteasy=ERROR
-log4j.logger.org.apache.catalina.core=WARN
-log4j.logger.org.springframework=ERROR
-log4j.logger.org.springframework.security=ERROR
-log4j.logger.org.jboss.security=ERROR
-log4j.logger.org.apache.catalina.realm=ERROR
-log4j.logger.org.hibernate=ERROR
-log4j.logger.ch.elca.el4j.services.xmlmerge=WARN
-log4j.logger.net.sf.jmimemagic.MagicParser=WARN
-log4j.logger.com.mchange.v2.resourcepool.BasicResourcePool=ERROR
-
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration status="WARN">
+ <Appenders>
+ <Console name="ConsoleAppender" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d %-5p [%t] [%c:%L] %m%n" />
+ </Console>
+ </Appenders>
+
+ <Loggers>
+ <Root level="ERROR">
+ <AppenderRef ref="ConsoleAppender"/>
+ </Root>
+
+ <Logger name="org.collectionspace" level="DEBUG" additivity="false">
+ <AppenderRef ref="ConsoleAppender" />
+ </Logger>
+
+ <Logger name="org.collectionspace.services.authorization.spring.SpringPermissionManager" level="ERROR" />
+ <Logger name="org.collectionspace.services.listener.AbstractUpdateObjectLocationValues" level="INFO" />
+ <Logger name="org.collectionspace.services.common.context.AbstractServiceContextImpl" level="ERROR" />
+ <Logger name="org.collectionspace.services.common.ServiceMain" level="INFO" />
+ <Logger name="org.collectionspace.authentication.realm.db.CSpaceDbRealm" level="ERROR" />
+ <Logger name="org.collectionspace.services.nuxeo.client.java.CoreSessionWrapper" level="ERROR" />
+ <Logger name="org.collectionspace.services.nuxeo.client.java.NuxeoConnectorEmbedded" level="ERROR" />
+ <Logger name="org.collectionspace.services.common.authorization_mgt.AuthorizationCommon" level="ERROR" />
+ <Logger name="org.collectionspace.services.nuxeo.client.java.TenantRepository" level="ERROR" />
+ <Logger name="org.collectionspace.services.common.init" level="ERROR" />
+ <Logger name="org.collectionspace.services.common.config.ServiceConfigUtils" level="ERROR" />
+ <Logger name="org.collectionspace.services.report.nuxeo.ReportPostInitHandler" level="ERROR" />
+ <Logger name="org.collectionspace.services.client.AbstractServiceClientImpl" level="ERROR" />
+ <Logger name="org.collectionspace.services.common.security.SecurityInterceptor" level="ERROR" />
+ <Logger name="org.collectionspace.services.common.storage.JDBCTools" level="ERROR" />
+
+ <Logger name="org.nuxeo" level="WARN" />
+ <Logger name="org.nuxeo.elasticsearch" level="INFO" />
+
+ <Logger name="org.apache" level="WARN" />
+ <Logger name="httpclient" level="WARN" />
+ <Logger name="org.jboss.resteasy" level="ERROR" />
+ <Logger name="org.apache.catalina.core" level="WARN" />
+ <Logger name="org.springframework" level="ERROR" />
+ <Logger name="org.springframework.security" level="ERROR" />
+ <Logger name="org.jboss.security" level="ERROR" />
+ <Logger name="org.apache.catalina.realm" level="ERROR" />
+ <Logger name="org.hibernate" level="ERROR" />
+ <Logger name="ch.elca.el4j.services.xmlmerge" level="WARN" />
+ <Logger name="net.sf.jmimemagic.MagicParser" level="WARN" />
+ <Logger name="com.mchange.v2.resourcepool.BasicResourcePool" level="ERROR" />
+ </Loggers>
+</Configuration>
<name>services.PerformanceTests</name>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.account.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.account.jaxb</artifactId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
-
<!-- CollectionSpace Dependencies -->
<dependency>
<artifactId>commons-beanutils</artifactId>
<version>1.6.1</version>
</dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- </dependency>
<!-- javax -->
/**
*
- * @author
+ * @author
*/
public class TenantDocumentHandler
extends JpaDocumentHandler<Tenant, TenantsList, Tenant, List> {
- private final Logger logger = LoggerFactory.getLogger(AccountDocumentHandler.class);
+ private final Logger logger = LoggerFactory.getLogger(TenantDocumentHandler.class);
private Tenant tenant;
private TenantsList tenantList;
// If marked as metadata immutable, do not do update
merge(tenantReceived, tenantFound);
}
-
+
/**
* merge manually merges the from account to the to account
* -this method is created due to inefficiency of JPA EM merge
/**
*
- * @author
+ * @author
*/
public class TenantValidatorHandler implements ValidatorHandler {
- final Logger logger = LoggerFactory.getLogger(AccountValidatorHandler.class);
+ final Logger logger = LoggerFactory.getLogger(TenantValidatorHandler.class);
@Override
public void validate(Action action, ServiceContext ctx)
<packaging>jar</packaging>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace Dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.collectionspace.services.authentication.client</artifactId>
<name>services.authentication.client</name>
-
+
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
</build>
</project>
-
</properties>
<dependencies>
-
- <!-- slf4j not available due to classloading issues running in system classpath -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.2.1</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- <scope>provided</scope>
- </dependency>
<!-- utilities -->
<dependency>
<groupId>junit</groupId>
<version>1.0.01</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- <version>3.1.4.GA</version>
- </dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<packaging>pom</packaging>
<dependencies>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-jexl</artifactId>
<!-- Utilities -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-jexl</artifactId>
@SuppressWarnings("rawtypes")
public class AuthorityServiceUtils {
- private static final Logger logger = LoggerFactory.getLogger(AuthorityIdentifierUtils.class);
+ private static final Logger logger = LoggerFactory.getLogger(AuthorityServiceUtils.class);
//
// Used to keep track if an authority item's is deprecated
public static final String DEFAULT_REMOTECLIENT_CONFIG_NAME = "default";
public static final String IS_DEPRECATED_PROPERTY = "IS_DEPRECATED_PROPERTY";
public static final Boolean DEPRECATED = true;
public static final Boolean NOT_DEPRECATED = !DEPRECATED;
-
+
// Used to keep track if an authority item's rev number should be updated
public static final String SHOULD_UPDATE_REV_PROPERTY = "SHOULD_UPDATE_REV_PROPERTY";
public static final boolean UPDATE_REV = true;
/*
* Try to find a named remote client configuration in the current tenant bindings. If the value of the incoming param 'remoteClientConfigName' is
* blank or null, we'll try to find a name in the authority service's bindings. If we can't find a name there, we'll try using the default name.
- *
+ *
* If the incoming param 'remoteClientConfigName' is not null, we'll look through all the named remote client configurations in the tenant's binding
* to find the configuration. If we can't find the named configuration, we'll throw an exception.
- *
+ *
* If there are no remote client configurations in the tenant's bindings, we'll throw an exception.
*/
public static final RemoteClientConfig getRemoteClientConfig(ServiceContext ctx, String remoteClientConfigName) throws Exception {
RemoteClientConfig result = null;
-
+
TenantBindingType tenantBinding = ServiceMain.getInstance().getTenantBindingConfigReader().getTenantBinding(ctx.getTenantId());
RemoteClientConfigurations remoteClientConfigurations = tenantBinding.getRemoteClientConfigurations();
if (remoteClientConfigurations != null) {
if (Tools.isEmpty(remoteClientConfigName) == true) {
remoteClientConfigName = DEFAULT_REMOTECLIENT_CONFIG_NAME;
}
-
+
List<RemoteClientConfig> remoteClientConfigList = remoteClientConfigurations.getRemoteClientConfig();
for (RemoteClientConfig config : remoteClientConfigList) {
if (config.getName().equalsIgnoreCase(remoteClientConfigName)) {
logger.error(errMsg);
throw new Exception(errMsg);
}
-
+
if (result == null) {
String errMsg = String.format("Could not find a remote client configuration named '%s' in the tenant bindings for tenant named '%s'",
remoteClientConfigName, ctx.getTenantName());
logger.error(errMsg);
throw new Exception(errMsg);
}
-
+
return result;
}
-
+
/**
* Make a request to the SAS Server for an authority payload.
- *
+ *
* @param ctx
* @param specifier
* @param responseType
*/
static public PoxPayloadIn requestPayloadInFromRemoteServer(ServiceContext ctx, String remoteClientConfigName, Specifier specifier, Class responseType) throws Exception {
PoxPayloadIn result = null;
-
+
RemoteClientConfig remoteClientConfig = getRemoteClientConfig(ctx, remoteClientConfigName);
AuthorityClient client = (AuthorityClient) ctx.getClient(remoteClientConfig);
-
+
Response res = client.read(specifier.getURNValue());
try {
int statusCode = res.getStatus();
if (statusCode == org.apache.commons.httpclient.HttpStatus.SC_OK) {
- result = new PoxPayloadIn((String)res.readEntity(responseType)); // Get the entire response!
+ result = new PoxPayloadIn((String)res.readEntity(responseType)); // Get the entire response!
} else {
String errMsg = String.format("Could not retrieve authority information for '%s' on remote server '%s'. Server returned status code %d",
specifier.getURNValue(), remoteClientConfig.getUrl(), statusCode);
} finally {
res.close();
}
-
+
return result;
}
-
+
//
// Makes a call to the remote SAS server for a authority item payload
- //
+ //
static public PoxPayloadIn requestPayloadInFromRemoteServer(
- AuthorityItemSpecifier specifier,
- String remoteClientConfigName,
- String serviceName,
- Class responseType,
+ AuthorityItemSpecifier specifier,
+ String remoteClientConfigName,
+ String serviceName,
+ Class responseType,
boolean syncHierarchicalRelationships) throws Exception {
PoxPayloadIn result = null;
-
+
ServiceContext authorityCtx = new MultipartServiceContextImpl(serviceName);
RemoteClientConfig remoteClientConfig = getRemoteClientConfig(authorityCtx, remoteClientConfigName);
AuthorityClient client = (AuthorityClient) authorityCtx.getClient(remoteClientConfig);
Response res = client.readItem(specifier.getParentSpecifier().getURNValue(), specifier.getItemSpecifier().getURNValue(),
AuthorityClient.INCLUDE_DELETED_ITEMS, syncHierarchicalRelationships);
-
+
try {
int statusCode = res.getStatus();
if (statusCode == org.apache.commons.httpclient.HttpStatus.SC_OK) {
logger.debug(errMsg);
}
throw new DocumentException(statusCode, errMsg);
- }
+ }
} finally {
res.close();
}
-
+
return result;
}
-
+
static public boolean setAuthorityItemDeprecated(ServiceContext ctx,
DocumentModel docModel, String authorityItemCommonSchemaName, Boolean flag) throws Exception {
boolean result = false;
-
+
docModel.setProperty(authorityItemCommonSchemaName, AuthorityItemJAXBSchema.DEPRECATED,
new Boolean(flag));
CoreSessionInterface repoSession = (CoreSessionInterface) ctx.getCurrentRepositorySession();
repoSession.saveDocument(docModel);
result = true;
-
+
return result;
}
-
+
/*
* The domain name part of refnames on SAS may not match that of local refnames, so we need to update all the payload's
* refnames with the correct domain name
PoxPayloadIn payload) throws org.dom4j.DocumentException {
PoxPayloadIn result = null;
-
+
String payloadStr = payload.getXmlPayload();
Pattern p = Pattern.compile("(urn:cspace:)(([a-z]{1,}\\.?)*)"); // matches the domain name part of a RefName. For example, matches "core.collectionspace.org" of RefName urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(BigBird1461101206103)'Big Bird'
Matcher m = p.matcher(payloadStr);
return result;
}
-
+
/**
* Mark the authority item as deprecated.
- *
+ *
* @param ctx
* @param itemInfo
* @throws Exception
*/
static public boolean markAuthorityItemAsDeprecated(ServiceContext ctx, String authorityItemCommonSchemaName, AuthorityItemSpecifier authorityItemSpecifier) throws Exception {
boolean result = false;
-
+
try {
DocumentModel docModel = NuxeoUtils.getDocFromSpecifier(ctx, (CoreSessionInterface)ctx.getCurrentRepositorySession(),
authorityItemCommonSchemaName, authorityItemSpecifier);
logger.warn(String.format("Could not mark item '%s' as deprecated.", authorityItemSpecifier.getItemSpecifier().getURNValue()), e);
throw e;
}
-
+
return result;
}
-}
\ No newline at end of file
+}
<name>services.authorization-common</name>
<packaging>jar</packaging>
<dependencies>
-
+
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.hyperjaxb</artifactId>
<version>${project.version}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.config</artifactId>
<version>${project.version}</version>
</dependency>
<!-- 3rd Pary dependencies -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
</dependencies>
</project>
-
<name>services.authorization-mgt.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.authentication.service</artifactId>
</properties>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<dependency>
<groupId>ch.elca.el4j.modules</groupId>
<artifactId>module-xml_merge-common</artifactId>
- <version>3.1</version>
- <exclusions>
- <exclusion>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<!-- utilities -->
- <!-- slf4j not available due to classloading issues running in system classpath
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- <scope>provided</scope>
- </dependency> -->
-
- <!-- slf4j used for testing only -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<!-- jboss -->
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <version>2.1.0.GA</version>
- </dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jbosssx</artifactId>
<!-- utilities -->
- <!-- slf4j not available due to classloading issues running in system classpath -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- slf4j used for testing only -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<!-- jboss -->
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- <version>3.1.4.GA</version>
- </dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jbosssx</artifactId>
import java.util.HashSet;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.collectionspace.authentication.AuthN;
import org.collectionspace.authentication.CSpaceTenant;
import org.collectionspace.authentication.CSpaceUser;
import org.collectionspace.services.authorization.perms.ActionType;
import org.collectionspace.services.authorization.spi.CSpaceAuthorizationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
/**
* AuthZ is the authorization service singleton used by the services runtime
- * @author
+ * @author
*/
public class AuthZ {
*/
private static volatile AuthZ self = new AuthZ();
private CSpaceAuthorizationProvider provider;
- final Log logger = LogFactory.getLog(AuthZ.class);
+ final Logger logger = LoggerFactory.getLogger(AuthZ.class);
private AuthZ() {
setupProvider();
public final static AuthZ get() {
return self;
}
-
+
public static String getMethod(ActionType actionType) {
String result = null;
-
+
switch (actionType) {
case CREATE:
result = "POST";
throw new RuntimeException(String.format("Encountered unexpected action type '%s'.",
actionType.value()));
}
-
+
return result;
}
-
+
private void setupProvider() {
String beanConfig = "applicationContext-authorization.xml";
//system property is only set in test environment
} catch (Throwable t) {
provider.rollbackTransaction(status);
throw t;
- }
+ }
}
/**
*/
public void deletePermissionsFromRoles(CSpaceResource[] resources, String[] principals) // FIXME: # Can tx move one level up?
throws PermissionNotFoundException, PermissionException {
-
+
TransactionStatus status = provider.beginTransaction("deletePermssions");
try {
for (CSpaceResource res : resources) {
public boolean isAccessAllowed(CSpaceResource res, CSpaceAction action) {
return provider.getPermissionEvaluator().hasPermission(res, action);
}
-
+
//
// Login as the admin of no specific tenant
//
public void login() {
String user = AuthN.SPRING_ADMIN_USER;
String password = AuthN.SPRING_ADMIN_PASSWORD;
-
+
HashSet<GrantedAuthority> gauths = new HashSet<GrantedAuthority>();
gauths.add(new SimpleGrantedAuthority(AuthN.ROLE_SPRING_ADMIN_NAME)); //NOTE: Must match with value in applicationContext-authorization-test.xml (aka SPRING_SECURITY_METADATA));
-
+
Authentication authRequest = new UsernamePasswordAuthenticationToken(user, password, gauths);
SecurityContextHolder.getContext().setAuthentication(authRequest);
if (logger.isDebugEnabled()) {
logger.debug("Spring Security login successful for user=" + user);
}
}
-
+
//
// Login as the admin for a specific tenant
//
public void login(CSpaceTenant tenant) {
String user = AuthN.SPRING_ADMIN_USER;
String password = AuthN.SPRING_ADMIN_PASSWORD;
-
+
HashSet<GrantedAuthority> grantedAuthorities = new HashSet<GrantedAuthority>();
grantedAuthorities.add(new SimpleGrantedAuthority(AuthN.ROLE_SPRING_ADMIN_NAME));
-
+
HashSet<CSpaceTenant> tenantSet = new HashSet<CSpaceTenant>();
tenantSet.add(tenant);
CSpaceUser principal = new CSpaceUser(user, password, null, tenantSet, grantedAuthorities);
-
+
Authentication authRequest = new UsernamePasswordAuthenticationToken(principal, password, grantedAuthorities);
SecurityContextHolder.getContext().setAuthentication(authRequest);
if (logger.isDebugEnabled()) {
package org.collectionspace.services.authorization.spring;
import java.util.ArrayList;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.collectionspace.services.authorization.CSpaceAction;
import org.collectionspace.services.authorization.CSpaceResource;
import org.collectionspace.services.authorization.spi.CSpaceAuthorizationProvider;
import org.collectionspace.services.authorization.spi.CSpacePermissionEvaluator;
import org.collectionspace.services.authorization.spi.CSpacePermissionManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.security.access.PermissionEvaluator;
/**
* SpringAuthorizationProvider Spring Security provider
- * @author
+ * @author
*/
public class SpringAuthorizationProvider implements CSpaceAuthorizationProvider {
- final Log log = LogFactory.getLog(SpringAuthorizationProvider.class);
+ final Logger log = LoggerFactory.getLogger(SpringAuthorizationProvider.class);
@Autowired
private MutableAclService providerAclService;
@Autowired
import java.util.List;
import java.io.Serializable;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.collectionspace.services.authorization.CSpaceAction;
import org.collectionspace.services.authorization.spi.CSpacePermissionEvaluator;
import org.collectionspace.services.authorization.CSpaceResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.security.access.PermissionEvaluator;
import org.springframework.security.acls.model.Permission;
import org.springframework.security.core.Authentication;
/**
* SpringPermissionEvaluator evaluates permissions in Spring Security
- * @author
+ * @author
*/
public class SpringPermissionEvaluator implements CSpacePermissionEvaluator {
- final Log log = LogFactory.getLog(SpringPermissionEvaluator.class); //FIXEME: REM - Use SLF4J interfaces instead of directly using Apache Commons Logging.
+ final Logger log = LoggerFactory.getLogger(SpringPermissionEvaluator.class);
private SpringAuthorizationProvider provider;
SpringPermissionEvaluator(SpringAuthorizationProvider provider) {
@Override
public boolean hasPermission(CSpaceResource res, CSpaceAction action) {
boolean result = false;
-
+
try {
Permission perm = SpringAuthorizationProvider.getPermission(action);
Authentication authToken = SecurityContextHolder.getContext().getAuthentication();
Serializable objectIdId = SpringAuthorizationProvider.getObjectIdentityIdentifier(res);
String objectIdType = SpringAuthorizationProvider.getObjectIdentityType(res);
PermissionEvaluator eval = provider.getProviderPermissionEvaluator();
-
+
debug(res, authToken, objectIdId, objectIdType, perm);
result = eval.hasPermission(authToken,
objectIdId, objectIdType, perm);
}
log.error("Unexpected exception encountered while evaluating permissions.", e);
}
-
+
return result;
}
-
+
private void debug(CSpaceResource res,
Authentication authToken,
Serializable objectIdId,
System.out.println("");
}
}
-
+
public static boolean exceptionChainContainsNetworkError(Throwable exceptionChain) {
boolean result = false;
Throwable cause = exceptionChain;
result = true;
break;
}
-
+
cause = cause.getCause();
}
return result;
}
-
+
private static boolean isCauseNetworkRelated(Throwable cause) {
boolean result = false;
return result;
}
-
+
}
import java.util.Iterator;
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.collectionspace.services.authorization.CSpaceAction;
import org.collectionspace.services.authorization.spi.CSpacePermissionManager;
import org.collectionspace.services.authorization.CSpaceResource;
import org.collectionspace.services.authorization.PermissionException;
import org.collectionspace.services.authorization.PermissionNotFoundException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.springframework.security.acls.model.AccessControlEntry;
import org.springframework.security.acls.model.AclDataAccessException;
import org.springframework.security.acls.model.AlreadyExistsException;
/**
* Manages permissions in Spring Security
- * @author
+ * @author
*/
public class SpringPermissionManager implements CSpacePermissionManager {
- final Log log = LogFactory.getLog(SpringPermissionManager.class);
+ final Logger log = LoggerFactory.getLogger(SpringPermissionManager.class);
private SpringAuthorizationProvider provider;
SpringPermissionManager(SpringAuthorizationProvider provider) {
@Override
public void deletePermissions(CSpaceResource res, CSpaceAction action)
throws PermissionNotFoundException, PermissionException {
-
+
ObjectIdentity oid = SpringAuthorizationProvider.getObjectIdentity(res);
Permission p = SpringAuthorizationProvider.getPermission(action);
try {
}
acl = provider.getProviderAclService().createAcl(oid);
}
- // Need to see if there is already an entry, so we do not duplicate (e.g.,
+ // Need to see if there is already an entry, so we do not duplicate (e.g.,
// when we run our permission-roles init more than once.
List<AccessControlEntry> aceEntries = acl.getEntries();
if (aceListHasEntry(aceEntries, permission, sid, grant)) {
+ " sid=" + sid.toString()
+ " grant=" + grant);
}
-
+
} else {
acl.insertAce(acl.getEntries().size(), permission, sid, grant);
provider.getProviderAclService().updateAcl(acl);
}
}
}
-
+
private boolean aceListHasEntry(List<AccessControlEntry> aceEntries, Permission permission,
Sid sid, boolean grant) {
for(AccessControlEntry entry : aceEntries) {
}
i++;
}
-
+
boolean updateNeeded = false;
for (int j = foundAces.size() - 1; j >= 0; j--) {
//the following operation does not work while iterating in the while loop
acl.deleteAce(foundAces.get(j)); //autobox
updateNeeded = true;
}
-
+
if (updateNeeded) {
provider.getProviderAclService().updateAcl(acl);
}
<name>services.batch.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<dependencies>
<dependency>
- <groupId>org.nuxeo.ecm.core</groupId>
- <artifactId>nuxeo-core-storage-sql-management</artifactId>
- <version>${nuxeo.general.release}</version>
+ <groupId>org.nuxeo.ecm.core</groupId>
+ <artifactId>nuxeo-core-storage-sql-management</artifactId>
+ <version>${nuxeo.general.release}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.citation.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6.1</version>
</dependency>
- <!-- use explict 1.1 version to prevent errors coming from Nuxeo client -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- </dependency>
<!-- javax -->
<name>services.claim.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
-
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
</dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- <version>3.1.4.GA</version>
- <scope>runtime</scope>
- </dependency>
<!-- Set TestNG scope to default (compile), rather than test -->
<!-- to allow import(s) in AbstractServiceTest class -->
<dependency>
*
* @param <PT> the generic type
*/
-public abstract class PoxPayload<PT extends PayloadPart> {
-
+public abstract class PoxPayload<PT extends PayloadPart> {
+
/** The Constant logger. */
- protected static final Logger logger = LoggerFactory.getLogger(PayloadPart.class);
-
+ protected static final Logger logger = LoggerFactory.getLogger(PoxPayload.class);
+
/** String constant for JAX-B root element labels */
public static final String DOCUMENT_ROOT_ELEMENT_LABEL = "document";
public static final String ABSTRACT_COMMON_LIST_ROOT_ELEMENT_LABEL = "abstract-common-list";
-
+
/** The xml text. */
private String xmlPayload;
-
+
protected Document domDocument;
-
+
/** The payload name. */
private String payloadName;
-
+
// The list of POX parts contained in the xmlText payload
/** The parts. */
private List<PT> parts = new ArrayList<PT>();
-
+
// Valid root element labels
- private static Set<String> validRootElementLabels = new HashSet<String>(Arrays.asList(DOCUMENT_ROOT_ELEMENT_LABEL,
+ private static Set<String> validRootElementLabels = new HashSet<String>(Arrays.asList(DOCUMENT_ROOT_ELEMENT_LABEL,
ABSTRACT_COMMON_LIST_ROOT_ELEMENT_LABEL));
-
+
/**
* Instantiates a new pox payload.
*/
protected PoxPayload() {
//empty
}
-
+
final protected void setPayloadName(String name) {
this.payloadName = name;
}
-
+
/**
* Returns a list of valid root element labels for payloads.
- *
+ *
* @return
*/
public Set<String> getValidRootElementLables() {
return validRootElementLabels;
}
-
+
private void setDomDocument(Document dom) throws DocumentException {
this.domDocument = dom;
String label = domDocument.getRootElement().getName().toLowerCase();
}
parseParts();
}
-
+
/**
* Creates and returns an XML string representation of ourself.
*
Document document = createDOMFromParts();
result = document.asXML();
-
+
if (logger.isTraceEnabled() == true) {
logger.trace("\n\n<<<< Payload : BEGIN <<<<\n" + result + "\n<<<< Payload : END <<<<\n");
}
-
+
return result;
}
-
+
protected Document createDOMFromParts() {
Document result = null;
-
+
Document document = DocumentHelper.createDocument();
document.setXMLEncoding("UTF-8");
document.setName(getName());
Element root = document.addElement( "document" );
- root.addAttribute("name", getName());
-
+ root.addAttribute("name", getName());
+
Iterator<PT> it = getParts().iterator();
while (it.hasNext() == true) {
PT outPart = it.next();
- Element element = outPart.asElement();
+ Element element = outPart.asElement();
if (element != null) {
root.add(element.detach());
} else {
}
}
result = document;
-
+
return result;
}
-
+
/**
* Instantiates a new PoxPayload by parsing the payload into a DOM4j
* Document instance
Document dom = reader.read(new StringReader(xmlPayload));
setDomDocument(dom);
}
-
+
/**
* Instantiates a new payload, saves the original xml, creates a DOM and parses it into parts
*
SAXReader reader = new SAXReader();
Document dom = reader.read(file);
setDomDocument(dom);
- }
-
+ }
+
/**
* Creates the part -either an PayloadOutputPart or a PayloadInputPart
*
* @return the pT
*/
abstract protected PT createPart(String label, Object jaxbObject, Element element);
-
+
/**
* Creates the part -either an PayloadOutputPart or a PayloadInputPart
*
* @param element the DOM4j element
* @return the pT
*/
- abstract protected PT createPart(String label, Element element);
-
+ abstract protected PT createPart(String label, Element element);
+
/**
* Parse the DOM object into schema parts.
*
while (it.hasNext() == true) {
Element element = (Element) it.next();
String label = element.getName();
- Object jaxbObject = PoxPayload.toObject(element);
+ Object jaxbObject = PoxPayload.toObject(element);
if (jaxbObject != null) {
payloadPart = createPart(label, jaxbObject, element);
} else {
}
}
}
-
+
/**
* Gets the name of the payload.
*
public String getName() {
return payloadName;
}
-
+
/**
* Gets the DOM object that we created at init time. This should never be null;
*
public Document getDOMDocument() {
return this.domDocument;
}
-
+
/**
* Gets the xml text.
*
public String getXmlPayload() {
return xmlPayload;
}
-
+
/**
* Gets the POX part with name match 'label'.
*
}
return result;
}
-
+
public List<PT> getParts(String label) {
List<PT> result = new ArrayList<PT>();
if (parts != null) {
}
}
}
-
+
return result;
- }
-
+ }
+
/**
* Gets a list of the POX parts.
*
public List<PT> getParts() {
return parts;
}
-
+
/**
* Set a new set of parts.
- *
+ *
* @param newParts
*/
public void setParts(ArrayList<PT> newParts) {
this.parts = newParts;
}
-
+
/**
* Adds a POX part to the list of existing parts with the label 'label'.
*
parts.add(entity);
return entity;
}
-
+
/**
* Adds a POX part -assuming the part already has a label name.
*
parts.add(entity);
return entity;
}
-
+
/**
* Removes a POX part from our list of parts
* @param entity
public void removePart(PT entity) {
parts.remove(entity);
}
-
+
/**
* Gets the Java package name from the specified namespace. This method
* assumes the Namespace is a xjc (JAXB compiler) generate namespace from
String namespaceURI = namespace.getURI();
return nc.toPackageName(namespaceURI);
}
-
+
/**
* Attempts to unmarshal a DOM4j element (for a part) into an instance of a JAXB object
*
public static Object toObject(Element elementInput) {
Object result = null;
try {
- Namespace namespace = elementInput.getNamespace();
+ Namespace namespace = elementInput.getNamespace();
String thePackage = getPackage(namespace);
JAXBContext jc = JAXBContext.newInstance(thePackage);
Unmarshaller um = jc.createUnmarshaller();
result = um.unmarshal(
- new StreamSource(new StringReader(elementInput.asXML())));
+ new StreamSource(new StringReader(elementInput.asXML())));
} catch (Exception e) {
- String msg = String.format("Could not unmarshal XML payload '%s' into a JAXB object.",
+ String msg = String.format("Could not unmarshal XML payload '%s' into a JAXB object.",
elementInput.getName());
logger.warn(msg);
}
-
+
return result;
}
-
+
/**
* Attempts to unmarshal a JAXB object (for a part) to a DOM4j element.
*
jaxbObject.toString());
logger.error(msg);
}
-
+
return result;
}
-
+
/**
* Attempts to unmarshal a JAXB object (for a part) to a DOM4j element.
*
Document doc = DocumentHelper.parseText(xmlPayload);
result = doc.getRootElement(); //FIXME: REM - .detach();
return result;
- }
-
-
+ }
+
+
}
<name>services.collectionobject.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6.1</version>
</dependency>
- <!-- use explict 1.1 version to prevent errors coming from Nuxeo client -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- </dependency>
<!-- javax -->
<dependency>
<artifactId>name-parser-api</artifactId>
<version>3.1</version>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
-
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
</dependencies>
</project>
-
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
-
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.jaxb</artifactId>
<version>1.0.7</version>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-jexl</artifactId>
<dependency>
<groupId>ch.elca.el4j.modules</groupId>
<artifactId>module-xml_merge-common</artifactId>
- <version>3.1</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
*
* Contributors:
* Thomas Roger
-
+
package org.nuxeo.ecm.platform.picture.extension;
import java.util.List;
import java.util.Map;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.nuxeo.common.utils.IdUtils;
import org.nuxeo.ecm.core.api.Blob;
import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.platform.picture.api.ImagingDocumentConstants;
import org.nuxeo.ecm.platform.picture.api.adapters.PictureResourceAdapter;
import org.nuxeo.ecm.platform.types.TypeManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ImagePlugin extends AbstractFileImporter {
private static final long serialVersionUID = 5850210255138418118L;
- private static final Log log = LogFactory.getLog(ImagePlugin.class);
+ private static final Logger logger = LoggerFactory.getLogger(ImagePlugin.class);
public DocumentModel create(CoreSession documentManager, Blob content,
String path, boolean overwrite, String fullname,
}
}
-*/
\ No newline at end of file
+*/
@SuppressWarnings("rawtypes")
public class JPATransactionContext extends TransactionContext {
/** The logger. */
- private final Logger logger = LoggerFactory.getLogger(TransactionContext.class);
+ private final Logger logger = LoggerFactory.getLogger(JPATransactionContext.class);
private int transactionRefCount = 0;
private boolean aclTablesUpdatedFlag = false;
-
+
EntityManagerFactory emf;
EntityManager em;
-
+
public JPATransactionContext(ServiceContext ctx) {
- emf = JpaStorageUtils.getEntityManagerFactory();
+ emf = JpaStorageUtils.getEntityManagerFactory();
em = emf.createEntityManager();
this.ctx = ctx;
}
-
+
public JPATransactionContext() {
- emf = JpaStorageUtils.getEntityManagerFactory();
+ emf = JpaStorageUtils.getEntityManagerFactory();
em = emf.createEntityManager();
- }
+ }
protected EntityManagerFactory getEntityManagerFactory() {
return emf;
}
-
+
protected EntityManager getEntityManager() {
return em;
}
-
+
/**
* Set to 'true' if (and only if) a change has been made AND successfully committed to the Spring Security tables.
- *
+ *
* Since we can't include Spring Security table changes and JPA changes in a single transaction, we
* keep track of changes to the Spring Security tables here. We'll use this flag to log a critical error if
* we think there is a chance the JPA tables and Spring Security tables get out of sync.
- *
+ *
* @param flag
*/
public void setAclTablesUpdateFlag(boolean flag) {
aclTablesUpdatedFlag = flag;
}
-
+
protected boolean getAclTablesUpdateFlag() {
return aclTablesUpdatedFlag;
- }
-
+ }
+
@Override
public ServiceContext getServiceContext() {
return ctx;
}
-
+
@Override
public void markForRollback() {
if (em.getTransaction().isActive() == true) {
logger.warn(msg);
}
}
-
+
@Override
public void close() throws TransactionException {
if (em.getTransaction().isActive() == true && em.getTransaction().getRollbackOnly() == true) {
close(); // NOTE: Recursive call.
throw new JPATransactionException("There was an active transaction. You must commit the active transaction prior to calling this close method.");
}
-
+
em.close();
- JpaStorageUtils.releaseEntityManagerFactory(emf);
+ JpaStorageUtils.releaseEntityManagerFactory(emf);
}
-
+
private String handleInconsistentState() throws InconsistentStateException {
//
// If we've modified the Spring Tables and need to rollback this JPA transaction, we now have a potentially critical inconsistent state in the system
em.getTransaction().rollback();
em.close();
JpaStorageUtils.releaseEntityManagerFactory(emf);
-
+
return msg;
}
}
transactionRefCount++;
}
-
+
@Override
public void persist(Object entity) {
em.persist(entity);
}
-
+
@Override
public Object merge(Object entity) {
return em.merge(entity);
}
-
+
@SuppressWarnings("unchecked")
@Override
public Object find(Class entityClass, Object primaryKey) {
return em.find(entityClass, primaryKey);
}
-
+
@SuppressWarnings("unchecked")
@Override
public Object find(Class entityClass, String id) {
return em.find(entityClass, id);
}
-
+
@Override
public Query createQuery(String qlString) {
return em.createQuery(qlString);
}
-
+
@Override
public void remove(Object entity) {
em.remove(entity);
}
-
+
@Override
public boolean isTransactionActive() {
return em.getTransaction().isActive();
}
-
+
@Override
public void flush() {
em.flush();
/*
* (C) Copyright 2012 Nuxeo SA (http://nuxeo.com/) and others.
- *
+ *
* This code was moved into CollectionSpace to be compatible with the
* Nuxeo 6.0-HF21 jar files. The original code can be found on
- *
+ *
* GitHub.com here: https://github.com/nuxeo/nuxeo-reindex-fulltext
*
* Licensed under the Apache License, Version 2.0 (the "License");
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.nuxeo.ecm.core.api.AbstractSession;
import org.nuxeo.ecm.core.api.CoreSession;
import org.nuxeo.ecm.core.api.IterableQueryResult;
import org.nuxeo.ecm.webengine.jaxrs.session.SessionFactory;
import org.nuxeo.runtime.api.Framework;
import org.nuxeo.runtime.transaction.TransactionHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* JAX-RS component used to do fulltext reindexing of the whole database.
@Path("reindexFulltext")
public class ReindexFulltextRoot {
- public static Log log = LogFactory.getLog(ReindexFulltextRoot.class);
+ public static Logger log = LoggerFactory.getLogger(ReindexFulltextRoot.class);
protected static final String DC_TITLE = "dc:title";
* @param batch if present, the batch number to process instead of all
* batches; starts at 1
* @return when done, ok + the total number of docs
- * @throws StorageException
+ * @throws StorageException
*/
public String reindexFulltext(int batchSize, int batch, String query) throws NuxeoException {
Principal principal = coreSession.getPrincipal();
if (batchSize <= 0) {
batchSize = DEFAULT_BATCH_SIZE;
}
-
+
//
// A default query that gets ALL the documents
//
/**
* This has to be called once the transaction has been started.
- * @throws StorageException
+ * @throws StorageException
*/
protected void getLowLevelSession() throws NuxeoException {
try {
<name>services.concept.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6.1</version>
</dependency>
- <!-- use explict 1.1 version to prevent errors coming from Nuxeo client -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- </dependency>
<!-- javax -->
<name>services.conditioncheck.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
-
<dependency>
<groupId>ch.elca.el4j.modules</groupId>
<artifactId>module-xml_merge-common</artifactId>
- <version>3.1</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<name>services.conservation.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.contact.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.dimension.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.dimension</name>
<packaging>pom</packaging>
- <dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- </dependencies>
-
<modules>
<module>jaxb</module>
<module>service</module>
<module>3rdparty</module>
<module>client</module>
</modules>
-
-</project>
+</project>
<name>services.exhibition.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.group.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<!--
pom.xml
-
+
A Maven 2 project file for the ID Service project.
This document is a part of the source code and related artifacts
for CollectionSpace, an open source collections management system
for museums and related institutions:
-
+
http://www.collectionspace.org
http://wiki.collectionspace.org
-
+
$LastChangedRevision: 302 $
$LastChangedDate: 2009-06-29 15:36:29 -0700 (Mon, 29 Jun 2009) $
-->
<artifactId>org.collectionspace.services.main</artifactId>
<version>${revision}</version>
</parent>
-
+
<modelVersion>4.0.0</modelVersion>
<artifactId>org.collectionspace.services.id</artifactId>
<name>services.id</name>
<packaging>pom</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
+
<modules>
<!--module>3rdparty</module-->
<!--module>jaxb</module-->
</modules>
</project>
-
-
<version>${nuxeo.shell.version}</version>
</dependency>
<dependency>
- <groupId>org.nuxeo.ecm.platform</groupId>
- <artifactId>nuxeo-importer-core</artifactId>
- <version>${nuxeo.platform.version}</version>
+ <groupId>org.nuxeo.ecm.platform</groupId>
+ <artifactId>nuxeo-importer-core</artifactId>
+ <version>${nuxeo.platform.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.nuxeo.ecm.platform</groupId>
@Produces({ "application/xml" })
@Consumes({ "application/xml" })
public class ImportsResource extends AbstractCollectionSpaceResourceImpl<PoxPayloadIn, PoxPayloadOut> {
-
- private final static Logger logger = LoggerFactory.getLogger(TemplateExpander.class);
+
+ private final static Logger logger = LoggerFactory.getLogger(ImportsResource.class);
public static final String SERVICE_NAME = "imports";
public static final String SERVICE_PATH = "/" + SERVICE_NAME;
* ASSUMPTION: All Nuxeo services of a given tenancy store their stuff in
* a repository domain, under a "Workspaces" space within that domain.
* (See http://doc.nuxeo.com/display/USERDOC/Document+Management+concepts)
- *
+ *
* Using the tenant associated with the currently authenticated user, this
* method returns a delimited path to the Workspaces space for that tenancy.
*/
if (repositoryDomainList.size() == 1) {
String domainName = repositoryDomainList.get(0).getStorageName()
.trim();
- result = NUXEO_SPACES_PATH_DELIMITER + domainName
+ result = NUXEO_SPACES_PATH_DELIMITER + domainName
+ NUXEO_SPACES_PATH_DELIMITER + NuxeoUtils.Workspaces;
} else {
// Currently, the Imports service places all documents
}
return result;
}
-
+
private static String getRepoName() throws ConfigurationException {
String repoName = null;
List<RepositoryDomainType> repositoryDomainList = getRepositoryDomainList();
}
return repoName;
}
-
+
private static List<RepositoryDomainType> getRepositoryDomainList() throws ConfigurationException {
TenantBindingConfigReaderImpl tReader = ServiceMain.getInstance()
.getTenantBindingConfigReader();
.getRepositoryDomain();
return repositoryDomainList;
}
-
+
@Override
public String getServiceName() {
_templateDir = tReader.getResourcesDir() + File.separator
+ "templates";
}
-
+
File templateDir = new File(_templateDir); // We need to make sure the 'templates' directory is not missing
if (templateDir.exists() == false) {
throw new FileNotFoundException("The Import service's template directory is missing: " + _templateDir);
String xmlPayload) {
String result = null;
ResponseBuilder rb = Response.serverError(); // Assume we'll fail to successfully fulfill the request.
-
+
try {
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(ui);
int timeout = ctx.getTimeoutSecs(); // gets it from query param 'impTimout' or uses default if no query param specified
-
+
// InputSource inputSource = payloadToInputSource(xmlPayload);
// result = createFromInputSource(inputSource);
String inputFilename = payloadToFilename(xmlPayload);
result = e.getMessage();
logger.error(result);
}
-
+
return rb.build();
}
/**
* Encodes each ampersand ('&') in the incoming XML payload by replacing it
* with the predefined XML entity for an ampersand ('&').
- *
+ *
* This is a workaround for the issue described in CSPACE-3911. Its intended
* effect is to have these added ampersand XML entities being resolved to
* 'bare' ampersands during the initial parse, thus preserving any XML
* entities in the payload, which will then be resolved correctly during the
* second parse.
- *
+ *
* (This is not designed to compensate for instances where the incoming XML
* payload contains 'bare' ampersands - that is, used in any other context
* than as the initial characters in XML entities. In those cases, the
* payload may not be a legal XML document.)
- *
+ *
* @param xmlPayload
* @return The original XML payload, with each ampersand replaced by the
* predefined XML entity for an ampersand.
/**
* This method may be called statically from outside this class; there is a
* test call in org.collectionspace.services.test.ImportsServiceTest
- *
+ *
* @param inputSource
* A wrapper around a request file, either a local file or a
* stream; the file has a specific format, you can look at:
@Context HttpServletRequest req, MultipartFormDataInput partFormData) {
Response response = null;
StringBuffer resultBuf = new StringBuffer();
-
+
try {
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(ui);
int timeout = ctx.getTimeoutSecs(); // gets it from query param 'impTimout' or uses default if no query param specified
-
+
InputStream fileStream = null;
String preamble = partFormData.getPreamble();
logger.trace("Preamble type is:" + preamble);
-
+
Map<String, List<InputPart>> partsMap = partFormData.getFormDataMap();
List<InputPart> fileParts = partsMap.get("file");
for (InputPart part : fileParts) {
continue;
}
}
-
+
Response.ResponseBuilder rb = Response.ok();
rb.entity(resultBuf.toString());
response = rb.build();
} catch (Exception e) {
throw bigReThrow(e, ServiceMessages.CREATE_FAILED);
}
-
+
return response;
}
<name>services.index.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.intake.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.loanin.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.loanout.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.location.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6.1</version>
</dependency>
- <!-- use explict 1.1 version to prevent errors coming from Nuxeo client -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- </dependency>
<!-- javax -->
<name>services.material.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6.1</version>
</dependency>
- <!-- use explict 1.1 version to prevent errors coming from Nuxeo client -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- </dependency>
<!-- javax -->
<name>services.media.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.movement.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.note.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.objectexit.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.organization.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6.1</version>
</dependency>
- <!-- use explict 1.1 version to prevent errors coming from Nuxeo client -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- </dependency>
<!-- javax -->
<name>services.osteology.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.person.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6.1</version>
</dependency>
- <!-- use explict 1.1 version to prevent errors coming from Nuxeo client -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- </dependency>
<!-- javax -->
<name>services.place.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6.1</version>
</dependency>
- <!-- use explict 1.1 version to prevent errors coming from Nuxeo client -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- </dependency>
<!-- javax -->
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ </dependency>
</dependencies>
- <repositories></repositories>
-
- <pluginRepositories>
- </pluginRepositories>
-
<build>
<pluginManagement>
<plugins>
<name>services.pottag.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.propagation.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.publicitem.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.query.service</name>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.common</artifactId>
<artifactId>commons-beanutils</artifactId>
<version>1.6.1</version>
</dependency>
- <!-- use explict 1.1 version to prevent errors coming from Nuxeo client -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- </dependency>
-
<!-- RESTEasy -->
<dependency>
<name>services.relation.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.report.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.security.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.servicegroup.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.structureddate.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
-
<!-- CollectionSpace dependencies -->
<dependency>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<name>services.systeminfo.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
-
<!-- CollectionSpace dependencies -->
<dependency>
<name>services.taxonomy.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6.1</version>
</dependency>
- <!-- use explict 1.1 version to prevent errors coming from Nuxeo client -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- </dependency>
<!-- javax -->
<name>services.uoc.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.valuationcontrol.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<name>services.vocabulary.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6.1</version>
</dependency>
- <!-- use explict 1.1 version to prevent errors coming from Nuxeo client -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- </dependency>
<!-- javax -->
<name>services.work.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6.1</version>
</dependency>
- <!-- use explict 1.1 version to prevent errors coming from Nuxeo client -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- </dependency>
<!-- javax -->
<name>services.workflow.client</name>
<dependencies>
- <!-- keep slf4j dependencies on the top -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>