Package org.alfresco.service.cmr.model

Examples of org.alfresco.service.cmr.model.FileInfo


  private ServiceRegistry serviceRegistry;
  @Autowired
  private RepositoryService repositoryService;

  public void createFolder(String name, QName type, NodeRef parent, Map<String, Object> data) {
    FileInfo fileInfo = serviceRegistry.getFileFolderService().create(parent, name, type);
    NodeRef nodeRef = fileInfo.getNodeRef();
    serviceRegistry.getNodeService().addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, null);
    Map<QName, Serializable> properties = serviceRegistry.getNodeService().getProperties(nodeRef);
    for (String key : data.keySet()) {
      properties.put(QName.createQName(key, serviceRegistry.getNamespaceService()), (Serializable) data.get(key));
    }
View Full Code Here


  }

  public void createDocument(NodeRef folderRef, Content content) {
    String fileName = content.getName();
    FileInfo fileInfo = serviceRegistry.getFileFolderService().create(folderRef, fileName,
        ContentModel.TYPE_CONTENT);
    NodeRef fileNodeRef = fileInfo.getNodeRef();
    serviceRegistry.getNodeService().addAspect(fileNodeRef, ContentModel.ASPECT_AUTHOR, null);
    serviceRegistry.getNodeService().addAspect(fileNodeRef, ContentModel.ASPECT_TITLED, null);
    Map<QName, Serializable> props = serviceRegistry.getNodeService().getProperties(fileNodeRef);
    props.put(ContentModel.PROP_CREATED, new Date());
    String currentUserName = serviceRegistry.getAuthenticationService().getCurrentUserName();
View Full Code Here

        NodeRef rootNode = nodeService.getRootNode(targetLocation.getStoreRef());
        final List<NodeRef> parentNodes = searchService.selectNodes(rootNode, targetLocation.getPath(), null, namespaceService, false);
        Assert.isTrue(parentNodes.size() == 1, "Target location leads to not 1 unique Node reference");

        final String fileName = resource.getFilename();
        final FileInfo fileInfo = fileFolderService.create(parentNodes.get(0), fileName, nodeType);
        final NodeRef nodeRef = fileInfo.getNodeRef();

        final ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
        writer.putContent(resource.getInputStream());

        if (mimetype == null) {
View Full Code Here

TOP

Related Classes of org.alfresco.service.cmr.model.FileInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.