Package org.olat.commons.modules.bc.meta

Examples of org.olat.commons.modules.bc.meta.MetaInfoFileImpl


      }
    } 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++;
View Full Code Here

TOP

Related Classes of org.olat.commons.modules.bc.meta.MetaInfoFileImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.