mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-30 18:15:39 +00:00
Updated the Workflow Rest API classes to use the getter methods on various Workflow DTOs instead of accessing the public fields.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21565 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
98b8f24cf2
commit
9f315acff6
@ -20,8 +20,9 @@
|
|||||||
package org.alfresco.repo.forms;
|
package org.alfresco.repo.forms;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface definition of a field
|
* Interface defining a field in a {@link Form}.
|
||||||
*
|
*
|
||||||
|
* @since 3.4
|
||||||
* @author Nick Smith
|
* @author Nick Smith
|
||||||
*/
|
*/
|
||||||
public interface Field
|
public interface Field
|
||||||
|
@ -165,7 +165,7 @@ public abstract class FilteredFormProcessor<ItemType, PersistType> extends Abstr
|
|||||||
formItem.setUrl(getItemURI(item));
|
formItem.setUrl(getItemURI(item));
|
||||||
|
|
||||||
Object itemData = makeItemData(item);
|
Object itemData = makeItemData(item);
|
||||||
FormCreationData data = new FormCreationData(itemData, forcedFields, context);
|
FormCreationData data = new FormCreationDataImpl(itemData, forcedFields, context);
|
||||||
populateForm(form, fields, data);
|
populateForm(form, fields, data);
|
||||||
if (log.isDebugEnabled()) //
|
if (log.isDebugEnabled()) //
|
||||||
log.debug("Generated form: " + form);
|
log.debug("Generated form: " + form);
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
package org.alfresco.repo.forms.processor;
|
package org.alfresco.repo.forms.processor;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,46 +32,21 @@ import java.util.Map;
|
|||||||
* @since 3.4
|
* @since 3.4
|
||||||
* @author Nick Smith
|
* @author Nick Smith
|
||||||
*/
|
*/
|
||||||
public class FormCreationData
|
public interface FormCreationData
|
||||||
{
|
{
|
||||||
private final Object itemData;
|
|
||||||
private final List<String> forcedFields;
|
|
||||||
private final Map<String, Object> context;
|
|
||||||
|
|
||||||
public FormCreationData(Object itemData,
|
|
||||||
List<String> forcedFields,
|
|
||||||
Map<String, Object> context)
|
|
||||||
{
|
|
||||||
this.itemData = itemData;
|
|
||||||
this.forcedFields = forcedFields;
|
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the itemData
|
* @return the itemData
|
||||||
*/
|
*/
|
||||||
public Object getItemData()
|
Object getItemData();
|
||||||
{
|
|
||||||
return itemData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return If the <code>fieldName</code> given is a forced field then
|
* @return If the <code>fieldName</code> given is a forced field then
|
||||||
* returns <code>true</code>, otherwise returns <code>false</code>.
|
* returns <code>true</code>, otherwise returns <code>false</code>.
|
||||||
*/
|
*/
|
||||||
public boolean isForcedField(String fieldName)
|
boolean isForcedField(String fieldName);
|
||||||
{
|
|
||||||
if (forcedFields == null)
|
|
||||||
return false;
|
|
||||||
return forcedFields.contains(fieldName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the context
|
* @return the context
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> getContext()
|
Map<String, Object> getContext();
|
||||||
{
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2010 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.repo.forms.processor;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 3.4
|
||||||
|
* @author Nick Smith
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface FormCreationData
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the itemData
|
||||||
|
*/
|
||||||
|
public abstract Object getItemData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return If the <code>fieldName</code> given is a forced field then
|
||||||
|
* returns <code>true</code>, otherwise returns <code>false</code>.
|
||||||
|
*/
|
||||||
|
public abstract boolean isForcedField(String fieldName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the context
|
||||||
|
*/
|
||||||
|
public abstract Map<String, Object> getContext();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2009 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.processor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple DTO containing various objects needed to generate Forms.
|
||||||
|
*
|
||||||
|
* @since 3.4
|
||||||
|
* @author Nick Smith
|
||||||
|
*/
|
||||||
|
public class FormCreationDataImpl implements FormCreationData
|
||||||
|
{
|
||||||
|
private final Object itemData;
|
||||||
|
private final List<String> forcedFields;
|
||||||
|
private final Map<String, Object> context;
|
||||||
|
|
||||||
|
public FormCreationDataImpl(Object itemData, List<String> forcedFields, Map<String, Object> context)
|
||||||
|
{
|
||||||
|
this.itemData = itemData;
|
||||||
|
this.forcedFields = forcedFields;
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.alfresco.repo.forms.processor.FormCreationData#getItemData()
|
||||||
|
*/
|
||||||
|
public Object getItemData()
|
||||||
|
{
|
||||||
|
return itemData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* org.alfresco.repo.forms.processor.FormCreationData#isForcedField(java
|
||||||
|
* .lang.String)
|
||||||
|
*/
|
||||||
|
public boolean isForcedField(String fieldName)
|
||||||
|
{
|
||||||
|
if (forcedFields == null)
|
||||||
|
return false;
|
||||||
|
return forcedFields.contains(fieldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.alfresco.repo.forms.processor.FormCreationData#getContext()
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getContext()
|
||||||
|
{
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
}
|
@ -33,6 +33,7 @@ import org.alfresco.repo.forms.Field;
|
|||||||
import org.alfresco.repo.forms.PropertyFieldDefinition;
|
import org.alfresco.repo.forms.PropertyFieldDefinition;
|
||||||
import org.alfresco.repo.forms.AssociationFieldDefinition.Direction;
|
import org.alfresco.repo.forms.AssociationFieldDefinition.Direction;
|
||||||
import org.alfresco.repo.forms.processor.FormCreationData;
|
import org.alfresco.repo.forms.processor.FormCreationData;
|
||||||
|
import org.alfresco.repo.forms.processor.FormCreationDataImpl;
|
||||||
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
|
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
@ -132,7 +133,7 @@ public class FieldProcessorTest extends TestCase
|
|||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
namespaceService = makeNamespaceService();
|
namespaceService = makeNamespaceService();
|
||||||
data = new FormCreationData(makeItemData(), null, null);
|
data = new FormCreationDataImpl(makeItemData(), null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemData<Void> makeItemData()
|
private ItemData<Void> makeItemData()
|
||||||
|
@ -144,7 +144,7 @@ public class TaskFormPersister extends ContentModelFormPersister<WorkflowTask>
|
|||||||
{
|
{
|
||||||
return updater.update();
|
return updater.update();
|
||||||
}
|
}
|
||||||
else if(transitionId.isEmpty())
|
else if(transitionId.length()==0)
|
||||||
{
|
{
|
||||||
return updater.transition();
|
return updater.transition();
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ public class TypedPropertyValueGetter
|
|||||||
|
|
||||||
// make sure empty strings stay as empty strings, everything else
|
// make sure empty strings stay as empty strings, everything else
|
||||||
// should be represented as null
|
// should be represented as null
|
||||||
if(valStr.isEmpty() && !isTextProperty(propDef))
|
if(valStr.length()==0 && !isTextProperty(propDef))
|
||||||
{
|
{
|
||||||
// Do nothing, leave typedValue as null.
|
// Do nothing, leave typedValue as null.
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ import org.apache.commons.logging.Log;
|
|||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporary FormProcessor implementation that can generate and persist
|
* FormProcessor implementation that can generate and persist
|
||||||
* Form objects for workflow definitions.
|
* Form objects for workflow definitions.
|
||||||
*
|
*
|
||||||
*@since 3.4
|
*@since 3.4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user