}
} else {
// it is File
if (aFile.getName().endsWith(".xml")) {
try {
MetaInfoFileImpl metaInfoFile = new MetaInfoFileImpl(aFile);
if (metaInfoFile.parseXMLdom(aFile) ) {
// read author direct as XML value and not via getAuthor method because getAuthor is based on Identityreturns '-'
String username = getAuthorFromXmlMetaData(aFile);
Identity identity = ManagerFactory.getManager().findIdentityByName(username);
if (identity == null) {
// Could not found identity => try to find as deleted username <TIMESTAMP>_bkp_<USERNAME>
identity = findDeletedIdentityByName(username);
if (identity != null) {
metaInfoFile.setAuthor(identity.getName());
} else {
// // Could not found identity as deleted-identity too, warn only when username is not empty
if (username.trim().length() > 0) {
log.warn("Could not found identity with username=" + username + " file=" + aFile.getAbsolutePath());
}
}
} else {
// Set author again to force replacement of username with identity-key
metaInfoFile.setAuthor(username);
}
if (!testMode) {
metaInfoFile.write();
if (log.isDebug()) log.debug("replaceAuthorNameWithIdentityKeyInAllMetaData setAuthor=" + username + " in meta file=" + aFile.getAbsolutePath() );
} else {
log.info("replaceAuthorNameWithIdentityKeyInAllMetaData: TEST-MODE !!! DO NOT WRITE setAuthor=" + username + " in meta file=" + aFile.getAbsolutePath());
}
fileCounter++;