use of com.helger.commons.state.EChange in project phase4 by phax.
the class AS4ProfileManager method setDefaultProfile.
public void setDefaultProfile(@Nullable final IAS4Profile aAS4Profile) {
final EChange eChanged = m_aRWLock.writeLockedGet(() -> {
if (EqualsHelper.equals(aAS4Profile, m_aDefaultProfile))
return EChange.UNCHANGED;
m_aDefaultProfile = aAS4Profile;
return EChange.CHANGED;
});
if (eChanged.isChanged())
if (aAS4Profile == null)
LOGGER.info("Removed the default AS4 profile");
else
LOGGER.info("Set the default AS4 profile to '" + aAS4Profile.getID() + "'" + (aAS4Profile.isDeprecated() ? " which is deprecated" : ""));
}
use of com.helger.commons.state.EChange in project ph-web by phax.
the class RequestWebScopeMultipart method addSpecialRequestParams.
@Override
@OverrideOnDemand
protected EChange addSpecialRequestParams() {
// Parse as multipart if the Content-Type matches, and add each item into
// params()
final EChange ret = RequestMultipartHelper.handleMultipartFormData(m_aHttpRequest, params()::putIn);
m_bParsedMultipart = ret.isChanged();
return ret;
}
use of com.helger.commons.state.EChange in project phoss-directory by phax.
the class SMLInfoManager method updateSMLInfo.
@Nonnull
public EChange updateSMLInfo(@Nullable final String sSMLInfoID, @Nonnull @Nonempty final String sDisplayName, @Nonnull @Nonempty final String sDNSZone, @Nonnull @Nonempty final String sManagementServiceURL, final boolean bClientCertificateRequired) {
final SMLInfo aSMLInfo = getOfID(sSMLInfoID);
if (aSMLInfo == null) {
AuditHelper.onAuditModifyFailure(SMLInfo.OT, sSMLInfoID, "no-such-id");
return EChange.UNCHANGED;
}
m_aRWLock.writeLock().lock();
try {
EChange eChange = EChange.UNCHANGED;
eChange = eChange.or(aSMLInfo.setDisplayName(sDisplayName));
eChange = eChange.or(aSMLInfo.setDNSZone(sDNSZone));
eChange = eChange.or(aSMLInfo.setManagementServiceURL(sManagementServiceURL));
eChange = eChange.or(aSMLInfo.setClientCertificateRequired(bClientCertificateRequired));
if (eChange.isUnchanged())
return EChange.UNCHANGED;
internalUpdateItem(aSMLInfo);
} finally {
m_aRWLock.writeLock().unlock();
}
AuditHelper.onAuditModifySuccess(SMLInfo.OT, "all", sSMLInfoID, sDisplayName, sDNSZone, sManagementServiceURL, Boolean.valueOf(bClientCertificateRequired));
return EChange.CHANGED;
}
use of com.helger.commons.state.EChange in project phive by phax.
the class ValidationExecutorSetRegistry method removeAll.
/**
* This is a cleanup method that frees all resources when they are no longer
* needed. This removes all registered validators.
*
* @param bCleanVES
* This may be helpful because some {@link IValidationExecutor}
* implementations contained in the {@link IValidationExecutorSet}
* contained in this registry might have strong references to
* {@link ClassLoader} instances. By passing <code>true</code>,
* {@link ValidationExecutorSet#removeAllExecutors()} is invoked on all
* matching validation executor sets.
* @return {@link EChange}
* @since 6.0.1
*/
@Nonnull
public EChange removeAll(final boolean bCleanVES) {
EChange ret = EChange.UNCHANGED;
m_aRWLock.writeLock().lock();
try {
if (m_aMap.isNotEmpty()) {
ret = EChange.CHANGED;
if (bCleanVES)
for (final IValidationExecutorSet<?> aVES : m_aMap.values()) if (aVES instanceof ValidationExecutorSet)
((ValidationExecutorSet<?>) aVES).removeAllExecutors();
m_aMap.clear();
}
} finally {
m_aRWLock.writeLock().unlock();
}
if (ret.isChanged())
if (LOGGER.isDebugEnabled())
LOGGER.debug("Successfully removed all validatione executor sets" + (bCleanVES ? " and cleaned all VES." : "."));
return ret;
}
use of com.helger.commons.state.EChange in project phase4 by phax.
the class PModeManagerInMemory method updatePMode.
@Nonnull
public EChange updatePMode(@Nonnull final IPMode aNewPMode) {
ValueEnforcer.notNull(aNewPMode, "PMode");
_validatePMode(aNewPMode);
final PMode aExistingPMode = getOfID(aNewPMode.getID());
if (aExistingPMode == null || aExistingPMode.isDeleted())
return EChange.UNCHANGED;
m_aRWLock.writeLock().lock();
try {
EChange eChange = EChange.UNCHANGED;
eChange = eChange.or(aExistingPMode.setInitiator(aNewPMode.getInitiator()));
eChange = eChange.or(aExistingPMode.setResponder(aNewPMode.getResponder()));
eChange = eChange.or(aExistingPMode.setAgreement(aNewPMode.getAgreement()));
eChange = eChange.or(aExistingPMode.setMEP(aNewPMode.getMEP()));
eChange = eChange.or(aExistingPMode.setMEPBinding(aNewPMode.getMEPBinding()));
eChange = eChange.or(aExistingPMode.setLeg1(aNewPMode.getLeg1()));
eChange = eChange.or(aExistingPMode.setLeg2(aNewPMode.getLeg2()));
eChange = eChange.or(aExistingPMode.setPayloadService(aNewPMode.getPayloadService()));
eChange = eChange.or(aExistingPMode.setReceptionAwareness(aNewPMode.getReceptionAwareness()));
if (eChange.isUnchanged())
return EChange.UNCHANGED;
BusinessObjectHelper.setLastModificationNow(aExistingPMode);
} finally {
m_aRWLock.writeLock().unlock();
}
if (LOGGER.isDebugEnabled())
LOGGER.debug("Updated PMode with ID '" + aNewPMode.getID() + "'");
return EChange.CHANGED;
}
Aggregations