Exemple #1
0
def findCamouflaged(fix=False, fromDate=None):

    table = {
        0: [Conference],
        1: [Contribution, AcceptedContribution],
        2: [SubContribution]
    }

    dbi = DBMgr.getInstance()
    dbi.startRequest()

    camouflaged = []
    doh = DeletedObjectHolder()

    for obj in doh.getList():
        types = table[obj.getId().count(":")]
        if not obj._objClass in types:
            camouflaged.append(obj)
            print "-- CAMOUFLAGED %s (%s) should be in %s" % (
                prettyPrint(obj), obj._objClass, types)

    if fix:
        for c in camouflaged:
            dbi.sync()
            doh.remove(c)
            dbi.commit()
            print "-- FIXED %s " % prettyPrint(c)

    dbi.endRequest()
    print "\n Total of %s camouflaged conferences found" % len(camouflaged)

    return camouflaged
Exemple #2
0
def findCamouflaged(fix=False,fromDate=None):

    table = {
        0: [Conference],
        1: [Contribution, AcceptedContribution],
        2: [SubContribution]
    }

    dbi = DBMgr.getInstance()
    dbi.startRequest()

    camouflaged = []
    doh = DeletedObjectHolder()

    for obj in doh.getList():
        types = table[obj.getId().count(":")]
        if not obj._objClass in types:
            camouflaged.append(obj)
            print "-- CAMOUFLAGED %s (%s) should be in %s" % (prettyPrint(obj),
                                                           obj._objClass,
                                                           types)

    if fix:
        for c in camouflaged:
            dbi.sync()
            doh.remove(c)
            dbi.commit()
            print "-- FIXED %s " % prettyPrint(c)

    dbi.endRequest()
    print "\n Total of %s camouflaged conferences found" % len(camouflaged)

    return camouflaged
Exemple #3
0
def findZombies(fix=False,fromDate=None):
    dbi = DBMgr.getInstance()
    dbi.startRequest()

    pubConfIdx = IndexesHolder().getIndex('OAIDeletedConferenceModificationDate')
    prvConfIdx = IndexesHolder().getIndex('OAIDeletedPrivateConferenceModificationDate')

    pubContIdx = IndexesHolder().getIndex('OAIDeletedContributionModificationDate')
    prvContIdx = IndexesHolder().getIndex('OAIDeletedPrivateContributionModificationDate')


    zombies = []
    doh = DeletedObjectHolder()

    for obj in doh.getList():
        isZombie = False
        rec = None

        if obj._objClass == Conference:
            try:
                rec = ConferenceHolder().getById(obj.getId())
                isZombie = True
            except:
                continue
        elif obj._objClass == Contribution or obj._objClass == AcceptedContribution:

            try:
                conference = ConferenceHolder().getById(obj.confId)
            except:
                continue

            rec = conference.getContributionById(obj.contribId)
            isZombie = (rec != None)
        elif obj._objClass == SubContribution:

            try:
                conference = ConferenceHolder().getById(obj.confId)
            except:
                continue

            contrib = conference.getContributionById(obj.contribId)
            if not contrib:
                continue
            rec = contrib.getSubContributionById(obj.subContribId)
            isZombie = (rec != None)

        if isZombie:
            print "-- ZOMBIE %s" % prettyPrint(rec)
            zombies.append(obj)


    if fix:
        for z in zombies:
            dbi.sync()

            pubConfIdx.unindexElement(z)
            prvConfIdx.unindexElement(z)
            pubContIdx.unindexElement(z)
            prvContIdx.unindexElement(z)

            id = z.getId()
            doh.remove(z)
            dbi.commit()
            print "-- FIXED %s " % id

    dbi.endRequest()
    print "\n Total of %s zombie records found" % len(zombies)

    return zombies
Exemple #4
0
def findZombies(fix=False, fromDate=None):
    dbi = DBMgr.getInstance()
    dbi.startRequest()

    pubConfIdx = IndexesHolder().getIndex(
        'OAIDeletedConferenceModificationDate')
    prvConfIdx = IndexesHolder().getIndex(
        'OAIDeletedPrivateConferenceModificationDate')

    pubContIdx = IndexesHolder().getIndex(
        'OAIDeletedContributionModificationDate')
    prvContIdx = IndexesHolder().getIndex(
        'OAIDeletedPrivateContributionModificationDate')

    zombies = []
    doh = DeletedObjectHolder()

    for obj in doh.getList():
        isZombie = False
        rec = None

        if obj._objClass == Conference:
            try:
                rec = ConferenceHolder().getById(obj.getId())
                isZombie = True
            except:
                continue
        elif obj._objClass == Contribution or obj._objClass == AcceptedContribution:

            try:
                conference = ConferenceHolder().getById(obj.confId)
            except:
                continue

            rec = conference.getContributionById(obj.contribId)
            isZombie = (rec != None)
        elif obj._objClass == SubContribution:

            try:
                conference = ConferenceHolder().getById(obj.confId)
            except:
                continue

            contrib = conference.getContributionById(obj.contribId)
            if not contrib:
                continue
            rec = contrib.getSubContributionById(obj.subContribId)
            isZombie = (rec != None)

        if isZombie:
            print "-- ZOMBIE %s" % prettyPrint(rec)
            zombies.append(obj)

    if fix:
        for z in zombies:
            dbi.sync()

            pubConfIdx.unindexElement(z)
            prvConfIdx.unindexElement(z)
            pubContIdx.unindexElement(z)
            prvContIdx.unindexElement(z)

            id = z.getId()
            doh.remove(z)
            dbi.commit()
            print "-- FIXED %s " % id

    dbi.endRequest()
    print "\n Total of %s zombie records found" % len(zombies)

    return zombies