Merged V2.1 to HEAD

6817: Fix for a resource bundle isue with regen renditions wizard and snapshot labels.
   6809: Fixes for locking and permission related issues relating to forms.
   6808: Uunit test update
   6799: AR-1760: Office webscript : property is undefined when opening a document
   6799: WCM submit dialog now sets focus to first field (label) rather than second (comment)
   6795: Fix to line break encoder.
   6781: WebDAV auth to return HTTP 401 instead of exception when user is null
   6775: Fix for appserver shutdown hang
   6761: Using avmService instead of nodeService to avoid a permission error MIT is seeing.
   6742: Fix for MIT locking issue for content contributors
   6706: Fixes to make wizard pages work in standards compliant mode.



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6823 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-18 23:18:09 +00:00
parent ad43a4c904
commit 6e1e59e951
15 changed files with 216 additions and 56 deletions

View File

@@ -67,7 +67,7 @@
<tr><td>Size:</td><td>${d.size / 1024} Kb</td></tr> <tr><td>Size:</td><td>${d.size / 1024} Kb</td></tr>
<tr><td valign="top">Categories:</td> <tr><td valign="top">Categories:</td>
<td> <td>
<#if d.hasAspect("cm:generalclassifiable")> <#if d.properties.categories?exists>
<#list d.properties.categories as category> <#list d.properties.categories as category>
${companyhome.nodeByReference[category].name}; ${companyhome.nodeByReference[category].name};
</#list> </#list>

View File

@@ -155,7 +155,6 @@ public class EditWebContentWizard extends CreateWebContentWizard
} }
AVMLock lock = this.avmLockingService.getLock(AVMUtil.getStoreId(this.createdPath), AVMLock lock = this.avmLockingService.getLock(AVMUtil.getStoreId(this.createdPath),
AVMUtil.getStoreRelativePath(this.createdPath)); AVMUtil.getStoreRelativePath(this.createdPath));
String previousStore = lock.getStore();
if (lock != null) if (lock != null)
{ {
LOGGER.debug("transferring lock from " + lock.getStore() + LOGGER.debug("transferring lock from " + lock.getStore() +
@@ -172,13 +171,6 @@ public class EditWebContentWizard extends CreateWebContentWizard
this.content = XMLUtil.toString(this.instanceDataDocument, false); this.content = XMLUtil.toString(this.instanceDataDocument, false);
writer.putContent(this.content); writer.putContent(this.content);
LOGGER.debug("transferring lock back to " + previousStore);
this.avmLockingService.modifyLock(AVMUtil.getStoreId(this.createdPath),
AVMUtil.getStoreRelativePath(this.createdPath),
null,
previousStore,
null,
null);
// XXXarielb might not need to do this reload // XXXarielb might not need to do this reload
this.formInstanceData = this.formsService.getFormInstanceData(-1, this.createdPath); this.formInstanceData = this.formsService.getFormInstanceData(-1, this.createdPath);
for (final Rendition r : this.formInstanceData.getRenditions()) for (final Rendition r : this.formInstanceData.getRenditions())
@@ -211,16 +203,25 @@ public class EditWebContentWizard extends CreateWebContentWizard
{ {
final Rendition r = rr.getRendition(); final Rendition r = rr.getRendition();
this.renditions.add(r); this.renditions.add(r);
LOGGER.debug("transferring lock for " + r.getPath() + " back to " + previousStore); LOGGER.debug("transferring lock for " + r.getPath() +
" back to " + AVMUtil.getCorrespondingMainStoreName(AVMUtil.getStoreName(r.getPath())));
this.avmLockingService.modifyLock(AVMUtil.getStoreId(r.getPath()), this.avmLockingService.modifyLock(AVMUtil.getStoreId(r.getPath()),
AVMUtil.getStoreRelativePath(r.getPath()), AVMUtil.getStoreRelativePath(r.getPath()),
null, null,
previousStore, AVMUtil.getCorrespondingMainStoreName(AVMUtil.getStoreName(r.getPath())),
null, null,
null); null);
} }
} }
LOGGER.debug("transferring form instance data lock back to " +
AVMUtil.getCorrespondingMainStoreName(AVMUtil.getStoreName(this.createdPath)));
this.avmLockingService.modifyLock(AVMUtil.getStoreId(this.createdPath),
AVMUtil.getStoreRelativePath(this.createdPath),
null,
AVMUtil.getCorrespondingMainStoreName(AVMUtil.getStoreName(this.createdPath)),
null,
null);
} }
/** Indicates whether or not the wizard is currently in edit mode */ /** Indicates whether or not the wizard is currently in edit mode */

View File

@@ -50,6 +50,7 @@ import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
import org.alfresco.service.cmr.avmsync.AVMDifference; import org.alfresco.service.cmr.avmsync.AVMDifference;
import org.alfresco.service.cmr.avmsync.AVMSyncService; import org.alfresco.service.cmr.avmsync.AVMSyncService;
import org.alfresco.service.cmr.model.FileExistsException; import org.alfresco.service.cmr.model.FileExistsException;
@@ -85,6 +86,7 @@ public class RegenerateRenditionsWizard
private final static Log LOGGER = LogFactory.getLog(RegenerateRenditionsWizard.class); private final static Log LOGGER = LogFactory.getLog(RegenerateRenditionsWizard.class);
private AVMLockingService avmLockingService;
private AVMService avmService; private AVMService avmService;
private AVMSyncService avmSyncService; private AVMSyncService avmSyncService;
private ContentService contentService; private ContentService contentService;
@@ -119,21 +121,22 @@ public class RegenerateRenditionsWizard
final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
if (this.regenerateScope.equals(REGENERATE_SCOPE_FORM)) if (this.regenerateScope.equals(REGENERATE_SCOPE_FORM))
{ {
description = MessageFormat.format("regenerate_renditions_snapshot_description_scope_form", description = MessageFormat.format(bundle.getString("regenerate_renditions_snapshot_description_scope_form"),
StringUtils.join(this.selectedForms, ", ")); StringUtils.join(this.selectedForms, ", "));
} }
else if (this.regenerateScope.equals(REGENERATE_SCOPE_RENDERING_ENGINE_TEMPLATE)) else if (this.regenerateScope.equals(REGENERATE_SCOPE_RENDERING_ENGINE_TEMPLATE))
{ {
description = MessageFormat.format("regenerate_renditions_snapshot_description_scope_rendering_engine_template", description = MessageFormat.format(bundle.getString("regenerate_renditions_snapshot_description_scope_rendering_engine_template"),
StringUtils.join(this.selectedRenderingEngineTemplates, ", ")); StringUtils.join(this.selectedRenderingEngineTemplates, ", "));
} }
else else
{ {
description = MessageFormat.format("regenerate_renditions_snapshot_description_scope_web_project", description = MessageFormat.format(bundle.getString("regenerate_renditions_snapshot_description_scope_web_project"),
this.selectedWebProject.getName()); this.selectedWebProject.getName());
} }
this.avmService.createSnapshot(this.selectedWebProject.getStoreId(), this.avmService.createSnapshot(this.selectedWebProject.getStoreId(),
MessageFormat.format("regenerate_renditions_snapshot_short_description", diffList.size()), MessageFormat.format(bundle.getString("regenerate_renditions_snapshot_short_description"),
diffList.size()),
description); description);
} }
return outcome; return outcome;
@@ -385,6 +388,14 @@ public class RegenerateRenditionsWizard
this.avmService = avmService; this.avmService = avmService;
} }
/**
* @param avmLockingService The AVMLockingService to set.
*/
public void setAvmLockingService(final AVMLockingService avmLockingService)
{
this.avmLockingService = avmLockingService;
}
/** /**
* @param avmSyncService The AVMSyncService to set. * @param avmSyncService The AVMSyncService to set.
*/ */
@@ -506,7 +517,8 @@ public class RegenerateRenditionsWizard
{ {
final String formName = this.selectedRenderingEngineTemplates[i].split(":")[0]; final String formName = this.selectedRenderingEngineTemplates[i].split(":")[0];
final Form f = this.selectedWebProject.getForm(formName); final Form f = this.selectedWebProject.getForm(formName);
final RenderingEngineTemplate ret = f.getRenderingEngineTemplate((String)this.selectedRenderingEngineTemplates[i].split(":")[1]); final RenderingEngineTemplate ret =
f.getRenderingEngineTemplate((String)this.selectedRenderingEngineTemplates[i].split(":")[1]);
query.append("@" + Repository.escapeQName(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE) + query.append("@" + Repository.escapeQName(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE) +
":\"" + ((RenderingEngineTemplateImpl)ret).getNodeRef() + "\""); ":\"" + ((RenderingEngineTemplateImpl)ret).getNodeRef() + "\"");
if (i != this.selectedRenderingEngineTemplates.length - 1) if (i != this.selectedRenderingEngineTemplates.length - 1)
@@ -544,7 +556,8 @@ public class RegenerateRenditionsWizard
{ {
if (rr.getException() != null) if (rr.getException() != null)
{ {
Utils.addErrorMessage("error regenerating rendition using " + rr.getRenderingEngineTemplate().getName() + Utils.addErrorMessage("error regenerating rendition using " +
rr.getRenderingEngineTemplate().getName() +
": " + rr.getException().getMessage(), ": " + rr.getException().getMessage(),
rr.getException()); rr.getException());
} }
@@ -552,11 +565,18 @@ public class RegenerateRenditionsWizard
{ {
result.add(rr.getRendition()); result.add(rr.getRendition());
} }
if (rr.getRendition() != null)
{
this.avmLockingService.removeLock(AVMUtil.getStoreId(rr.getRendition().getPath()),
AVMUtil.getStoreRelativePath(rr.getRendition().getPath()));
}
} }
} }
catch (FormNotFoundException fnfe) catch (FormNotFoundException fnfe)
{ {
Utils.addErrorMessage("error regenerating renditions of " + fid.getPath() + ": " + fnfe.getMessage(), fnfe); Utils.addErrorMessage("error regenerating renditions of " + fid.getPath() +
": " + fnfe.getMessage(),
fnfe);
} }
} }
else else
@@ -569,7 +589,8 @@ public class RegenerateRenditionsWizard
} }
catch (Exception e) catch (Exception e)
{ {
Utils.addErrorMessage("error regenerating rendition using " + r.getRenderingEngineTemplate().getName() + Utils.addErrorMessage("error regenerating rendition using " +
r.getRenderingEngineTemplate().getName() +
": " + e.getMessage(), ": " + e.getMessage(),
e); e);
} }

View File

@@ -171,6 +171,7 @@ public class FormImpl
final Map<String, Object> root = new HashMap<String, Object>(); final Map<String, Object> root = new HashMap<String, Object>();
root.put("webapp", webappName); root.put("webapp", webappName);
root.put("xml", NodeModel.wrap(formInstanceData)); root.put("xml", NodeModel.wrap(formInstanceData));
root.put("extension", "xml");
root.put("name", formInstanceDataName); root.put("name", formInstanceDataName);
root.put("date", new SimpleDate(new Date(), SimpleDate.DATETIME)); root.put("date", new SimpleDate(new Date(), SimpleDate.DATETIME));
root.put("cwd", AVMUtil.getWebappRelativePath(parentAVMPath)); root.put("cwd", AVMUtil.getWebappRelativePath(parentAVMPath));

View File

@@ -68,8 +68,10 @@ import org.xml.sax.SAXException;
{ {
throw new NullPointerException(); throw new NullPointerException();
} }
final NodeService nodeService = this.getServiceRegistry().getNodeService(); final AVMService avmService = this.getServiceRegistry().getAVMService();
if (!nodeService.hasAspect(nodeRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) if (!avmService.hasAspect(AVMNodeConverter.ToAVMVersionPath(nodeRef).getFirst(),
AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(),
WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{ {
throw new IllegalArgumentException("node " + nodeRef + throw new IllegalArgumentException("node " + nodeRef +
" does not have aspect " + WCMAppModel.ASPECT_FORM_INSTANCE_DATA); " does not have aspect " + WCMAppModel.ASPECT_FORM_INSTANCE_DATA);
@@ -88,9 +90,11 @@ import org.xml.sax.SAXException;
/** the name of this rendition */ /** the name of this rendition */
public String getName() public String getName()
{ {
final NodeService nodeService = this.getServiceRegistry().getNodeService(); // final AVMService avmService = this.getServiceRegistry().getAVMService();
return (String) // return avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
nodeService.getProperty(this.nodeRef, ContentModel.PROP_NAME); // AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
// ContentModel.PROP_NAME).getStringValue();
return AVMNodeConverter.SplitBase(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond())[1];
} }
public String getWebappRelativePath() public String getWebappRelativePath()
@@ -111,8 +115,9 @@ import org.xml.sax.SAXException;
public Document getDocument() public Document getDocument()
throws IOException, SAXException throws IOException, SAXException
{ {
return XMLUtil.parse(this.getNodeRef(), return XMLUtil.parse(AVMNodeConverter.ToAVMVersionPath(nodeRef).getFirst(),
this.getServiceRegistry().getContentService()); AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(),
this.getServiceRegistry().getAVMService());
} }
public Form getForm() public Form getForm()
@@ -145,9 +150,14 @@ import org.xml.sax.SAXException;
{ {
if (LOGGER.isDebugEnabled()) if (LOGGER.isDebugEnabled())
LOGGER.debug("regenerating renditions of " + this); LOGGER.debug("regenerating renditions of " + this);
String originalParentAvmPath = (String)
this.getServiceRegistry().getNodeService().getProperty(this.getNodeRef(),
WCMAppModel.PROP_ORIGINAL_PARENT_PATH); final AVMService avmService = this.getServiceRegistry().getAVMService();
String originalParentAvmPath =
avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
WCMAppModel.PROP_ORIGINAL_PARENT_PATH).getStringValue();
if (originalParentAvmPath == null) if (originalParentAvmPath == null)
{ {
originalParentAvmPath = AVMNodeConverter.SplitBase(this.getPath())[0]; originalParentAvmPath = AVMNodeConverter.SplitBase(this.getPath())[0];
@@ -274,8 +284,9 @@ import org.xml.sax.SAXException;
protected String getParentFormName() protected String getParentFormName()
{ {
final NodeService nodeService = this.getServiceRegistry().getNodeService(); final AVMService avmService = this.getServiceRegistry().getAVMService();
return (String) nodeService.getProperty(this.nodeRef, return avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
WCMAppModel.PROP_PARENT_FORM_NAME); AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
WCMAppModel.PROP_PARENT_FORM_NAME).getStringValue();
} }
} }

View File

@@ -252,17 +252,46 @@ public class FormsTest
XMLUtil.parse("<foons:root_tag xmlns:foons='bar'><foons:name>foo</foons:name></foons:root_tag>"), XMLUtil.parse("<foons:root_tag xmlns:foons='bar'><foons:name>foo</foons:name></foons:root_tag>"),
"foo", "foo",
"avmstore:/www/avm_webapps/webapp/dir", "avmstore:/www/avm_webapps/webapp/dir",
"webapp")/*, "webapp"),
new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/foo.xml", new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/foo.xml",
"${xml[\"/*[name()='foons:root_tag']/*[name()='foons:name']\"]}.xml",
XMLUtil.parse("<foons:root_tag xmlns:foons='bar'><foons:name>foo</foons:name></foons:root_tag>"),
"foo",
"avmstore:/www/avm_webapps/webapp/dir",
"webapp"),
new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/foo.xml",
"${xml['/foons:root_tag/foons:name']}.xml",
XMLUtil.parse("<foons:root_tag xmlns:foons='bar'><foons:name>foo</foons:name></foons:root_tag>"),
"foo",
"avmstore:/www/avm_webapps/webapp/dir",
"webapp"),
new OutputPathPatternTest(null,
"${xml.root_tag.name}", "${xml.root_tag.name}",
XMLUtil.parse("<foons:root_tag xmlns:foons='bar'><foons:name>foo</foons:name></foons:root_tag>"), XMLUtil.parse("<foons:root_tag xmlns:foons='bar'><foons:name>foo</foons:name></foons:root_tag>"),
"foo", "foo",
"avmstore:/www/avm_webapps/webapp/dir", "avmstore:/www/avm_webapps/webapp/dir",
"webapp")*/ "webapp")
}; };
for (final OutputPathPatternTest oppt : opps) for (final OutputPathPatternTest oppt : opps)
{ {
this.mockForm.setOutputPathPattern(oppt.pattern); this.mockForm.setOutputPathPattern(oppt.pattern);
if (oppt.expected == null)
{
try
{
this.mockForm.getOutputPathForFormInstanceData(oppt.xml,
oppt.name,
oppt.parentAVMPath,
oppt.webapp);
fail("expected pattern " + oppt.pattern + " to fail");
}
catch (Exception e)
{
// expected failure
}
}
else
{
assertEquals(oppt.pattern + " failed", assertEquals(oppt.pattern + " failed",
oppt.expected, oppt.expected,
this.mockForm.getOutputPathForFormInstanceData(oppt.xml, this.mockForm.getOutputPathForFormInstanceData(oppt.xml,
@@ -271,4 +300,5 @@ public class FormsTest
oppt.webapp)); oppt.webapp));
} }
} }
}
} }

View File

@@ -274,7 +274,8 @@ public class RenderingEngineTemplateImpl
avmService.addAspect(renditionAvmPath, WCMAppModel.ASPECT_RENDITION); avmService.addAspect(renditionAvmPath, WCMAppModel.ASPECT_RENDITION);
} }
final Rendition result = new RenditionImpl(AVMNodeConverter.ToNodeRef(-1, renditionAvmPath), final Rendition result = new RenditionImpl(-1,
renditionAvmPath,
this.formsService); this.formsService);
this.render(formInstanceData, result); this.render(formInstanceData, result);

View File

@@ -37,7 +37,6 @@ import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.util.Pair; import org.alfresco.util.Pair;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMUtil; import org.alfresco.web.bean.wcm.AVMUtil;
@@ -71,8 +70,10 @@ import org.xml.sax.SAXException;
{ {
throw new NullPointerException(); throw new NullPointerException();
} }
final NodeService nodeService = this.getServiceRegistry().getNodeService(); final AVMService avmService = this.getServiceRegistry().getAVMService();
if (!nodeService.hasAspect(nodeRef, WCMAppModel.ASPECT_RENDITION)) if (!avmService.hasAspect(AVMNodeConverter.ToAVMVersionPath(nodeRef).getFirst(),
AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(),
WCMAppModel.ASPECT_RENDITION))
{ {
throw new IllegalArgumentException("node " + nodeRef + throw new IllegalArgumentException("node " + nodeRef +
" does not have aspect " + WCMAppModel.ASPECT_RENDITION); " does not have aspect " + WCMAppModel.ASPECT_RENDITION);
@@ -91,17 +92,20 @@ import org.xml.sax.SAXException;
/** the name of this rendition */ /** the name of this rendition */
public String getName() public String getName()
{ {
final NodeService nodeService = this.getServiceRegistry().getNodeService(); // final AVMService avmService = this.getServiceRegistry().getAVMService();
return (String) // return avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
nodeService.getProperty(this.nodeRef, ContentModel.PROP_NAME); // AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
// ContentModel.PROP_NAME).getStringValue();
return AVMNodeConverter.SplitBase(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond())[1];
} }
/** the description of this rendition */ /** the description of this rendition */
public String getDescription() public String getDescription()
{ {
final NodeService nodeService = this.getServiceRegistry().getNodeService(); final AVMService avmService = this.getServiceRegistry().getAVMService();
return (String) return avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
nodeService.getProperty(this.nodeRef, ContentModel.PROP_DESCRIPTION); AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
ContentModel.PROP_DESCRIPTION).getStringValue();
} }
public String getWebappRelativePath() public String getWebappRelativePath()

View File

@@ -33,6 +33,7 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
@@ -136,6 +137,16 @@ public class XMLUtil
return XMLUtil.parse(in); return XMLUtil.parse(in);
} }
/** utility function for parsing xml */
public static Document parse(final int version,
final String path,
final AVMService avmService)
throws SAXException,
IOException
{
return XMLUtil.parse(avmService.getFileInputStream(version, path));
}
/** utility function for parsing xml */ /** utility function for parsing xml */
public static Document parse(final File source) public static Document parse(final File source)
throws SAXException, throws SAXException,

View File

@@ -39,7 +39,6 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamSource;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.NamespaceService;

View File

@@ -361,6 +361,41 @@ public class Schema2XFormsTest
} }
} }
public void testAnnotation()
throws Exception
{
final Document schemaDocument = this.loadTestResourceDocument("xforms/unit-tests/automated/annotation-test.xsd");
Document xformsDocument = Schema2XFormsTest.buildXForm(null, schemaDocument, "annotation-test");
this.runXForm(xformsDocument);
System.err.println("generated xform " + XMLUtil.toString(xformsDocument));
Element control = assertControlProperties(xformsDocument,
"/annotation-test/upload_in_root",
NamespaceConstants.XFORMS_PREFIX + ":upload");
assertEquals("upload_in_root", control.getAttributeNS(NamespaceConstants.XFORMS_NS, "appearance"));
control = assertControlProperties(xformsDocument,
"/annotation-test/string_in_root",
NamespaceConstants.XFORMS_PREFIX + ":textarea");
assertEquals("string_in_root", control.getAttributeNS(NamespaceConstants.XFORMS_NS, "appearance"));
control = assertControlProperties(xformsDocument,
"/annotation-test/struct_1/upload_in_base",
NamespaceConstants.XFORMS_PREFIX + ":upload");
assertEquals("upload_in_base", control.getAttributeNS(NamespaceConstants.XFORMS_NS, "appearance"));
control = assertControlProperties(xformsDocument,
"/annotation-test/struct_1/string_in_base",
NamespaceConstants.XFORMS_PREFIX + ":textarea");
assertEquals("string_in_base", control.getAttributeNS(NamespaceConstants.XFORMS_NS, "appearance"));
control = assertControlProperties(xformsDocument,
"/annotation-test/struct_1/upload_in_struct",
NamespaceConstants.XFORMS_PREFIX + ":upload");
assertEquals("upload_in_struct", control.getAttributeNS(NamespaceConstants.XFORMS_NS, "appearance"));
control = assertControlProperties(xformsDocument,
"/annotation-test/struct_1/string_in_struct",
NamespaceConstants.XFORMS_PREFIX + ":textarea");
assertEquals("string_in_struct", control.getAttributeNS(NamespaceConstants.XFORMS_NS, "appearance"));
}
public void testConstraint() public void testConstraint()
throws Exception throws Exception
{ {

View File

@@ -459,7 +459,7 @@ public final class Utils
{ {
try try
{ {
StringBuilder parsedContent = new StringBuilder(); StringBuilder parsedContent = new StringBuilder(str.length() + 32);
BufferedReader reader = new BufferedReader(new StringReader(str)); BufferedReader reader = new BufferedReader(new StringReader(str));
String line = reader.readLine(); String line = reader.readLine();
while (line != null) while (line != null)
@@ -468,7 +468,7 @@ public final class Utils
line = reader.readLine(); line = reader.readLine();
if (line != null) if (line != null)
{ {
parsedContent.append("<br/>"); parsedContent.append("<br>");
} }
} }

View File

@@ -0,0 +1,42 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:alf="http://www.alfresco.org"
elementFormDefault="qualified">
<xs:complexType name="base_1" abstract="true">
<xs:sequence>
<xs:element name="upload_in_base" type="xs:anyURI">
<xs:annotation><xs:appinfo><alf:appearance>upload_in_base</alf:appearance></xs:appinfo></xs:annotation>
</xs:element>
<xs:element name="string_in_base" type="xs:string">
<xs:annotation><xs:appinfo><alf:appearance>string_in_base</alf:appearance></xs:appinfo></xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="struct_1_type">
<xs:complexContent>
<xs:extension base="base_1">
<xs:sequence>
<xs:element name="upload_in_struct" type="xs:anyURI">
<xs:annotation><xs:appinfo><alf:appearance>upload_in_struct</alf:appearance></xs:appinfo></xs:annotation>
</xs:element>
<xs:element name="string_in_struct" type="xs:string">
<xs:annotation><xs:appinfo><alf:appearance>string_in_struct</alf:appearance></xs:appinfo></xs:annotation>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="annotation-test">
<xs:complexType>
<xs:sequence>
<xs:element name="upload_in_root" type="xs:anyURI">
<xs:annotation><xs:appinfo><alf:appearance>upload_in_root</alf:appearance></xs:appinfo></xs:annotation>
</xs:element>
<xs:element name="string_in_root" type="xs:string">
<xs:annotation><xs:appinfo><alf:appearance>string_in_root</alf:appearance></xs:appinfo></xs:annotation>
</xs:element>
<xs:element name="struct_1" type="struct_1_type"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@@ -2601,6 +2601,10 @@
<property-name>avmService</property-name> <property-name>avmService</property-name>
<value>#{AVMLockingAwareService}</value> <value>#{AVMLockingAwareService}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>avmLockingService</property-name>
<value>#{AVMLockingService}</value>
</managed-property>
<managed-property> <managed-property>
<property-name>avmSyncService</property-name> <property-name>avmSyncService</property-name>
<value>#{AVMSyncService}</value> <value>#{AVMSyncService}</value>

View File

@@ -38,7 +38,7 @@
function pageLoaded() function pageLoaded()
{ {
document.getElementById("dialog:dialog-body:comment").focus(); document.getElementById("dialog:dialog-body:label").focus();
noItems = document.getElementById("dialog:finish-button").disabled; noItems = document.getElementById("dialog:finish-button").disabled;
document.getElementById("dialog:finish-button").onclick = showProgress; document.getElementById("dialog:finish-button").onclick = showProgress;
checkButtonState(); checkButtonState();