Java Code Examples for org.alfresco.util.PropertyCheck#mandatory()
The following examples show how to use
org.alfresco.util.PropertyCheck#mandatory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AuthorityDAOImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void afterPropertiesSet() throws Exception { PropertyCheck.mandatory(this, "aclDao", aclDao); PropertyCheck.mandatory(this, "authorityBridgeDAO", authorityBridgeDAO); PropertyCheck.mandatory(this, "authorityBridgeTableCache", authorityBridgeTableCache); PropertyCheck.mandatory(this, "authorityLookupCache", authorityLookupCache); PropertyCheck.mandatory(this, "cannedQueryRegistry", cannedQueryRegistry); PropertyCheck.mandatory(this, "childAuthorityCache", childAuthorityCache); PropertyCheck.mandatory(this, "dictionaryService", dictionaryService); PropertyCheck.mandatory(this, "namespacePrefixResolver", namespacePrefixResolver); PropertyCheck.mandatory(this, "nodeService", nodeService); PropertyCheck.mandatory(this, "personService", personService); PropertyCheck.mandatory(this, "policyComponent", policyComponent); PropertyCheck.mandatory(this, "searchService", searchService); PropertyCheck.mandatory(this, "storeRef", storeRef); PropertyCheck.mandatory(this, "tenantService", tenantService); PropertyCheck.mandatory(this, "userAuthorityCache", userAuthorityCache); PropertyCheck.mandatory(this, "zoneAuthorityCache", zoneAuthorityCache); PropertyCheck.mandatory(this, "storeRef", storeRef); PropertyCheck.mandatory(this, "storeRef", storeRef); authorityBridgeTableCache.register(this); }
Example 2
Source File: PostLookup.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Perform basic checks to ensure that the necessary dependencies were injected. */ private void checkProperties() { PropertyCheck.mandatory(this, "postDAO", postDAO); PropertyCheck.mandatory(this, "nodeService", nodeService); PropertyCheck.mandatory(this, "permissionService", permissionService); PropertyCheck.mandatory(this, "transactionService", transactionService); PropertyCheck.mandatory(this, "personService", personService); PropertyCheck.mandatory(this, "tenantService", tenantService); rollupTypes.put(ActivityType.FILE_ADDED, ActivityType.FILES_ADDED); rollupTypes.put(ActivityType.FILE_UPDATED, ActivityType.FILES_UPDATED); rollupTypes.put(ActivityType.FILE_DELETED, ActivityType.FILES_DELETED); rollupTypes.put(ActivityType.FOLDER_ADDED, ActivityType.FOLDERS_ADDED); rollupTypes.put(ActivityType.FOLDER_DELETED, ActivityType.FOLDERS_DELETED); }
Example 3
Source File: MoveCapableCommonRoutingContentStore.java From alfresco-simple-content-stores with Apache License 2.0 | 6 votes |
/** * * {@inheritDoc} */ @Override public void afterPropertiesSet() { PropertyCheck.mandatory(this, "applicationContext", this.applicationContext); PropertyCheck.mandatory(this, "policyComponent", this.policyComponent); PropertyCheck.mandatory(this, "dictionaryService", this.dictionaryService); PropertyCheck.mandatory(this, "nodeService", this.nodeService); PropertyCheck.mandatory(this, "storesByContentUrl", this.storesByContentUrl); PropertyCheck.mandatory(this, "fallbackStore", this.fallbackStore); if (this.allStores == null) { this.allStores = new ArrayList<>(); } if (!this.allStores.contains(this.fallbackStore)) { this.allStores.add(this.fallbackStore); } }
Example 4
Source File: TenantRoutingContentStore.java From alfresco-simple-content-stores with Apache License 2.0 | 6 votes |
private void afterPropertiesSet_setupStoreData() { PropertyCheck.mandatory(this, "storeByTenant", this.storeByTenant); if (this.allStores == null) { this.allStores = new ArrayList<>(); } for (final ContentStore store : this.storeByTenant.values()) { if (!this.allStores.contains(store)) { this.allStores.add(store); } } }
Example 5
Source File: FeedCleaner.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Perform basic checks to ensure that the necessary dependencies were injected. */ private void checkProperties() { PropertyCheck.mandatory(this, "feedDAO", feedDAO); PropertyCheck.mandatory(this, "policyComponent", policyComponent); PropertyCheck.mandatory(this, "nodeService", nodeService); PropertyCheck.mandatory(this, "jobLockService", jobLockService); // check the max age and max feed size if ((maxAgeMins <= 0) && (maxFeedSize <= 0)) { logger.warn("Neither maxAgeMins or maxFeedSize set - feeds will not be cleaned"); } }
Example 6
Source File: LoggerModuleComponent.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected void checkProperties() { PropertyCheck.mandatory(this, "message", message); // fulfil contract of override super.checkProperties(); }
Example 7
Source File: ResetPasswordServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
public void init() { PropertyCheck.mandatory(this, "workflowService", workflowService); PropertyCheck.mandatory(this, "activitiHistoryService", activitiHistoryService); PropertyCheck.mandatory(this, "actionService", actionService); PropertyCheck.mandatory(this, "personService", personService); PropertyCheck.mandatory(this, "nodeService", nodeService); PropertyCheck.mandatory(this, "sysAdminParams", sysAdminParams); PropertyCheck.mandatory(this, "authenticationService", authenticationService); PropertyCheck.mandatory(this, "activitiTaskService", activitiTaskService); PropertyCheck.mandatory(this, "emailHelper", emailHelper); PropertyCheck.mandatory(this, "clientAppConfig", clientAppConfig); PropertyCheck.mandatory(this, "defaultEmailSender", defaultEmailSender); }
Example 8
Source File: GetAuthoritiesCannedQueryFactory.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); PropertyCheck.mandatory(this, "tenantService", tenantService); PropertyCheck.mandatory(this, "nodeDAO", nodeDAO); PropertyCheck.mandatory(this, "qnameDAO", qnameDAO); PropertyCheck.mandatory(this, "cannedQueryDAO", cannedQueryDAO); PropertyCheck.mandatory(this, "methodSecurity", methodSecurity); }
Example 9
Source File: XmlMetadataExtracter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected void init() { PropertyCheck.mandatory(this, "selectors", selectors); // Get the base class to set up its mappings super.init(); }
Example 10
Source File: ActionsAspect.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
public void init() { PropertyCheck.mandatory(this, "policyComponent", policyComponent); PropertyCheck.mandatory(this, "behaviourFilter", behaviourFilter); PropertyCheck.mandatory(this, "ruleService", ruleService); PropertyCheck.mandatory(this, "nodeService", nodeService); this.policyComponent.bindAssociationBehaviour( NodeServicePolicies.OnDeleteAssociationPolicy.QNAME, ActionModel.TYPE_ACTION_SCHEDULE, ActionModel.ASSOC_SCHEDULED_ACTION, new JavaBehaviour(this, "onDeleteAssociation")); this.policyComponent.bindClassBehaviour( CopyServicePolicies.OnCopyNodePolicy.QNAME, ActionModel.ASPECT_ACTIONS, new JavaBehaviour(this, "getCopyCallback")); this.policyComponent.bindClassBehaviour( CopyServicePolicies.OnCopyCompletePolicy.QNAME, ActionModel.ASPECT_ACTIONS, new JavaBehaviour(this, "onCopyComplete")); this.policyComponent.bindClassBehaviour( QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"), ActionModel.ASPECT_ACTIONS, new JavaBehaviour(this, "onAddAspect")); }
Example 11
Source File: UserUsageTrackingComponent.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Spring bean init method */ public void init() { PropertyCheck.mandatory(this, "jobLockService", jobLockService); if (enabled) { this.policyComponent.bindClassBehaviour(OnCreateNodePolicy.QNAME, ContentModel.TYPE_PERSON, new JavaBehaviour(this, "onCreateNode")); } }
Example 12
Source File: NonTransactionalRuleContentDiskDriver.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
public void init() { PropertyCheck.mandatory(this, "diskInterface", diskInterface); PropertyCheck.mandatory(this, "ruleEvaluator", getRuleEvaluator()); PropertyCheck.mandatory(this, "repositoryDiskInterface", getRepositoryDiskInterface()); PropertyCheck.mandatory(this, "commandExecutor", getCommandExecutor()); }
Example 13
Source File: PropTablesCleaner.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
public void checkProperties() { PropertyCheck.mandatory(this, "jobLockService", jobLockService); PropertyCheck.mandatory(this, "propertyValueDAO", propertyValueDAO); PropertyCheck.mandatory(this, "globalProperties", globalProperties); }
Example 14
Source File: CannedQueryDAOImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void init() { super.init(); PropertyCheck.mandatory(this, "template", template); }
Example 15
Source File: ContentDataAttributesInitializer.java From alfresco-simple-content-stores with Apache License 2.0 | 4 votes |
/** * * {@inheritDoc} */ @Override public void afterPropertiesSet() { PropertyCheck.mandatory(this, "nodeService", this.nodeService); }
Example 16
Source File: AbstractDocLink.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 4 votes |
protected NodeRef parseNodeRefFromTemplateArgs(Map<String, String> templateVars) { if (templateVars == null) { return null; } String storeTypeArg = templateVars.get(PARAM_STORE_TYPE); String storeIdArg = templateVars.get(PARAM_STORE_ID); String idArg = templateVars.get(PARAM_ID); if (storeTypeArg != null) { ParameterCheck.mandatoryString("storeTypeArg", storeTypeArg); ParameterCheck.mandatoryString("storeIdArg", storeIdArg); ParameterCheck.mandatoryString("idArg", idArg); /* * NodeRef based request * <url>URL_BASE/{store_type}/{store_id}/{id}</url> */ return new NodeRef(storeTypeArg, storeIdArg, idArg); } else { String siteArg = templateVars.get(PARAM_SITE); String containerArg = templateVars.get(PARAM_CONTAINER); String pathArg = templateVars.get(PARAM_PATH); if (siteArg != null) { ParameterCheck.mandatoryString("siteArg", siteArg); ParameterCheck.mandatoryString("containerArg", containerArg); /* * Site based request <url>URL_BASE/{site}/{container}</url> or * <url>URL_BASE/{site}/{container}/{path}</url> */ SiteInfo site = siteService.getSite(siteArg); PropertyCheck.mandatory(this, "site", site); NodeRef node = siteService.getContainer(site.getShortName(), containerArg); if (node == null) { throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Invalid 'container' variable"); } if (pathArg != null) { // <url>URL_BASE/{site}/{container}/{path}</url> StringTokenizer st = new StringTokenizer(pathArg, "/"); while (st.hasMoreTokens()) { String childName = st.nextToken(); node = nodeService.getChildByName(node, ContentModel.ASSOC_CONTAINS, childName); if (node == null) { throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Invalid 'path' variable"); } } } return node; } } return null; }
Example 17
Source File: TenantAwareUserNameGenerator.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
public void init() { PropertyCheck.mandatory(this, "tenantService", tenantService); PropertyCheck.mandatory(this, "generator", generator); }
Example 18
Source File: ValueDataTypeValidatorImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * Checks that all necessary services have been provided. */ public void init() { PropertyCheck.mandatory(this, "namespaceService", namespaceService); PropertyCheck.mandatory(this, "dictionaryService", dictionaryService); }
Example 19
Source File: CustomModelDownloadRelation.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void afterPropertiesSet() throws Exception { PropertyCheck.mandatory(this, "customModels", customModels); }
Example 20
Source File: DocumentLinkServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Override public NodeRef createDocumentLink(final NodeRef source, NodeRef destination) { if (logger.isDebugEnabled()) { logger.debug("Creating document link. source: " + source + ", destination: " + destination); } /* Validate input */ PropertyCheck.mandatory(this, "source", source); PropertyCheck.mandatory(this, "destination", destination); // check if source node exists if (!nodeService.exists(source)) { throw new IllegalArgumentException("Source NodeRef '" + source + "' does not exist"); } // check if destination node exists if (!nodeService.exists(destination)) { throw new IllegalArgumentException("Destination NodeRef '" + destination + "' does not exist"); } // check if destination node is a directory if (!dictionaryService.isSubClass(nodeService.getType(destination), ContentModel.TYPE_FOLDER)) { throw new IllegalArgumentException("Destination node NodeRef '" + source + "' must be of type " + ContentModel.TYPE_FOLDER); } /* Create link */ String sourceName = (String) nodeService.getProperty(source, ContentModel.PROP_NAME); String newName = sourceName + LINK_NODE_EXTENSION; newName = I18NUtil.getMessage(LINK_TO_LABEL, newName); Map<QName, Serializable> props = new HashMap<QName, Serializable>(); props.put(ContentModel.PROP_NAME, newName); props.put(ContentModel.PROP_LINK_DESTINATION, source); props.put(ContentModel.PROP_TITLE, newName); props.put(ContentModel.PROP_DESCRIPTION, newName); QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName(newName)); ChildAssociationRef childRef = null; QName sourceType = nodeService.getType(source); if (checkOutCheckInService.isWorkingCopy(source) || nodeService.hasAspect(source, ContentModel.ASPECT_LOCKABLE)) { throw new IllegalArgumentException("Cannot perform operation since the node (id:" + source.getId() + ") is locked."); } try { if (dictionaryService.isSubClass(sourceType, ContentModel.TYPE_CONTENT)) { // create File Link node childRef = nodeService.createNode(destination, ContentModel.ASSOC_CONTAINS, assocQName, ApplicationModel.TYPE_FILELINK, props); } else if (!dictionaryService.isSubClass(sourceType, SiteModel.TYPE_SITE) && dictionaryService.isSubClass(nodeService.getType(source), ContentModel.TYPE_FOLDER)) { // create Folder link node props.put(ApplicationModel.PROP_ICON, "space-icon-link"); childRef = nodeService.createNode(destination, ContentModel.ASSOC_CONTAINS, assocQName, ApplicationModel.TYPE_FOLDERLINK, props); } else { throw new IllegalArgumentException("Unsupported source node type : " + nodeService.getType(source)); } } catch (DuplicateChildNodeNameException ex) { throw new IllegalArgumentException("A file with the name '" + newName + "' already exists in the destination folder", ex); } // add linked aspect to the sourceNode - run as System AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>() { public Void doWork() throws Exception { behaviourFilter.disableBehaviour(source, ContentModel.ASPECT_AUDITABLE); try { nodeService.addAspect(source, ApplicationModel.ASPECT_LINKED, null); } finally { behaviourFilter.enableBehaviour(source, ContentModel.ASPECT_AUDITABLE); } return null; } }, AuthenticationUtil.getSystemUserName()); return childRef.getChildRef(); }