Class DocumentServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.CRUDServiceImpl<Document,QDocument,DocumentDTO,DocumentData,DocumentDataParams>
-
- org.cyclos.impl.contentmanagement.DocumentServiceImpl
-
- All Implemented Interfaces:
DocumentServiceLocal,CRUDServiceLocal<Document,DocumentDTO,DocumentData,DocumentDataParams>,DocumentService,CRUDService<DocumentDTO,DocumentData,DocumentDataParams>,CRUDWithConfirmationPasswordService<DocumentDTO,DocumentData,DocumentDataParams>,Service
@Service public class DocumentServiceImpl extends CRUDServiceImpl<Document,QDocument,DocumentDTO,DocumentData,DocumentDataParams> implements DocumentServiceLocal
Implementation forDocumentService
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.CRUDServiceImpl
$, ATTR_CURRENT_COPY, cacheHandler, dtoClass, entityClass, extensionPointService, idPath, internalNamePath, namePath, ownerEntityIdPath, ownerEntityPath, ownerEntityPropertyName, passwordHandler, withConfirmationPassword
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
Fields inherited from interface org.cyclos.impl.contentmanagement.DocumentServiceLocal
ATTR_DOCUMENT
-
-
Constructor Summary
Constructors Constructor Description DocumentServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DocumentDatagetData(Document document)Returns details data for the given entityDocumentVOgetDocument(DocumentVO documentVO)Used to get the view only object of the documentintgetDocumentCount(User user)Returns the documents count for the given userRawFileVOgetDocumentFile(DocumentVO documentVO)Return the file vo for a given documentDocumentSearchDatagetDocumentSearchData(UserLocatorVO locator)Returns data used to search documents, either over the given user or general documentsProcessDynamicDocumentDatagetProcessDynamicDocumentData(DocumentVO documentVO, UserLocatorVO locator)Returns data used to fill a dynamic document based on the given user locator dataprotected Pair<DBQuery<?>,String>getUniqueInternalNameQuery(DocumentDTO dto)We override this method because in the case of UserDocument the owner is the user instead of the category as specified in the entity withOwnerEntityprotected Pair<DBQuery<?>,String>getUniqueNameQuery(DocumentDTO dto)We override this method because in the case of UserDocument the owner is the user instead of the category as specified in the entity withOwnerEntitybooleanhasDocuments(User user)Return true if the member have at least one document to viewbooleanhasIndividualDocuments(User user)Returns true if the user have at least one individual document to viewbooleanhasSharedDocuments(User user)Returns true if the user have at least one shared document to viewList<DocumentVO>listUserDocuments(UserLocatorVO locator)List all documents enabled for the given userDocumentnewEntity(DocumentDataParams params)Should be implemented in order to instantiate a new entity based on the given context parametersprotected voidonBeforeRemove(Document doc)May be overridden in order to perform custom logic before removing an entityprotected ObjectonBeforeSave(Document entity, Document currentCopy)May be overridden in order to perform custom logic before saving an entity.StringprocessDynamicDocument(ProcessDynamicDocumentDTO params)Processes the given document using the given user and custom field valuesSerializableInputStreamreadContent(DocumentVO documentVO)Reads the contents of the documentprotected voidregisterNetworkMappings(NetworkPathRegistry networkPathRegistry)Needs to be overridden by subclasses to register the path up to the networkvoidremoveAll(User user)Remove all indivitual documents for the given userprotected ValidatorresolveValidator(DocumentDTO dto)voidsaveFile(DocumentVO documentVO, String contentType, String fileName, SerializableInputStream contents)Saves the given document, returning the generated identifierLongsaveWithFile(DocumentDTO document, String contentType, String fileName, SerializableInputStream contents)Saves the given document and filePage<DocumentVO>search(DocumentQuery params)List all documents filtered by categoryprotected org.apache.commons.collections4.BidiMap<Class<? extends Document>,Class<? extends DocumentDTO>>subClassMappings()Should be overridden by subclasses which handle entity / dto hierarchies.-
Methods inherited from class org.cyclos.impl.CRUDServiceImpl
addCustomInternalNameValidations, addCustomNameValidations, checkConfirmationPassword, doRemove, find, findAll, from, getConfirmationPasswordInput, getConfirmationPasswordInputForRemove, getData, getDataForNew, getDeviceConfirmationParams, getEntityClass, getEntityInternalNameKey, getExcludedPropertiesToDTO, getExcludedPropertiesToEntity, getNameLabel, isEntityInternalNameRequired, isNameRequired, load, logEntity, onAfterRemove, onAfterSave, preProcessCurrentCopy, remove, remove, removeAll, removeAll, removeAllWithConfirmationPassword, removeWithConfirmationPassword, resolveDTOType, resolveEntityType, resolveExtensionPointAccessor, save, saveOrder, saveSkippingEntityLog, saveWithConfirmationPassword, shouldCheckConfirmationPassword, toDTO, 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, 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
-
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, toDTO, toEntity, validate
-
-
-
-
Method Detail
-
getDocument
public DocumentVO getDocument(DocumentVO documentVO)
Description copied from interface:DocumentServiceUsed to get the view only object of the document- Specified by:
getDocumentin interfaceDocumentService
-
getDocumentCount
public int getDocumentCount(User user)
Description copied from interface:DocumentServiceLocalReturns the documents count for the given user- Specified by:
getDocumentCountin interfaceDocumentServiceLocal
-
getDocumentFile
public RawFileVO getDocumentFile(DocumentVO documentVO)
Description copied from interface:DocumentServiceReturn the file vo for a given document- Specified by:
getDocumentFilein interfaceDocumentService
-
getDocumentSearchData
public DocumentSearchData getDocumentSearchData(UserLocatorVO locator) throws FrameworkException
Description copied from interface:DocumentServiceReturns data used to search documents, either over the given user or general documents- Specified by:
getDocumentSearchDatain interfaceDocumentService- Throws:
FrameworkException
-
getProcessDynamicDocumentData
public ProcessDynamicDocumentData getProcessDynamicDocumentData(DocumentVO documentVO, UserLocatorVO locator)
Description copied from interface:DocumentServiceReturns data used to fill a dynamic document based on the given user locator data- Specified by:
getProcessDynamicDocumentDatain interfaceDocumentService
-
hasDocuments
public boolean hasDocuments(User user)
Description copied from interface:DocumentServiceLocalReturn true if the member have at least one document to view- Specified by:
hasDocumentsin interfaceDocumentServiceLocal
-
hasIndividualDocuments
public boolean hasIndividualDocuments(User user) throws FrameworkException
Description copied from interface:DocumentServiceLocalReturns true if the user have at least one individual document to view- Specified by:
hasIndividualDocumentsin interfaceDocumentServiceLocal- Throws:
FrameworkException
-
hasSharedDocuments
public boolean hasSharedDocuments(User user) throws FrameworkException
Description copied from interface:DocumentServiceLocalReturns true if the user have at least one shared document to view- Specified by:
hasSharedDocumentsin interfaceDocumentServiceLocal- Throws:
FrameworkException
-
listUserDocuments
public List<DocumentVO> listUserDocuments(UserLocatorVO locator) throws FrameworkException
Description copied from interface:DocumentServiceList all documents enabled for the given user- Specified by:
listUserDocumentsin interfaceDocumentService- Throws:
FrameworkException
-
newEntity
public Document newEntity(DocumentDataParams params)
Description copied from class:CRUDServiceImplShould be implemented in order to instantiate a new entity based on the given context parameters- Specified by:
newEntityin interfaceCRUDServiceLocal<Document,DocumentDTO,DocumentData,DocumentDataParams>- Specified by:
newEntityin classCRUDServiceImpl<Document,QDocument,DocumentDTO,DocumentData,DocumentDataParams>
-
processDynamicDocument
public String processDynamicDocument(ProcessDynamicDocumentDTO params) throws ValidationException
Description copied from interface:DocumentServiceProcesses the given document using the given user and custom field values- Specified by:
processDynamicDocumentin interfaceDocumentService- Throws:
ValidationException
-
readContent
public SerializableInputStream readContent(DocumentVO documentVO)
Description copied from interface:DocumentServiceReads the contents of the document- Specified by:
readContentin interfaceDocumentService
-
removeAll
public void removeAll(User user)
Description copied from interface:DocumentServiceLocalRemove all indivitual documents for the given user- Specified by:
removeAllin interfaceDocumentServiceLocal
-
saveFile
public void saveFile(DocumentVO documentVO, String contentType, String fileName, SerializableInputStream contents)
Description copied from interface:DocumentServiceSaves the given document, returning the generated identifier- Specified by:
saveFilein interfaceDocumentService
-
saveWithFile
public Long saveWithFile(DocumentDTO document, String contentType, String fileName, SerializableInputStream contents)
Description copied from interface:DocumentServiceSaves the given document and file- Specified by:
saveWithFilein interfaceDocumentService
-
search
public Page<DocumentVO> search(DocumentQuery params)
Description copied from interface:DocumentServiceList all documents filtered by category- Specified by:
searchin interfaceDocumentService
-
getData
protected DocumentData getData(Document document)
Description copied from class:CRUDServiceImplReturns details data for the given entity- Specified by:
getDatain classCRUDServiceImpl<Document,QDocument,DocumentDTO,DocumentData,DocumentDataParams>
-
getUniqueInternalNameQuery
protected Pair<DBQuery<?>,String> getUniqueInternalNameQuery(DocumentDTO dto)
We override this method because in the case of UserDocument the owner is the user instead of the category as specified in the entity withOwnerEntity- Overrides:
getUniqueInternalNameQueryin classCRUDServiceImpl<Document,QDocument,DocumentDTO,DocumentData,DocumentDataParams>
-
getUniqueNameQuery
protected Pair<DBQuery<?>,String> getUniqueNameQuery(DocumentDTO dto)
We override this method because in the case of UserDocument the owner is the user instead of the category as specified in the entity withOwnerEntity- Overrides:
getUniqueNameQueryin classCRUDServiceImpl<Document,QDocument,DocumentDTO,DocumentData,DocumentDataParams>
-
onBeforeRemove
protected void onBeforeRemove(Document doc)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic before removing an entity- Overrides:
onBeforeRemovein classCRUDServiceImpl<Document,QDocument,DocumentDTO,DocumentData,DocumentDataParams>
-
onBeforeSave
protected Object onBeforeSave(Document entity, Document 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<Document,QDocument,DocumentDTO,DocumentData,DocumentDataParams>
-
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
-
resolveValidator
protected Validator resolveValidator(DocumentDTO dto)
- Specified by:
resolveValidatorin classCRUDServiceImpl<Document,QDocument,DocumentDTO,DocumentData,DocumentDataParams>
-
subClassMappings
protected org.apache.commons.collections4.BidiMap<Class<? extends Document>,Class<? extends DocumentDTO>> subClassMappings()
Description copied from class:CRUDServiceImplShould be overridden by subclasses which handle entity / dto hierarchies. The map key should be the entity class, while the map value, the DTO class- Overrides:
subClassMappingsin classCRUDServiceImpl<Document,QDocument,DocumentDTO,DocumentData,DocumentDataParams>
-
-