Made Email mapping keys customisable

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@44190 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2012-11-30 11:54:54 +00:00
parent b65d0e0d31
commit 0f7197eb25
9 changed files with 541 additions and 209 deletions

View File

@@ -0,0 +1,65 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.email;
import java.util.List;
/**
* Bootstrap bean that indicates that the specified mappings are customisable
*
* @author Tuna Aksoy
* @since 2.1
*/
public class CustomisableEmailMappingKeyBootstrap
{
/** List of mappings to register as customisable */
private List<String> customisable;
/** Email mapping key service */
private EmailMappingKeyService emailMappingKeyService;
/**
* @param customizable list of mappings to register as customisable
*/
public void setCustomisable(List<String> customisable)
{
this.customisable = customisable;
}
/**
* Email mapping key service
*
* @param emailMappingKeyService the email mapping key service
*/
public void setEmailMappingKeyService(EmailMappingKeyService emailMappingKeyService)
{
this.emailMappingKeyService = emailMappingKeyService;
}
/**
* Bean initialisation method
*/
public void init()
{
for (String customEmailMappingKey : customisable)
{
emailMappingKeyService.makeCustomisable(customEmailMappingKey);
}
}
}

View File

@@ -0,0 +1,44 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
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<String> getEmailMappingKeys();
/**
* Makes a email mapping key customisable.
*
* @param emailMappingKey emailMappingKey to make customisable
*/
public void makeCustomisable(String emailMappingKey);
}

View File

@@ -0,0 +1,59 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
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<String> emailMappingKeys;
public void setEmailMappingKeys(List<String> emailMappingKeys)
{
this.emailMappingKeys = emailMappingKeys;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#getEmailMappingKeys()
*/
@Override
public List<String> 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);
}
}

View File

@@ -0,0 +1,59 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
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.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;
/**
* Implementation for Java backed webscript to return email mapping keys
*
* @author Tuna Aksoy
* @since 2.1
*/
public class EmailMapKeysGet extends DeclarativeWebScript
{
/** Email mapping key service */
private EmailMappingKeyService emailMappingKeyService;
/**
* Email mapping key service
*
* @param emailMappingKeyService the email mapping key service
*/
public void setEmailMappingKeyService(EmailMappingKeyService emailMappingKeyService)
{
this.emailMappingKeyService = emailMappingKeyService;
}
@Override
public Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
// Create model object with the lists of email mapping keys
Map<String, Object> model = new HashMap<String, Object>(1);
model.put("emailmapkeys", emailMappingKeyService.getEmailMappingKeys());
return model;
}
}