diff --git a/config/alfresco/application-context.xml b/config/alfresco/application-context.xml index 3a7c42d3ba..58739f596a 100644 --- a/config/alfresco/application-context.xml +++ b/config/alfresco/application-context.xml @@ -47,6 +47,7 @@ + diff --git a/config/alfresco/form-services-context.xml b/config/alfresco/form-services-context.xml new file mode 100644 index 0000000000..2c784063b6 --- /dev/null +++ b/config/alfresco/form-services-context.xml @@ -0,0 +1,43 @@ + + + + + + + + + org.alfresco.repo.forms.FormService + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/java/org/alfresco/repo/forms/AssociationFieldDefiniton.java b/source/java/org/alfresco/repo/forms/AssociationFieldDefiniton.java new file mode 100644 index 0000000000..c4f6f526fa --- /dev/null +++ b/source/java/org/alfresco/repo/forms/AssociationFieldDefiniton.java @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2005-2008 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.repo.forms; + +/** + * An association field definition. + * + * @author Gavin Cornwell + */ +public class AssociationFieldDefiniton extends FieldDefinition +{ + // + // TODO: Think about bi-directional association support, + // should we instead model as endpointType etc. + // and have a 'direction' flag, that would then allow + // form clients to display source objects not just + // target objects + // + + protected String targetType; + protected String targetRole; + protected boolean targetMandatory; + protected boolean targetMany; + + // TODO: This may not even be needed for forms, what difference does it make!? + protected boolean childAssociation; + + /** + * Constructs an AssociationFieldDefinition + * + * @param name The name of the property + * @param label The display label of the property + * @param description The description of the property + * @param dataType The data type of the property + * @param defaultValue Default value of the property + * @param binding Binding of the property + * @param protectedField Whether the property should be read only + * @param mandatory Whether the property is mandatory + * @param repeats Whether the property can contain multiple values + * @param group The group the property belongs to + * @param targetMandatory Whether a target is mandatory + * @param targetMany Whether there can be multiple targets + * @param targetType The type of the target + * @param childAssociation Whether the association is a child association + */ + // TODO: Look at the Builder pattern to reduce the size of the constructor!! + public AssociationFieldDefiniton(String name, String label, String description, + String defaultValue, String binding, boolean protectedField, + FieldGroup group, boolean targetMandatory, boolean targetMany, + String targetRole, String targetType, boolean childAssociation) + { + this.name = name; + this.label = label; + this.description = description; + this.defaultValue = defaultValue; + this.binding = binding; + this.protectedField = protectedField; + this.group = group; + + this.targetMandatory = targetMandatory; + this.targetMany = targetMany; + this.targetType = targetType; + + this.childAssociation = childAssociation; + } + + /** + * Returns the type of the target of the association + * + * @return The type of the target + */ + public String getTargetType() + { + return this.targetType; + } + + /** + * Determines whether the target is mandatory + * + * @return true if a target has to be selected + */ + public boolean isTargetMandatory() + { + return this.targetMandatory; + } + + /** + * Determines if multiple targets can be selected + * + * @return true if multiple targets can be selected + */ + public boolean isTargetMany() + { + return this.targetMany; + } + + /** + * Determines if the association is a child association + * + * @return true if the association is a child association + */ + public boolean isChildAssociation() + { + return this.childAssociation; + } +} diff --git a/source/java/org/alfresco/repo/forms/FieldDefinition.java b/source/java/org/alfresco/repo/forms/FieldDefinition.java new file mode 100644 index 0000000000..5730754307 --- /dev/null +++ b/source/java/org/alfresco/repo/forms/FieldDefinition.java @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2005-2008 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.repo.forms; + +/** + * Abstract representation of a field defintion. + * + * @author Gavin Cornwell + */ +public abstract class FieldDefinition +{ + protected String name; + protected String label; + protected String description; + protected String binding; + protected String defaultValue; + protected FieldGroup group; + protected boolean protectedField; + + /** + * Returns the name of the field + * + * @return The field's name + */ + public String getName() + { + return this.name; + } + + /** + * Returns the display label for the field + * + * @return The field's display label + */ + public String getLabel() + { + return this.label; + } + + /** + * Returns the description of the field + * + * @return The field's description + */ + public String getDescription() + { + return this.description; + } + + /** + * Returns the binding for the field, this is used by some + * FormModelProcessor implementations to generate an + * alternative representation of the data + * + * @return The field's binding + */ + public String getBinding() + { + return this.binding; + } + + /** + * Returns any default value the field may have + * + * @return The field's default value or null if there isn't one + */ + public String getDefaultValue() + { + return this.defaultValue; + } + + /** + * Returns the group the field may be a part of + * + * @return The field's group or null if it does not belong to a group + */ + public FieldGroup getGroup() + { + return this.group; + } + + /** + * Determines whether the field is protected i.e. it should be rendered + * as read-only in any client displaying the field + * + * @return true if the field is protected + */ + public boolean isProtectedField() + { + return this.protectedField; + } +} diff --git a/source/java/org/alfresco/repo/forms/FieldGroup.java b/source/java/org/alfresco/repo/forms/FieldGroup.java new file mode 100644 index 0000000000..3b4018a3e3 --- /dev/null +++ b/source/java/org/alfresco/repo/forms/FieldGroup.java @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2005-2008 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.repo.forms; + +/** + * Represents a field group + * + * @author Gavin Cornwell + */ +public class FieldGroup +{ + protected String id; + protected String label; + protected FieldGroup parent; + protected boolean repeats; + protected boolean mandatory; + + /** + * Constructs a FieldGroup + * + * @param id The id of the group + * @param label The display label of the group + * @param mandatory Whether the group is mandatory + * @param repeats Whether the group of fields can repeat + * @param parent The group's parent group or null if it + * doesn't have a parent + */ + public FieldGroup(String id, String label, boolean mandatory, + boolean repeats, FieldGroup parent) + { + this.id = id; + this.label = label; + this.mandatory = mandatory; + this.parent = parent; + this.repeats = repeats; + } + + /** + * Returns the id of the group + * + * @return The id of the group + */ + public String getId() + { + return this.id; + } + + /** + * Returns the display label of the group + * + * @return The display label of the group + */ + public String getLabel() + { + return this.label; + } + + /** + * Returns the parent group + * + * @return The parent group or null if there isn't a parent + */ + public FieldGroup getParent() + { + return this.parent; + } + + /** + * Determines whether the fields inside this group can + * repeat multiple times + * + * @return true if the group repeats + */ + public boolean isRepeating() + { + return this.repeats; + } + + /** + * Determines if the group is mandatory + * + * @return true if the group is mandatory + */ + public boolean isMandatory() + { + return this.mandatory; + } +} diff --git a/source/java/org/alfresco/repo/forms/Form.java b/source/java/org/alfresco/repo/forms/Form.java new file mode 100644 index 0000000000..f18f8574bd --- /dev/null +++ b/source/java/org/alfresco/repo/forms/Form.java @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2005-2008 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.repo.forms; + +import java.util.List; +import java.util.Map; + +/** + * Data representation of a form to be displayed in the UI. + * + * @author Gavin Cornwell + */ +public class Form +{ + protected String item; + protected String submissionUrl; + protected String type; + protected List fieldDefinitions; + protected List fieldGroups; + protected Map formData; + + /** + * Constructs a Form + * + * @param item The identifier + * @param submissionUrl Default submission URL + * @param type The type of the item + * @param fieldDefinitions List of fields that could be displayed + * @param fieldGroups List of field groups + * @param formData Map of the form data + */ + public Form(String item, String submissionUrl, String type, + List fieldDefinitions, List fieldGroups, + Map formData) + { + this.fieldDefinitions = fieldDefinitions; + this.fieldGroups = fieldGroups; + this.formData = formData; + this.item = item; + this.submissionUrl = submissionUrl; + this.type = type; + } + + /** + * Returns an identifier for the item the form is for, in the case of a node + * it will be a NodeRef, for a task, a task id etc. + * + * @return The item + */ + public String getItem() + { + return this.item; + } + + /** + * Returns the submission URL to use to post back to this service, acts as a + * default URL for clients to use + * + * @return The default submission URL + */ + public String getSubmissionUrl() + { + return this.submissionUrl; + } + + /** + * Returns the type of the item the form is for, could be a content model type, a + * workflow task type, an XML schema etc. + * + * @return The type of the item + */ + public String getType() + { + return this.type; + } + + /** + * Returns the list of fields appropriate for the item + * + * @return List of FieldDefintion objects or null if there are no fields + */ + public List getFieldDefinitions() + { + return this.fieldDefinitions; + } + + /** + * Returns the list of field groups for the form + * + * @return List of FieldGroup objects or null if there are no groups + */ + public List getFieldGroups() + { + return this.fieldGroups; + } + + /** + * Returns the data to display in the form + * + * @return Map of String objects representing the form data or null if + * there is no data + */ + public Map getFormData() + { + return this.formData; + } +} + + + + + diff --git a/source/java/org/alfresco/repo/forms/FormService.java b/source/java/org/alfresco/repo/forms/FormService.java new file mode 100644 index 0000000000..2e5b25d596 --- /dev/null +++ b/source/java/org/alfresco/repo/forms/FormService.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2005-2008 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.repo.forms; + + +/** + * Form service fundamental API. + *

+ * This service API is designed to support the public facing Form APIs + * + * @author Gavin Cornwell + */ +public interface FormService +{ + /** + * Returns a form representation of the item with the given id + * + * @param id The id of the item to get a form for + * @return The Form representation + */ + public Form getForm(String id); + + /** + * Persists the given form representation for the given id + * + * @param id The id of the item to persist the form for + * @param form The Form representation + */ + public void saveForm(String id, Form form); +} diff --git a/source/java/org/alfresco/repo/forms/FormServiceImpl.java b/source/java/org/alfresco/repo/forms/FormServiceImpl.java new file mode 100644 index 0000000000..5dfa599a2c --- /dev/null +++ b/source/java/org/alfresco/repo/forms/FormServiceImpl.java @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2005-2008 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.repo.forms; + +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.cmr.security.PermissionService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Form Service Implementation. + * + * @author Gavin Cornwell + */ +public class FormServiceImpl implements FormService +{ + /** Logger */ + private static Log logger = LogFactory.getLog(FormServiceImpl.class); + + /** Services */ + private NodeService nodeService; + private FileFolderService fileFolderService; + private SearchService searchService; + private PermissionService permissionService; + + /** + * Set node service + * + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Set file folder service + * + * @param fileFolderService file folder service + */ + public void setFileFolderService(FileFolderService fileFolderService) + { + this.fileFolderService = fileFolderService; + } + + /** + * Set search service + * + * @param searchService search service + */ + public void setSearchService(SearchService searchService) + { + this.searchService = searchService; + } + + /** + * Set permission service + * + * @param permissionService permission service + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + /** + * @see org.alfresco.repo.forms.FormService#getForm(java.lang.String) + */ + public Form getForm(String id) + { + if (logger.isDebugEnabled()) + logger.debug("Retrieving form for item with id: " + id); + + return null; + } + + /* + * @see org.alfresco.repo.forms.FormService#saveForm(java.lang.String, org.alfresco.repo.forms.Form) + */ + public void saveForm(String id, Form form) + { + if (logger.isDebugEnabled()) + logger.debug("Saving form for item with id '" + id + "': " + form); + } +} diff --git a/source/java/org/alfresco/repo/forms/FormServiceImplTest.java b/source/java/org/alfresco/repo/forms/FormServiceImplTest.java new file mode 100644 index 0000000000..1b8070679b --- /dev/null +++ b/source/java/org/alfresco/repo/forms/FormServiceImplTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2005-2008 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.repo.forms; + +import org.alfresco.util.BaseAlfrescoSpringTest; + +/** + * Form service implementation unit test. + * + * @author Gavin Cornwell + */ +public class FormServiceImplTest extends BaseAlfrescoSpringTest +{ + private FormService formService; + + /** + * Called during the transaction setup + */ + protected void onSetUpInTransaction() throws Exception + { + super.onSetUpInTransaction(); + + // Get the required services + this.formService = (FormService)this.applicationContext.getBean("FormService"); + } + + public void testGetForm() throws Exception + { + Form form = this.formService.getForm(""); + assertNull(form); + } + + // == Test the JavaScript API == + +// public void testJSAPI() throws Exception +// { +// ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/forms/script/test_formService.js"); +// this.scriptService.executeScript(location, new HashMap(0)); +// } +} diff --git a/source/java/org/alfresco/repo/forms/PropertyFieldDefiniton.java b/source/java/org/alfresco/repo/forms/PropertyFieldDefiniton.java new file mode 100644 index 0000000000..6b2f24d222 --- /dev/null +++ b/source/java/org/alfresco/repo/forms/PropertyFieldDefiniton.java @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2005-2008 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.repo.forms; + +import java.util.List; +import java.util.Map; + +/** + * A property field definition. + * + * @author Gavin Cornwell + */ +public class PropertyFieldDefiniton extends FieldDefinition +{ + protected String dataType; + protected boolean mandatory; + protected boolean repeats; + protected List constraints; + + /** + * Constructs a FieldDefinition + * + * @param name The name of the property + * @param label The display label of the property + * @param description The description of the property + * @param dataType The data type of the property + * @param defaultValue Default value of the property + * @param binding Binding of the property + * @param protectedField Whether the property should be read only + * @param mandatory Whether the property is mandatory + * @param repeats Whether the property can contain multiple values + * @param group The group the property belongs to + * @param constraints List of constraints the property has + */ + // TODO: Look at the Builder pattern to reduce the size of the constructor!! + public PropertyFieldDefiniton(String name, String label, String description, + String dataType, String defaultValue, String binding, + boolean protectedField, boolean mandatory, boolean repeats, + FieldGroup group, List constraints) + { + this.name = name; + this.label = label; + this.description = description; + this.defaultValue = defaultValue; + this.binding = binding; + this.protectedField = protectedField; + this.group = group; + + this.dataType = dataType; + this.mandatory = mandatory; + this.repeats = repeats; + this.constraints = constraints; + } + + /** + * Returns the dataType for the property, this is a value from the + * Alfresco data dictionary i.e. d:text, d:int etc. + * + * @return The field's data type + */ + public String getDataType() + { + return this.dataType; + } + + /** + * Determines if the property is mandatory + * + * @return true if the field is mandatory + */ + public boolean isMandatory() + { + return this.mandatory; + } + + /** + * Determines if the property can contain multiple values + * + * @return true if the field can contain multiple values + */ + public boolean isRepeating() + { + return this.repeats; + } + + /** + * Returns a list of constraints the property may have + * + * @return List of FieldContstraint objects or null if there are + * no constraints for the field + */ + public List getConstraints() + { + return this.constraints; + } + + /** + * Represents a constraint on a property field + */ + public class FieldConstraint + { + protected String name; + protected Map params; + + /** + * Constructs a FieldConstraint + * + * @param name The name of the constraint + * @param params Map of parameters for the constraint + */ + public FieldConstraint(String name, Map params) + { + super(); + this.name = name; + this.params = params; + } + + /** + * Returns the name of the constraint + * + * @return The constraint name + */ + public String getName() + { + return this.name; + } + + /** + * Returns the parameters for the constraint + * + * @return Map of parameters for the constraint or null if + * there are no parameters + */ + public Map getParams() + { + return this.params; + } + } +} diff --git a/source/java/org/alfresco/repo/service/ServiceDescriptorRegistry.java b/source/java/org/alfresco/repo/service/ServiceDescriptorRegistry.java index 13a2872f7f..eadc8c12ad 100644 --- a/source/java/org/alfresco/repo/service/ServiceDescriptorRegistry.java +++ b/source/java/org/alfresco/repo/service/ServiceDescriptorRegistry.java @@ -27,6 +27,7 @@ package org.alfresco.repo.service; import java.util.Collection; import org.alfresco.mbeans.VirtServerRegistry; +import org.alfresco.repo.forms.FormService; import org.alfresco.repo.site.SiteService; import org.alfresco.repo.transaction.RetryingTransactionHelper; import org.alfresco.service.ServiceRegistry; @@ -458,22 +459,32 @@ public class ServiceDescriptorRegistry /* (non-Javadoc) * @see org.alfresco.service.ServiceRegistry#getDeploymentService() */ - public DeploymentService getDeploymentService() { + public DeploymentService getDeploymentService() + { return (DeploymentService) getService(DEPLOYMENT_SERVICE); - } /* (non-Javadoc) * @see org.alfresco.service.ServiceRegistry#getWebProjectService() */ - public WebProjectService getWebProjectService() { + public WebProjectService getWebProjectService() + { return (WebProjectService)getService(WEBPROJECT_SERVICE); } /* (non-Javadoc) * @see org.alfresco.service.ServiceRegistry#getSandboxService() */ - public SandboxService getSandboxService() { + public SandboxService getSandboxService() + { return (SandboxService)getService(SANDBOX_SERVICE); } + + /* (non-Javadoc) + * @see org.alfresco.service.ServiceRegistry#getFormService() + */ + public FormService getFormService() + { + return (FormService)getService(FORM_SERVICE); + } } diff --git a/source/java/org/alfresco/service/ServiceRegistry.java b/source/java/org/alfresco/service/ServiceRegistry.java index e5343ef4df..8a9bfbd316 100644 --- a/source/java/org/alfresco/service/ServiceRegistry.java +++ b/source/java/org/alfresco/service/ServiceRegistry.java @@ -27,6 +27,7 @@ package org.alfresco.service; import java.util.Collection; import org.alfresco.mbeans.VirtServerRegistry; +import org.alfresco.repo.forms.FormService; import org.alfresco.repo.site.SiteService; import org.alfresco.repo.transaction.RetryingTransactionHelper; import org.alfresco.service.cmr.action.ActionService; @@ -131,6 +132,7 @@ public interface ServiceRegistry static final QName DEPLOYMENT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "DeploymentService"); static final QName WEBPROJECT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "WebProjectService"); static final QName SANDBOX_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "SandboxService"); + static final QName FORM_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FormService"); /** * Get the list of services provided by the Repository @@ -438,4 +440,11 @@ public interface ServiceRegistry */ @NotAuditable SandboxService getSandboxService(); + + /** + * Get the form service (or null if one is not provided) + * @return + */ + @NotAuditable + FormService getFormService(); }