Package org.cyclos.impl.users
Class TransactionFeedbackServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.CRUDServiceImpl<E,A,DTO,D,DP>
-
- org.cyclos.impl.users.BaseReferenceServiceImpl<TransactionFeedback,QTransactionFeedback,TransactionFeedbackDTO,TransactionFeedbackEntryVO,TransactionFeedbackQuery,TransactionFeedbackData,TransactionVO>
-
- org.cyclos.impl.users.TransactionFeedbackServiceImpl
-
- All Implemented Interfaces:
CRUDServiceLocal<TransactionFeedback,TransactionFeedbackDTO,TransactionFeedbackData,TransactionVO>,TransactionFeedbackServiceLocal,CRUDService<TransactionFeedbackDTO,TransactionFeedbackData,TransactionVO>,CRUDWithConfirmationPasswordService<TransactionFeedbackDTO,TransactionFeedbackData,TransactionVO>,Service,TransactionFeedbackService
@Service public class TransactionFeedbackServiceImpl extends BaseReferenceServiceImpl<TransactionFeedback,QTransactionFeedback,TransactionFeedbackDTO,TransactionFeedbackEntryVO,TransactionFeedbackQuery,TransactionFeedbackData,TransactionVO> implements TransactionFeedbackServiceLocal
implementation forTransactionFeedbackService
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.users.BaseReferenceServiceImpl
entryVoClass, r
-
Fields inherited from class org.cyclos.impl.CRUDServiceImpl
$, ATTR_CURRENT_COPY, cacheHandler, dtoClass, entityClass, extensionPointService, idPath, internalNamePath, namePath, ownerEntityIdPath, ownerEntityPath, ownerEntityPropertyName, passwordHandler, richTextHandler, withConfirmationPassword
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, customFieldValueHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
-
Constructor Summary
Constructors Constructor Description TransactionFeedbackServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelAll(UserAccount account)Cancels all pending feedback for the given accountbooleancanComment(BasePayment payment)Whether the logged user can comment (i.e give) a feedback for the given payment.booleancanReply(BasePayment payment)Whether the logged user can reply a received feedback for the given payment.Longcomment(TransactionVO transaction, ReferenceLevel level, String comment)Creates or edits the comments for the feedback of the given payment (be it a direct/scheduled/recurring payment)protected DBQuery<?>crateStatisticsQuery(User owner, ReferenceType type, DatePeriod period)TransactionFeedbackcreateExpiredFeedback(BasePayment transaction)Create a defaultTransactionFeedback, when the time to provide a feedback has expiredprotected DBQuery<?>createSearchQuery(TransactionFeedbackQuery params)protected voiddoRemove(TransactionFeedback feedback, boolean flush)May be overridden in order to perform logical removing, instead of physical removing, or to remove some extra relationships as wellprotected TransactionFeedbackDatagetData(TransactionFeedback feedback)Returns details data for the given entityTransactionFeedbackDatagetDataFromTransaction(TransactionVO vo)Retrieve the data but from the transaction instead of using the feedback's idTransactionFeedbackDatagetGiveData(TransactionVO transaction)Return data for create or modify a feedback.TransactionFeedbackDatagetReplyData(TransactionVO transaction)Return data for reply for an already given feedback.
The logged user must be the payment's receiver withPermission.MY_TRANSACTION_FEEDBACKS_RECEIVEpermission.TransactionFeedbackSearchDatagetSearchData(UserLocatorVO locator)Returns data used for search, like results and statisticsTransactionFeedbackVOgetTransactionFeedback(TransactionVO transaction)Returns the transaction feedback related to the given paymentbooleanhasTransactionFeedbacks(User user)Returns if the given user has given or received feedbackbooleanisFeedbackEnabled(BasePayment payment)Whether the feedbacks are enabled for the given paymentList<UserVO>listIgnoredUsers()Returns all users ignored for feedbacks for the logged userbooleanmarkAsIgnored(UserLocatorVO locator, boolean ignored)Adds/Removes the given user to/from the logged user's ignore list for feedbacks.TransactionFeedbacknewEntity(TransactionVO transaction)Should be implemented in order to instantiate a new entity based on the given context parametersvoidnotifyTransactionFeedback(PaymentTransferType paymentTransferType)Notifies a transaction feedback in case transfer type has feedback enabled and configured to be sent after payment is doneprotected voidonAfterSave(TransactionFeedback feedback, TransactionFeedback currentCopy, Object dataFromOnBeforeSave)May be overridden in order to perform custom logic after saving an entityprotected ObjectonBeforeSave(TransactionFeedback entity, TransactionFeedback currentCopy)May be overridden in order to perform custom logic before saving an entity.TransactionFeedbackreadPaymentAsSystemAndGetFeedback(TransactionVO vo)Reads the payment as System and return the associated feedback if any.protected QReferenceref()voidremoveFromTransaction(TransactionVO vo)Removes (logically) the feedback associated to the given transaction.Longreply(TransactionVO transaction, String replyComments)Creates or edits the comments for the feedback of the given payment (be it a transfer os scheduled payment)protected ValidatorresolveValidator(TransactionFeedbackDTO dto)Page<TransactionResultVO>searchTransactionsAwaitingFeedback(TransactionsAwaitingFeedbackQuery query)Searches for transactions awaiting feedback by the given from user.voidsetFeedbackData(BasePayment payment, BasePaymentData paymentData)Set data related to feedbacksTransactionFeedbackDTOtoDTO(TransactionFeedback feedback)Converts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclassesprotected TransactionFeedbackEntryVOtoSearchResultEntry(TransactionFeedback feedback)voidupdateFeedbackFromTransaction(TransactionVO vo, TransactionFeedbackUpdateDTO update)Updates the feedback associated to the given transaction as an admin/broker-
Methods inherited from class org.cyclos.impl.users.BaseReferenceServiceImpl
countReceived, getReferenceLevels, getStatistics, registerNetworkMappings, removeAll, search
-
Methods inherited from class org.cyclos.impl.CRUDServiceImpl
addCustomInternalNameValidations, addCustomNameValidations, checkConfirmationPassword, find, findAll, from, getConfirmationPasswordInput, getConfirmationPasswordInputForRemove, getData, getDataForNew, getDeviceConfirmationParams, getEntityClass, getEntityInternalNameKey, getExcludedPropertiesToDTO, getExcludedPropertiesToEntity, getNameLabel, getUniqueInternalNameQuery, getUniqueNameQuery, isEntityInternalNameRequired, isNameRequired, load, logEntity, onAfterRemove, onBeforeRemove, preProcessCurrentCopy, remove, remove, removeAll, removeAll, removeAllWithConfirmationPassword, removeWithConfirmationPassword, resolveDTOType, resolveEntityType, resolveExtensionPointAccessor, save, saveOrder, saveSkippingEntityLog, saveWithConfirmationPassword, shouldCheckConfirmationPassword, subClassMappings, toEntity, validate
-
Methods inherited from class org.cyclos.impl.BaseServiceImpl
initializeNetworkMappings
-
Methods inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
canManage, checkManagesUser, checkPermission, checkRelatesToUser, checkValue, clearAlreadyValidated, getBaseEntityManagerHandler, getConfiguration, getLoggedBasicUser, getLoggedUser, getProducts, getTranslatedName, getTranslatedValue, hasPermission, hasValue, inSameNetwork, inSameNetworkOrGlobal, isAdmin, isAlreadyValidated, isBroker, isGlobalAdmin, isGlobalAdminInNetwork, isGuest, isLoggedIn, isMember, isMemberOnly, isNetworkAdmin, isOperator, isRelatedToUser, isSystem, isUserManager, isUserManagerOf, message, message, permission, permission, permissionOptionalValue, permissionOptionalValue, setAlreadyValidated, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, dataTranslationProxy, delete, detach, doDataTranslationProxy, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cyclos.services.CRUDService
getData, getDataForNew, load, remove, removeAll, save
-
Methods inherited from interface org.cyclos.impl.CRUDServiceLocal
find, findAll, getEntityClass, remove, removeAll, saveEntity, saveSkippingEntityLog, toEntity, validate
-
Methods inherited from interface org.cyclos.services.users.TransactionFeedbackService
getStatistics, search
-
Methods inherited from interface org.cyclos.impl.users.TransactionFeedbackServiceLocal
countReceived, removeAll
-
-
-
-
Method Detail
-
cancelAll
public void cancelAll(UserAccount account) throws FrameworkException
Description copied from interface:TransactionFeedbackServiceLocalCancels all pending feedback for the given account- Specified by:
cancelAllin interfaceTransactionFeedbackServiceLocal- Throws:
FrameworkException
-
canComment
public boolean canComment(BasePayment payment)
Description copied from interface:TransactionFeedbackServiceLocalWhether the logged user can comment (i.e give) a feedback for the given payment.- Specified by:
canCommentin interfaceTransactionFeedbackServiceLocal
-
canReply
public boolean canReply(BasePayment payment)
Description copied from interface:TransactionFeedbackServiceLocalWhether the logged user can reply a received feedback for the given payment.- Specified by:
canReplyin interfaceTransactionFeedbackServiceLocal
-
comment
public Long comment(TransactionVO transaction, ReferenceLevel level, String comment) throws FrameworkException, IllegalActionException
Description copied from interface:TransactionFeedbackServiceCreates or edits the comments for the feedback of the given payment (be it a direct/scheduled/recurring payment)- Specified by:
commentin interfaceTransactionFeedbackService- Throws:
IllegalActionException- When the given payment cannot receive a feedback comment (feedbacks not used, already replied or timed out)FrameworkException
-
createExpiredFeedback
public TransactionFeedback createExpiredFeedback(BasePayment transaction) throws FrameworkException
Description copied from interface:TransactionFeedbackServiceLocalCreate a defaultTransactionFeedback, when the time to provide a feedback has expired- Specified by:
createExpiredFeedbackin interfaceTransactionFeedbackServiceLocal- Throws:
FrameworkException
-
getDataFromTransaction
public TransactionFeedbackData getDataFromTransaction(TransactionVO vo)
Description copied from interface:TransactionFeedbackServiceRetrieve the data but from the transaction instead of using the feedback's id- Specified by:
getDataFromTransactionin interfaceTransactionFeedbackService
-
getGiveData
public TransactionFeedbackData getGiveData(TransactionVO transaction)
Description copied from interface:TransactionFeedbackServiceReturn data for create or modify a feedback. This method is similar to the#getDataForNew(TransactionVO)but it doesn't throw aPermissionDeniedExceptionThe logged user must be the payment's payer.- Specified by:
getGiveDatain interfaceTransactionFeedbackService
-
getReplyData
public TransactionFeedbackData getReplyData(TransactionVO transaction)
Description copied from interface:TransactionFeedbackServiceReturn data for reply for an already given feedback.
The logged user must be the payment's receiver withPermission.MY_TRANSACTION_FEEDBACKS_RECEIVEpermission.- Specified by:
getReplyDatain interfaceTransactionFeedbackService
-
getSearchData
public TransactionFeedbackSearchData getSearchData(UserLocatorVO locator) throws FrameworkException
Description copied from interface:TransactionFeedbackServiceReturns data used for search, like results and statistics- Specified by:
getSearchDatain interfaceTransactionFeedbackService- Throws:
FrameworkException
-
getTransactionFeedback
public TransactionFeedbackVO getTransactionFeedback(TransactionVO transaction) throws FrameworkException
Description copied from interface:TransactionFeedbackServiceReturns the transaction feedback related to the given payment- Specified by:
getTransactionFeedbackin interfaceTransactionFeedbackService- Throws:
FrameworkException
-
hasTransactionFeedbacks
public boolean hasTransactionFeedbacks(User user)
Description copied from interface:TransactionFeedbackServiceLocalReturns if the given user has given or received feedback- Specified by:
hasTransactionFeedbacksin interfaceTransactionFeedbackServiceLocal
-
isFeedbackEnabled
public boolean isFeedbackEnabled(BasePayment payment)
Description copied from interface:TransactionFeedbackServiceLocalWhether the feedbacks are enabled for the given payment- Specified by:
isFeedbackEnabledin interfaceTransactionFeedbackServiceLocal
-
listIgnoredUsers
public List<UserVO> listIgnoredUsers() throws FrameworkException
Description copied from interface:TransactionFeedbackServiceReturns all users ignored for feedbacks for the logged user- Specified by:
listIgnoredUsersin interfaceTransactionFeedbackService- Throws:
FrameworkException
-
markAsIgnored
public boolean markAsIgnored(UserLocatorVO locator, boolean ignored) throws FrameworkException
Description copied from interface:TransactionFeedbackServiceAdds/Removes the given user to/from the logged user's ignore list for feedbacks.- Specified by:
markAsIgnoredin interfaceTransactionFeedbackService- Returns:
- true if the user was not ignored and now is ignored and vice versa.
- Throws:
FrameworkException
-
newEntity
public TransactionFeedback newEntity(TransactionVO transaction)
Description copied from class:CRUDServiceImplShould be implemented in order to instantiate a new entity based on the given context parameters- Specified by:
newEntityin interfaceCRUDServiceLocal<TransactionFeedback,TransactionFeedbackDTO,TransactionFeedbackData,TransactionVO>- Specified by:
newEntityin classCRUDServiceImpl<TransactionFeedback,QTransactionFeedback,TransactionFeedbackDTO,TransactionFeedbackData,TransactionVO>
-
notifyTransactionFeedback
public void notifyTransactionFeedback(PaymentTransferType paymentTransferType)
Description copied from interface:TransactionFeedbackServiceLocalNotifies a transaction feedback in case transfer type has feedback enabled and configured to be sent after payment is done- Specified by:
notifyTransactionFeedbackin interfaceTransactionFeedbackServiceLocal
-
readPaymentAsSystemAndGetFeedback
public TransactionFeedback readPaymentAsSystemAndGetFeedback(TransactionVO vo) throws EntityNotFoundException
Reads the payment as System and return the associated feedback if any.
Otherwise it throws anEntityNotFoundException- Specified by:
readPaymentAsSystemAndGetFeedbackin interfaceTransactionFeedbackServiceLocal- Throws:
EntityNotFoundException- if there is no such payment or it hasn't got a feedback.
-
removeFromTransaction
public void removeFromTransaction(TransactionVO vo)
Description copied from interface:TransactionFeedbackServiceRemoves (logically) the feedback associated to the given transaction. It's used only by the REST layer because the paymentFeedback REST API works with transaction's id instead of feedback's id.
Only for admin/brokers with manage permission.- Specified by:
removeFromTransactionin interfaceTransactionFeedbackService
-
reply
public Long reply(TransactionVO transaction, String replyComments) throws FrameworkException, IllegalActionException
Description copied from interface:TransactionFeedbackServiceCreates or edits the comments for the feedback of the given payment (be it a transfer os scheduled payment)- Specified by:
replyin interfaceTransactionFeedbackService- Throws:
IllegalActionException- When the given payment cannot receive a feedback reply (feedbacks not used or timed out)FrameworkException
-
searchTransactionsAwaitingFeedback
public Page<TransactionResultVO> searchTransactionsAwaitingFeedback(TransactionsAwaitingFeedbackQuery query)
Description copied from interface:TransactionFeedbackServiceSearches for transactions awaiting feedback by the given from user. The logged must have permission to give feedback or manage feedback (manager)- Specified by:
searchTransactionsAwaitingFeedbackin interfaceTransactionFeedbackService
-
setFeedbackData
public void setFeedbackData(BasePayment payment, BasePaymentData paymentData)
Description copied from interface:TransactionFeedbackServiceLocalSet data related to feedbacks- Specified by:
setFeedbackDatain interfaceTransactionFeedbackServiceLocal
-
toDTO
public TransactionFeedbackDTO toDTO(TransactionFeedback feedback)
Description copied from class:CRUDServiceImplConverts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses- Specified by:
toDTOin interfaceCRUDServiceLocal<TransactionFeedback,TransactionFeedbackDTO,TransactionFeedbackData,TransactionVO>- Overrides:
toDTOin classCRUDServiceImpl<TransactionFeedback,QTransactionFeedback,TransactionFeedbackDTO,TransactionFeedbackData,TransactionVO>
-
updateFeedbackFromTransaction
public void updateFeedbackFromTransaction(TransactionVO vo, TransactionFeedbackUpdateDTO update) throws FrameworkException
Description copied from interface:TransactionFeedbackServiceUpdates the feedback associated to the given transaction as an admin/broker- Specified by:
updateFeedbackFromTransactionin interfaceTransactionFeedbackService- Throws:
FrameworkException
-
crateStatisticsQuery
protected DBQuery<?> crateStatisticsQuery(User owner, ReferenceType type, DatePeriod period)
-
createSearchQuery
protected DBQuery<?> createSearchQuery(TransactionFeedbackQuery params)
-
doRemove
protected void doRemove(TransactionFeedback feedback, boolean flush)
Description copied from class:CRUDServiceImplMay be overridden in order to perform logical removing, instead of physical removing, or to remove some extra relationships as well- Overrides:
doRemovein classCRUDServiceImpl<TransactionFeedback,QTransactionFeedback,TransactionFeedbackDTO,TransactionFeedbackData,TransactionVO>
-
getData
protected TransactionFeedbackData getData(TransactionFeedback feedback)
Description copied from class:CRUDServiceImplReturns details data for the given entity- Specified by:
getDatain classCRUDServiceImpl<TransactionFeedback,QTransactionFeedback,TransactionFeedbackDTO,TransactionFeedbackData,TransactionVO>
-
onAfterSave
protected void onAfterSave(TransactionFeedback feedback, TransactionFeedback currentCopy, Object dataFromOnBeforeSave)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic after saving an entity- Overrides:
onAfterSavein classCRUDServiceImpl<TransactionFeedback,QTransactionFeedback,TransactionFeedbackDTO,TransactionFeedbackData,TransactionVO>
-
onBeforeSave
protected Object onBeforeSave(TransactionFeedback entity, TransactionFeedback currentCopy)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic before saving an entity. Any returned value will be passed to theCRUDServiceImpl.onAfterSave(BaseEntity, BaseEntity, Object)method- Overrides:
onBeforeSavein classCRUDServiceImpl<TransactionFeedback,QTransactionFeedback,TransactionFeedbackDTO,TransactionFeedbackData,TransactionVO>
-
ref
protected QReference ref()
-
resolveValidator
protected Validator resolveValidator(TransactionFeedbackDTO dto)
- Specified by:
resolveValidatorin classCRUDServiceImpl<TransactionFeedback,QTransactionFeedback,TransactionFeedbackDTO,TransactionFeedbackData,TransactionVO>
-
toSearchResultEntry
protected TransactionFeedbackEntryVO toSearchResultEntry(TransactionFeedback feedback)
-
-