public void removeMemberLinks( long tagId, String tagUuid, String[] memberIds, boolean suppressOutstanding) { TagMetadata deleteTemplate = new TagMetadata(); deleteTemplate.setValue( TagMetadata.TAG_ID, tagId); // Need this for recording changes in outstanding table deleteTemplate.setValue(TagMetadata.DELETION_DATE, DateUtilities.now()); if (memberIds != null) { for (String uuid : memberIds) { // TODO: Right now this is in a loop because each deleteTemplate needs the individual // tagUuid in order to record // the outstanding entry correctly. If possible, this should be improved to a single query deleteTemplate.setValue( TagMemberMetadata.USER_UUID, uuid); // Need this for recording changes in outstanding table if (suppressOutstanding) { deleteTemplate.putTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES, true); } update( Criterion.and( TagMetadataCriteria.withKey(TagMemberMetadata.KEY), TagMetadata.DELETION_DATE.eq(0), TagMetadata.TAG_UUID.eq(tagUuid), TagMemberMetadata.USER_UUID.eq(uuid)), deleteTemplate); } } }
public void createMemberLink( long tagId, String tagUuid, String memberId, boolean removedMember, boolean suppressOutstanding) { TagMetadata newMetadata = TagMemberMetadata.newMemberMetadata(tagId, tagUuid, memberId); if (removedMember) { newMetadata.setValue(TagMetadata.DELETION_DATE, DateUtilities.now()); } if (suppressOutstanding) { newMetadata.putTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES, true); } if (update( Criterion.and( TagMetadataCriteria.byTagAndWithKey(tagUuid, TagMemberMetadata.KEY), TagMemberMetadata.USER_UUID.eq(memberId)), newMetadata) <= 0) { if (suppressOutstanding) { newMetadata.putTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES, true); } createNew(newMetadata); } }
public void removeMemberLink( long tagId, String tagUuid, String memberId, boolean suppressOutstanding) { TagMetadata deleteTemplate = new TagMetadata(); deleteTemplate.setValue( TagMetadata.TAG_ID, tagId); // Need this for recording changes in outstanding table deleteTemplate.setValue(TagMetadata.DELETION_DATE, DateUtilities.now()); deleteTemplate.setValue( TagMemberMetadata.USER_UUID, memberId); // Need this for recording changes in outstanding table if (suppressOutstanding) { deleteTemplate.putTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES, true); } update( Criterion.and( TagMetadataCriteria.withKey(TagMemberMetadata.KEY), TagMetadata.DELETION_DATE.eq(0), TagMetadata.TAG_UUID.eq(tagUuid), TagMemberMetadata.USER_UUID.eq(memberId)), deleteTemplate); }