protected void convertPointerToSiblings() {

        try {
            int linksSize = m_linkStorage.size();
            int i = 0;
            Iterator<Entry<String, String>> itEntries = m_linkStorage.entrySet().iterator();
            // loop through all links to convert
            while (itEntries.hasNext()) {
                Entry<String, String> entry = itEntries.next();

                String key = entry.getKey();
                String link = entry.getValue();
                List<CmsProperty> properties = m_linkPropertyStorage.get(key);
                CmsProperty.setAutoCreatePropertyDefinitions(properties, true);

                i++;
                m_report.print(
                    org.opencms.report.Messages.get().container(
                        org.opencms.report.Messages.RPT_SUCCESSION_2,
                        String.valueOf(i),
                        String.valueOf(linksSize)),
                    I_CmsReport.FORMAT_NOTE);
                m_report.print(Messages.get().container(Messages.RPT_CONVERT_LINK_0), I_CmsReport.FORMAT_NOTE);
                m_report.print(
                    org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_ARGUMENT_1, key + " "));
                m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));

                try {
                    // check if this is an internal pointer
                    if (link.startsWith("/")) {
                        // check if the pointer target is existing
                        CmsResource target = m_cms.readResource(link);

                        // create a new sibling as CmsResource
                        CmsResource resource = new CmsResource(
                            new CmsUUID(), // structure ID is always a new UUID
                            target.getResourceId(),
                            key,
                            target.getTypeId(),
                            target.isFolder(),
                            0,
                            m_cms.getRequestContext().getCurrentProject().getUuid(), // TODO: pass flags from import
                            CmsResource.STATE_NEW,
                            target.getDateCreated(),
                            target.getUserCreated(),
                            target.getDateLastModified(),
                            target.getUserLastModified(),
                            CmsResource.DATE_RELEASED_DEFAULT,
                            CmsResource.DATE_EXPIRED_DEFAULT,
                            1,
                            0,
                            target.getDateContent(),
                            0);

                        m_cms.importResource(key, resource, null, properties);
                        m_report.println(
                            org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                            I_CmsReport.FORMAT_OK);

                        if (LOG.isInfoEnabled()) {
                            LOG.info(
                                Messages.get().getBundle().key(
                                    Messages.LOG_CONVERT_LINK_DOTS_OK_3,
                                    String.valueOf(i),
                                    String.valueOf(linksSize),
                                    key));
                        }
                    } else {
                        int pointerId = OpenCms.getResourceManager().getResourceType(
                            CmsResourceTypePointer.getStaticTypeName()).getTypeId();
                        m_cms.createResource(key, pointerId, link.getBytes(), properties);
                        m_report.println(
                            org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                            I_CmsReport.FORMAT_OK);

                        if (LOG.isInfoEnabled()) {
                            LOG.info(
                                Messages.get().getBundle().key(
                                    Messages.LOG_CONVERT_LINK_OK_3,
                                    String.valueOf(i),
                                    String.valueOf(linksSize),
                                    key));
                        }
                    }
                } catch (CmsException e) {
                    m_report.println();
                    m_report.print(
                        Messages.get().container(Messages.RPT_CONVERT_LINK_NOTFOUND_1, link),
                        I_CmsReport.FORMAT_WARNING);

                    if (LOG.isErrorEnabled()) {
                        LOG.error(
                            Messages.get().getBundle().key(
                                Messages.ERR_IMPORTEXPORT_LINK_CONVERSION_FAILED_2,
                                key,
                                link),
                            e);
                    }
                }
            }
        } finally {
            if (m_linkStorage != null) {
                m_linkStorage.clear();
            }
            m_linkStorage = null;

            if (m_linkPropertyStorage != null) {
                m_linkPropertyStorage.clear();
            }
            m_linkPropertyStorage = null;
        }
    }
protected void convertPointerToSiblings ( ) { try { int linksSize = m_linkStorage . size ( ) ; int i = 0 ; Iterator < Entry < String , String > > itEntries = m_linkStorage . entrySet ( ) . iterator ( ) ; while ( itEntries . hasNext ( ) ) { Entry < String , String > entry = itEntries . next ( ) ; String key = entry . getKey ( ) ; String link = entry . getValue ( ) ; List < CmsProperty > properties = m_linkPropertyStorage . get ( key ) ; CmsProperty . setAutoCreatePropertyDefinitions ( properties , true ) ; i ++ ; m_report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_SUCCESSION_2 , String . valueOf ( i ) , String . valueOf ( linksSize ) ) , I_CmsReport . FORMAT_NOTE ) ; m_report . print ( Messages . get ( ) . container ( Messages . RPT_CONVERT_LINK_0 ) , I_CmsReport . FORMAT_NOTE ) ; m_report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_ARGUMENT_1 , key + " " ) ) ; m_report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_DOTS_0 ) ) ; try { if ( link . startsWith ( "/" ) ) { CmsResource target = m_cms . readResource ( link ) ; CmsResource resource = new CmsResource ( new CmsUUID ( ) , target . getResourceId ( ) , key , target . getTypeId ( ) , target . isFolder ( ) , 0 , m_cms . getRequestContext ( ) . getCurrentProject ( ) . getUuid ( ) , CmsResource . STATE_NEW , target . getDateCreated ( ) , target . getUserCreated ( ) , target . getDateLastModified ( ) , target . getUserLastModified ( ) , CmsResource . DATE_RELEASED_DEFAULT , CmsResource . DATE_EXPIRED_DEFAULT , 1 , 0 , target . getDateContent ( ) , 0 ) ; m_cms . importResource ( key , resource , null , properties ) ; m_report . println ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_OK_0 ) , I_CmsReport . FORMAT_OK ) ; if ( LOG . isInfoEnabled ( ) ) { LOG . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_CONVERT_LINK_DOTS_OK_3 , String . valueOf ( i ) , String . valueOf ( linksSize ) , key ) ) ; } } else { int pointerId = OpenCms . getResourceManager ( ) . getResourceType ( CmsResourceTypePointer . getStaticTypeName ( ) ) . getTypeId ( ) ; m_cms . createResource ( key , pointerId , link . getBytes ( ) , properties ) ; m_report . println ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_OK_0 ) , I_CmsReport . FORMAT_OK ) ; if ( LOG . isInfoEnabled ( ) ) { LOG . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_CONVERT_LINK_OK_3 , String . valueOf ( i ) , String . valueOf ( linksSize ) , key ) ) ; } } } catch ( CmsException e ) { m_report . println ( ) ; m_report . print ( Messages . get ( ) . container ( Messages . RPT_CONVERT_LINK_NOTFOUND_1 , link ) , I_CmsReport . FORMAT_WARNING ) ; if ( LOG . isErrorEnabled ( ) ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . ERR_IMPORTEXPORT_LINK_CONVERSION_FAILED_2 , key , link ) , e ) ; } } } } finally { if ( m_linkStorage != null ) { m_linkStorage . clear ( ) ; } m_linkStorage = null ; if ( m_linkPropertyStorage != null ) { m_linkPropertyStorage . clear ( ) ; } m_linkPropertyStorage = null ; } }
Converts old style pointers to siblings if possible.<p>