mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V4.1-BUG-FIX to HEAD
47423: Merged V4.1-BUG-FIX-2013_02_26 to V4.1-BUG-FIX 47381: ALF-15903 : form.getFieldLabel(field.id) sometimes returns the wrong label Added a check for the overridden id with the ending "-cntrl" 47424: Fixes: ALF-17950: Content I'm Editing dashlet runs relativeDate parsing twice. Removes duplicate code and also prevents relativeTime parsing from breaking if called multiple times. 47425: Merged V4.1-BUG-FIX-2013_02_26 to V4.1-BUG-FIX 47386: ALF-15873: Form field validators not executed for NON mandatory date fields Add to context all form constraints defined in custom config. 47426: Merged V4.1-BUG-FIX-2013_02_26 to V4.1-BUG-FIX 47418: ALF-16385 : When the 'My activites' dashlet is narrow enough, vertical sizing of the content box is wrong. Recalculate a height of dashlet, when it was resized 47427: ALF-18092: fixed issue with hidden-transitions field JSON 47428: Merge DEV to V4.1-BUG-FIX 46336 : ALF-16747 changing type of the root node of replicated set of nodes is not propagated to target. 47437: Fixes ALF-17145: Pagination did not play nicely with back button. 47439: Implements suggested fix for: ALF-16603 47443: Fixed ALF-17255: AUDIT_PATH_REGEX regex pattern recompiled at runtime - Switch to pre-compiled Pattern 47473: Merged BRANCHES/DEV/BELARUS/V4.1-BUG-FIX-2013_02_26 to BRANCHES/DEV/V4.1-BUG-FIX: 47313: ALF-18006 : Sending a PUT request without a Content-Type header resets the contents mimetype to application/octet-stream fix unit test 47475: ALF-18092: Fixed unit test fallout from hidden transitions property serialization changes git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@47476 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -75,11 +75,11 @@ public class AlfrescoCmisStreamInterceptor implements MethodInterceptor
|
||||
ReusableContentStream reuableContentStream = new ReusableContentStream(contentStream);
|
||||
|
||||
// ALF-18006
|
||||
// if (contentStream.getMimeType() == null)
|
||||
// {
|
||||
// String mimeType = mimetypeService.guessMimetype(reuableContentStream.getFileName(), new FileContentReader(reuableContentStream.file));
|
||||
// reuableContentStream.setMimeType(mimeType);
|
||||
// }
|
||||
if (contentStream.getMimeType() == null)
|
||||
{
|
||||
String mimeType = mimetypeService.guessMimetype(reuableContentStream.getFileName(), new FileContentReader(reuableContentStream.file));
|
||||
reuableContentStream.setMimeType(mimeType);
|
||||
}
|
||||
|
||||
reusableContentStreams.add(reuableContentStream);
|
||||
|
||||
|
@@ -30,7 +30,6 @@ import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.alfresco.repo.audit.model.AuditApplication;
|
||||
import org.alfresco.repo.coci.CheckOutCheckInServicePolicies.OnCancelCheckOut;
|
||||
@@ -108,8 +107,6 @@ import org.alfresco.service.namespace.QName;
|
||||
private static final String CANCEL_CHECK_OUT = "cancelCheckOut";
|
||||
|
||||
private static final String INVALID_PATH_CHAR_REPLACEMENT = "-";
|
||||
private static final Pattern INVALID_PATH_COMP_CHAR_PATTERN =
|
||||
Pattern.compile(AuditApplication.AUDIT_INVALID_PATH_COMP_CHAR_REGEX);
|
||||
|
||||
public static Collection<String> SUMMARY_KEYS = new ArrayList<String>();
|
||||
static
|
||||
@@ -798,6 +795,6 @@ import org.alfresco.service.namespace.QName;
|
||||
*/
|
||||
private String replaceInvalidPathChars(String path)
|
||||
{
|
||||
return INVALID_PATH_COMP_CHAR_PATTERN.matcher(path).replaceAll(INVALID_PATH_CHAR_REPLACEMENT);
|
||||
return AuditApplication.AUDIT_INVALID_PATH_COMP_CHAR_PATTERN.matcher(path).replaceAll(INVALID_PATH_CHAR_REPLACEMENT);
|
||||
}
|
||||
}
|
@@ -25,6 +25,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.alfresco.repo.audit.extractor.DataExtractor;
|
||||
import org.alfresco.repo.audit.generator.DataGenerator;
|
||||
@@ -47,9 +48,9 @@ public class AuditApplication
|
||||
{
|
||||
public static final String AUDIT_APPLICATION_PREFIX_FOR_PRE_DATA = "PreCallData";
|
||||
public static final String AUDIT_PATH_SEPARATOR = "/";
|
||||
public static final String AUDIT_KEY_REGEX = "[a-zA-Z0-9\\-\\_\\.]+";
|
||||
public static final String AUDIT_PATH_REGEX = "(/[a-zA-Z0-9:\\-\\_\\.]+)+";
|
||||
public static final String AUDIT_INVALID_PATH_COMP_CHAR_REGEX = "[^a-zA-Z0-9:\\-\\_\\.]";
|
||||
public static final Pattern AUDIT_KEY_PATTERN = Pattern.compile("[a-zA-Z0-9\\-\\_\\.]+");
|
||||
public static final Pattern AUDIT_PATH_PATTERN = Pattern.compile("(/[a-zA-Z0-9:\\-\\_\\.]+)+");
|
||||
public static final Pattern AUDIT_INVALID_PATH_COMP_CHAR_PATTERN = Pattern.compile("[^a-zA-Z0-9:\\-\\_\\.]");
|
||||
|
||||
private static final Log logger = LogFactory.getLog(AuditApplication.class);
|
||||
|
||||
@@ -177,11 +178,11 @@ public class AuditApplication
|
||||
{
|
||||
generateException(path, "Empty or null audit path");
|
||||
}
|
||||
else if (!path.matches(AUDIT_PATH_REGEX))
|
||||
else if (!AUDIT_PATH_PATTERN.matcher(path).matches())
|
||||
{
|
||||
generateException(
|
||||
path,
|
||||
"An audit must match regular expression: " + AUDIT_PATH_REGEX);
|
||||
"An audit must match regular expression: " + AUDIT_PATH_PATTERN);
|
||||
}
|
||||
else if (path.indexOf(applicationKey, 0) != 1)
|
||||
{
|
||||
@@ -205,10 +206,10 @@ public class AuditApplication
|
||||
{
|
||||
throw new AuditModelException("Empty or null audit path: " + path);
|
||||
}
|
||||
else if (!path.matches(AUDIT_PATH_REGEX))
|
||||
else if (!AUDIT_PATH_PATTERN.matcher(path).matches())
|
||||
{
|
||||
throw new AuditModelException(
|
||||
"Audit path '" + path + "' does not match regular expression: " + AUDIT_PATH_REGEX);
|
||||
"Audit path '" + path + "' does not match regular expression: " + AUDIT_PATH_PATTERN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,10 +241,10 @@ public class AuditApplication
|
||||
}
|
||||
String path = sb.toString();
|
||||
// Check the path format
|
||||
if (!path.matches(AUDIT_PATH_REGEX))
|
||||
if (!AUDIT_PATH_PATTERN.matcher(path).matches())
|
||||
{
|
||||
StringBuffer msg = new StringBuffer();
|
||||
msg.append("The audit path is invalid and must be matched by regular expression: ").append(AUDIT_PATH_REGEX).append("\n")
|
||||
msg.append("The audit path is invalid and must be matched by regular expression: ").append(AUDIT_PATH_PATTERN).append("\n")
|
||||
.append(" Path elements: ");
|
||||
for (String pathComponent : pathComponents)
|
||||
{
|
||||
|
@@ -39,6 +39,8 @@ import org.alfresco.repo.transfer.manifest.TransferManifestNode;
|
||||
import org.alfresco.repo.transfer.manifest.TransferManifestNormalNode;
|
||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.alfresco.service.cmr.lock.LockType;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
@@ -561,6 +563,39 @@ public class RepoPrimaryManifestProcessorImpl extends AbstractManifestProcessorB
|
||||
// Deal with the content properties
|
||||
writeContent(nodeToUpdate, contentProps);
|
||||
|
||||
// Change the type of the content
|
||||
if(!nodeService.getType(nodeToUpdate).equals(node.getType()))
|
||||
{
|
||||
// The type has changed, check the dictionary to contain the model for that type
|
||||
TypeDefinition newTypeDef = dictionaryService.getType(node.getType());
|
||||
if(newTypeDef == null)
|
||||
{
|
||||
log.warn("Failed to update the type: " + node.getType() + " for node: " + nodeToUpdate + ", as there is no type definition for it");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check the default properties
|
||||
Map<QName, PropertyDefinition> typeProperties = newTypeDef.getProperties();
|
||||
// Search if all the properties are in place
|
||||
boolean fail = false;
|
||||
for(QName key : typeProperties.keySet())
|
||||
{
|
||||
PropertyDefinition propDef = typeProperties.get(key);
|
||||
if(!props.containsKey(key) && propDef.isMandatory())
|
||||
{
|
||||
log.warn("Failed to update the type: " + node.getType() + " for node: " + nodeToUpdate + ", as the mandatory property '" + propDef.getName() + "' was not transferred.");
|
||||
fail = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!fail)
|
||||
{
|
||||
// Set the new type
|
||||
nodeService.setType(nodeToUpdate, node.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Blend the aspects together
|
||||
Set<QName> suppliedAspects = new HashSet<QName>(node.getAspects());
|
||||
Set<QName> existingAspects = nodeService.getAspects(nodeToUpdate);
|
||||
|
Reference in New Issue
Block a user