customMappingsToSave)
@@ -315,13 +348,13 @@ public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean impleme
properties.put(ContentModel.PROP_NAME, CONFIG_NAME);
properties.put(ContentModel.PROP_NODE_UUID, CONFIG_NODE_REF.getId());
nodeService.createNode(
- CONFIG_FOLDER_NODE_REF,
- ContentModel.ASSOC_CONTAINS,
- QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, CONFIG_NAME),
- ContentModel.TYPE_CONTENT,
+ CONFIG_FOLDER_NODE_REF,
+ ContentModel.ASSOC_CONTAINS,
+ QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, CONFIG_NAME),
+ ContentModel.TYPE_CONTENT,
properties);
}
-
+
// build JSON array of mappings
JSONArray jsonMappings = new JSONArray();
try
@@ -338,14 +371,14 @@ public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean impleme
{
throw new AlfrescoRuntimeException("Unable to create JSON email mapping configuration during save.", je);
}
-
+
// update the content
ContentWriter writer = this.contentService.getWriter(CONFIG_NODE_REF, ContentModel.PROP_CONTENT, true);
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.setEncoding("UTF-8");
- writer.putContent(jsonMappings.toString());
+ writer.putContent(jsonMappings.toString());
}
-
+
/**
* @see org.springframework.extensions.surf.util.AbstractLifecycleBean#onBootstrap(org.springframework.context.ApplicationEvent)
*/
@@ -373,10 +406,10 @@ public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean impleme
{
logger.warn(e.getMessage());
}
-
+
// reset the mappings
customMappings = null;
-
+
// rethrow
throw e;
}
@@ -384,7 +417,7 @@ public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean impleme
}
};
transactionService.getRetryingTransactionHelper().doInTransaction(callback);
-
+
return null;
}
}, AuthenticationUtil.getSystemUserName());
@@ -398,13 +431,13 @@ public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean impleme
{
// No implementation
}
-
+
/**
* Helper method to get the old configuration node. This is used during the migration
* from 1.0 to 2.0.
*
* Returns null if it does not exist.
- *
+ *
* @return {@link NodeRef} node reference of the old configuration node, null otherwise
*/
private NodeRef getOldConfigNode()
@@ -412,24 +445,24 @@ public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean impleme
NodeRef rootNode = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
return nodeService.getChildByName(rootNode, RecordsManagementModel.ASSOC_EMAIL_CONFIG, CONFIG_NAME);
}
-
+
/**
* Reads the old configuration node. This is used during the migration from 1.0 to 2.0.
- *
+ *
* @param nodeRef the old configuration node reference
* @return {@link Set}<{@link CustomMapping}> set of the custom mappings stored in the old configuration
*/
private Set readOldConfig(NodeRef nodeRef)
{
Set newMappings = new HashSet();
-
+
ContentReader cr = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
if (cr != null)
{
String text = cr.getContentString();
-
+
try
- {
+ {
JSONArray jsonArray = new JSONArray(new JSONTokener(text));
for(int i = 0 ; i < jsonArray.length(); i++)
{
@@ -446,8 +479,8 @@ public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean impleme
logger.warn("unable to read custom email configuration", je);
return newMappings;
}
-
+
}
return newMappings;
- }
+ }
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomisableEmailMappingKeyBootstrap.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomisableEmailMappingKeyBootstrap.java
index a543c70674..79a218ec3e 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomisableEmailMappingKeyBootstrap.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomisableEmailMappingKeyBootstrap.java
@@ -31,8 +31,8 @@ public class CustomisableEmailMappingKeyBootstrap
/** List of mappings to register as customisable */
private List customisable;
- /** Email mapping key service */
- private EmailMappingKeyService emailMappingKeyService;
+ /** Custom email mapping service */
+ private CustomEmailMappingService customEmailMappingService;
/**
* @param customizable list of mappings to register as customisable
@@ -43,13 +43,13 @@ public class CustomisableEmailMappingKeyBootstrap
}
/**
- * Email mapping key service
+ * Custom email mapping service
*
- * @param emailMappingKeyService the email mapping key service
+ * @param customEmailMappingService the custom email mapping service
*/
- public void setEmailMappingKeyService(EmailMappingKeyService emailMappingKeyService)
+ public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService)
{
- this.emailMappingKeyService = emailMappingKeyService;
+ this.customEmailMappingService = customEmailMappingService;
}
/**
@@ -59,7 +59,7 @@ public class CustomisableEmailMappingKeyBootstrap
{
for (String customEmailMappingKey : customisable)
{
- emailMappingKeyService.makeCustomisable(customEmailMappingKey);
+ customEmailMappingService.registerEMailMappingKey(customEmailMappingKey);
}
}
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/EmailMappingKeyService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/EmailMappingKeyService.java
deleted file mode 100644
index 0a63ddfcfe..0000000000
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/EmailMappingKeyService.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2005-2012 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.module.org_alfresco_module_rm.email;
-
-import java.util.List;
-
-/**
- * EMail Mapping Key Service
- *
- * @author Tuna Aksoy
- * @since @2.1
- */
-public interface EmailMappingKeyService
-{
- /**
- * Gets the list of email mapping keys
- *
- * @return Email mapping keys
- */
- public List getEmailMappingKeys();
-
- /**
- * Makes a email mapping key customisable.
- *
- * @param emailMappingKey emailMappingKey to make customisable
- */
- public void makeCustomisable(String emailMappingKey);
-}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/EmailMappingKeyServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/EmailMappingKeyServiceImpl.java
deleted file mode 100644
index 2a56189945..0000000000
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/EmailMappingKeyServiceImpl.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2005-2012 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.module.org_alfresco_module_rm.email;
-
-import java.util.List;
-
-import org.alfresco.util.ParameterCheck;
-
-/**
- * EMail Mapping Key Service
- *
- * @author Tuna Aksoy
- * @since 2.1
- */
-public class EmailMappingKeyServiceImpl implements EmailMappingKeyService
-{
- List emailMappingKeys;
-
- public void setEmailMappingKeys(List emailMappingKeys)
- {
- this.emailMappingKeys = emailMappingKeys;
- }
-
- /**
- * @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#getEmailMappingKeys()
- */
- @Override
- public List getEmailMappingKeys()
- {
- return emailMappingKeys;
- }
-
- /**
- * @see org.alfresco.module.org_alfresco_module_rm.email.EmailMappingKeyService#makeCustomisable(java.lang.String)
- */
- @Override
- public void makeCustomisable(String emailMappingKey)
- {
- ParameterCheck.mandatoryString("emailMappingKey", emailMappingKey);
-
- emailMappingKeys.add(emailMappingKey);
- }
-}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapKeysGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapKeysGet.java
index c1831c972f..a7c2069ae5 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapKeysGet.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapKeysGet.java
@@ -21,7 +21,7 @@ package org.alfresco.module.org_alfresco_module_rm.script;
import java.util.HashMap;
import java.util.Map;
-import org.alfresco.module.org_alfresco_module_rm.email.EmailMappingKeyService;
+import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
@@ -35,17 +35,17 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
*/
public class EmailMapKeysGet extends DeclarativeWebScript
{
- /** Email mapping key service */
- private EmailMappingKeyService emailMappingKeyService;
+ /** Custom email mapping service */
+ private CustomEmailMappingService customEmailMappingService;
/**
- * Email mapping key service
+ * Custom email mapping service
*
- * @param emailMappingKeyService the email mapping key service
+ * @param customEmailMappingService the custom email mapping service
*/
- public void setEmailMappingKeyService(EmailMappingKeyService emailMappingKeyService)
+ public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService)
{
- this.emailMappingKeyService = emailMappingKeyService;
+ this.customEmailMappingService = customEmailMappingService;
}
@Override
@@ -53,7 +53,7 @@ public class EmailMapKeysGet extends DeclarativeWebScript
{
// Create model object with the lists of email mapping keys
Map model = new HashMap(1);
- model.put("emailmapkeys", emailMappingKeyService.getEmailMappingKeys());
+ model.put("emailmapkeys", customEmailMappingService.getEmailMappingKeys());
return model;
}
}