Package org.cyclos.impl.marketplace
Class AdQuestionServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.marketplace.AdQuestionServiceImpl
-
- All Implemented Interfaces:
AdQuestionServiceLocal,AdQuestionService,Service
@Service public class AdQuestionServiceImpl extends BaseServiceImpl implements AdQuestionServiceLocal
Implementation forAdQuestionService
-
-
Field Summary
-
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 AdQuestionServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidanswer(Long id, String answer)Saves the answer for the given question For theanswerparameter we don't use the ValidationApi because it is validated in the service implementation to allow send a properly validation message.Longask(BasicAdVO adVO, String text)Creates a new question for the given ad For thequestionparameter we don't use the ValidationApi because it is validated in the service implementation to allow send a properly validation message.booleancanManageQuestionsAsBuyer(AdType adType)Returns true if the logged user is able to manage questions (e.g ask, remove) over the given adType as a buyer (i.e not the ad's owner).booleanisQuestionsEnabled(AdType adType, User owner)Returns true if the ad's owner has enabled ads questions for the given type.List<AdQuestionVO>list(BasicAdVO adVO)Returns the questions for the given adAdQuestionVOload(Long id)Loads a question by id.
Only if the logged user can ask for or it's the owner of the related advertisement.protected voidregisterNetworkMappings(NetworkPathRegistry networkPathRegistry)Needs to be overridden by subclasses to register the path up to the networkvoidremove(Long id)Removes a questionPage<AdQuestionVO>search(AdQuestionQuery params)Searches for unanswered questions-
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, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, delete, detach, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
-
-
-
Method Detail
-
answer
public void answer(Long id, String answer) throws FrameworkException, IllegalActionException
Description copied from interface:AdQuestionServiceSaves the answer for the given question For theanswerparameter we don't use the ValidationApi because it is validated in the service implementation to allow send a properly validation message.- Specified by:
answerin interfaceAdQuestionService- Throws:
IllegalActionException- If the given question was already answeredFrameworkException
-
ask
public Long ask(BasicAdVO adVO, String text) throws FrameworkException
Description copied from interface:AdQuestionServiceCreates a new question for the given ad For thequestionparameter we don't use the ValidationApi because it is validated in the service implementation to allow send a properly validation message.- Specified by:
askin interfaceAdQuestionService- Throws:
FrameworkException
-
canManageQuestionsAsBuyer
public boolean canManageQuestionsAsBuyer(AdType adType)
Description copied from interface:AdQuestionServiceLocalReturns true if the logged user is able to manage questions (e.g ask, remove) over the given adType as a buyer (i.e not the ad's owner). To know if the questions are enabled for the ad's owner seeAdQuestionServiceLocal.isQuestionsEnabled(AdType, User)- Specified by:
canManageQuestionsAsBuyerin interfaceAdQuestionServiceLocal
-
isQuestionsEnabled
public boolean isQuestionsEnabled(AdType adType, User owner)
Description copied from interface:AdQuestionServiceLocalReturns true if the ad's owner has enabled ads questions for the given type.- Specified by:
isQuestionsEnabledin interfaceAdQuestionServiceLocal
-
list
public List<AdQuestionVO> list(BasicAdVO adVO)
Description copied from interface:AdQuestionServiceReturns the questions for the given ad- Specified by:
listin interfaceAdQuestionService
-
load
public AdQuestionVO load(Long id) throws FrameworkException
Description copied from interface:AdQuestionServiceLoads a question by id.
Only if the logged user can ask for or it's the owner of the related advertisement.- Specified by:
loadin interfaceAdQuestionService- Throws:
FrameworkException
-
remove
public void remove(Long id) throws FrameworkException
Description copied from interface:AdQuestionServiceRemoves a question- Specified by:
removein interfaceAdQuestionService- Throws:
FrameworkException
-
search
public Page<AdQuestionVO> search(AdQuestionQuery params)
Description copied from interface:AdQuestionServiceSearches for unanswered questions- Specified by:
searchin interfaceAdQuestionService
-
registerNetworkMappings
protected void registerNetworkMappings(NetworkPathRegistry networkPathRegistry)
Description copied from class:BaseServiceImplNeeds to be overridden by subclasses to register the path up to the network- Specified by:
registerNetworkMappingsin classBaseServiceImpl
-
-