/** * Called when a recovery is needed to create a new item. * * @param aElement * The element to be created. Never <code>null</code>. */ @IsLocked (ELockType.WRITE) protected abstract void onRecoveryCreate (@Nonnull DATATYPE aElement);
/** * Called when a recovery is needed to update an existing item. * * @param aElement * The element to be updated. Never <code>null</code>. */ @IsLocked (ELockType.WRITE) protected abstract void onRecoveryUpdate (@Nonnull DATATYPE aElement);
@Override @IsLocked (ELockType.WRITE) protected void onRecoveryUpdate (@Nonnull final AuditItem aElement) { throw new UnsupportedOperationException (); }
/** * Callback method that is invoked, when this object is modified. This method * must be overridden to do something useful. A use case scenario could e.g. * be automatic storage of changes. * * @throws OpenAS2Exception * In case anything goes wrong */ @OverrideOnDemand @IsLocked (ELockType.WRITE) protected void markAsChanged () throws OpenAS2Exception {}
@Override @IsLocked (ELockType.WRITE) protected void onRecoveryCreate (@Nonnull final AuditItem aItem) { m_aItems.internalAddItem (aItem); }
@IsLocked (ELockType.READ) protected final void internalForEachValue (@Nullable final Predicate <? super IMPLTYPE> aFilter, @Nullable final Consumer <? super IMPLTYPE> aConsumer) { m_aRWLock.readLocked ( () -> m_aMap.forEachValue (aFilter, aConsumer)); }
@IsLocked (ELockType.READ) public final void forEachValue (@Nullable final Predicate <? super INTERFACETYPE> aFilter, @Nullable final Consumer <? super INTERFACETYPE> aConsumer) { m_aRWLock.readLocked ( () -> m_aMap.forEachValue (aFilter, aConsumer)); }
@IsLocked (ELockType.READ) public final void forEachKey (@Nullable final Predicate <? super String> aFilter, @Nullable final Consumer <? super String> aConsumer) { m_aRWLock.readLocked ( () -> m_aMap.forEachKey (aFilter, aConsumer)); }
@IsLocked (ELockType.READ) public final void forEachValue (@Nullable final Consumer <? super INTERFACETYPE> aConsumer) { m_aRWLock.readLocked ( () -> m_aMap.forEachValue (aConsumer)); }
@IsLocked (ELockType.READ) public final void forEachKey (@Nullable final Consumer <? super String> aConsumer) { m_aRWLock.readLocked ( () -> m_aMap.forEachKey (aConsumer)); }
@IsLocked (ELockType.READ) public final void forEach (@Nullable final BiConsumer <? super String, ? super INTERFACETYPE> aConsumer) { m_aRWLock.readLocked ( () -> m_aMap.forEach (aConsumer)); }
@IsLocked (ELockType.READ) protected final void internalForEachValue (@Nullable final Consumer <? super IMPLTYPE> aConsumer) { m_aRWLock.readLocked ( () -> m_aMap.forEachValue (aConsumer)); }
@Nonnull @ReturnsMutableCopy @IsLocked (ELockType.READ) public final <RETTYPE> ICommonsList <RETTYPE> getAllMapped (@Nullable final Predicate <? super INTERFACETYPE> aFilter, @Nonnull final Function <? super INTERFACETYPE, ? extends RETTYPE> aMapper) { return m_aRWLock.readLocked ( () -> m_aMap.copyOfValuesMapped (aFilter, aMapper)); }
@IsLocked (ELockType.READ) public final <RETTYPE> void findAllMapped (@Nullable final Predicate <? super INTERFACETYPE> aFilter, @Nonnull final Function <? super INTERFACETYPE, ? extends RETTYPE> aMapper, @Nonnull final Consumer <? super RETTYPE> aConsumer) { // (Runnable) cast for Java 9 m_aRWLock.readLocked ((Runnable) () -> CollectionHelper.findAllMapped (m_aMap.values (), aFilter, aMapper, aConsumer)); }
@IsLocked (ELockType.READ) public final boolean containsWithID (@Nullable final String sID) { if (StringHelper.hasNoText (sID)) return false; return m_aRWLock.readLocked ( () -> m_aMap.containsKey (sID)); }
@IsLocked (ELockType.READ) public final boolean containsNone (@Nullable final Predicate <? super INTERFACETYPE> aFilter) { return m_aRWLock.readLocked ( () -> CollectionHelper.containsNone (m_aMap.values (), aFilter)); }
@IsLocked (ELockType.READ) public final boolean containsOnly (@Nullable final Predicate <? super INTERFACETYPE> aFilter) { return m_aRWLock.readLocked ( () -> CollectionHelper.containsOnly (m_aMap.values (), aFilter)); }
@Nonnull @ReturnsMutableCopy @IsLocked (ELockType.READ) public final ICommonsList <INTERFACETYPE> getAll () { // Use new CommonsArrayList to get the return type to NOT use "? extends // INTERFACETYPE" return m_aRWLock.readLocked ( () -> new CommonsArrayList <> (m_aMap.values ())); }
@Nonnull @IsLocked (ELockType.WRITE) private ISMPBusinessCard _createSMPBusinessCard (@Nonnull final SMPBusinessCard aSMPBusinessCard) { m_aRWLock.writeLocked ( () -> { internalCreateItem (aSMPBusinessCard); }); AuditHelper.onAuditCreateSuccess (SMPBusinessCard.OT, aSMPBusinessCard.getID (), aSMPBusinessCard.getServiceGroupID (), Integer.valueOf (aSMPBusinessCard.getEntityCount ())); return aSMPBusinessCard; }
@Nonnull @IsLocked (ELockType.WRITE) private ISMPBusinessCard _updateSMPBusinessCard (@Nonnull final SMPBusinessCard aSMPBusinessCard) { m_aRWLock.writeLocked ( () -> { internalUpdateItem (aSMPBusinessCard); }); AuditHelper.onAuditModifySuccess (SMPBusinessCard.OT, aSMPBusinessCard.getID (), aSMPBusinessCard.getServiceGroupID (), Integer.valueOf (aSMPBusinessCard.getEntityCount ())); return aSMPBusinessCard; }