Search in sources :

Example 1 with Visibility

use of org.alfresco.repo.model.filefolder.HiddenAspect.Visibility in project alfresco-repository by Alfresco.

the class AbstractEventsService method getNodeInfo.

protected NodeInfo getNodeInfo(final NodeRef nodeRef, final String eventType) {
    NodeInfo nodeInfo = AuthenticationUtil.runAsSystem(new RunAsWork<NodeInfo>() {

        public NodeInfo doWork() throws Exception {
            NodeInfo nodeInfo = null;
            String txnId = AlfrescoTransactionSupport.getTransactionId();
            if (!includeEventType(eventType)) {
                nodeInfo = new NodeInfo(eventType, null, null, nodeRef, null, null, null, null, null, null, null, null, false, null, null);
            } else if (nodeRef == null || !nodeService.exists(nodeRef)) {
                nodeInfo = new NodeInfo(eventType, txnId, null, nodeRef, null, null, null, null, null, null, null, false, true, false, null);
            } else {
                FileFilterMode.Client filterclient = FileFilterMode.getClient();
                Visibility visibility = hiddenAspect.getVisibility(filterclient, nodeRef);
                QName type = nodeService.getType(nodeRef);
                if (!typeMatches(type)) {
                    nodeInfo = new NodeInfo(eventType, txnId, null, nodeRef, null, null, null, null, null, null, null, true, true, false, false);
                } else if (!visibility.equals(Visibility.Visible)) {
                    nodeInfo = new NodeInfo(eventType, txnId, null, nodeRef, null, null, null, null, null, null, null, true, true, true, true);
                } else {
                    SiteInfo siteInfo = siteService.getSite(nodeRef);
                    String siteId = (siteInfo != null ? siteInfo.getShortName() : null);
                    Set<QName> aspects = nodeService.getAspects(nodeRef);
                    final String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
                    List<Path> nodePaths = Collections.singletonList(nodeService.getPath(nodeRef));
                    Date modifiedTime = (Date) nodeService.getProperty(nodeRef, ContentModel.PROP_MODIFIED);
                    Long modificationTimestamp = (modifiedTime != null ? modifiedTime.getTime() : null);
                    Status status = nodeService.getNodeStatus(nodeRef);
                    Client client = ClientUtil.from(filterclient);
                    nodeInfo = new NodeInfo(eventType, txnId, name, nodeRef, status, nodePaths, modificationTimestamp, type, aspects, siteId, client, true, true, true, true);
                }
            }
            return nodeInfo;
        }
    });
    return nodeInfo;
}
Also used : Status(org.alfresco.service.cmr.repository.NodeRef.Status) SiteInfo(org.alfresco.service.cmr.site.SiteInfo) Set(java.util.Set) HashSet(java.util.HashSet) QName(org.alfresco.service.namespace.QName) MessagingException(org.gytheio.messaging.MessagingException) Date(java.util.Date) Visibility(org.alfresco.repo.model.filefolder.HiddenAspect.Visibility) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) FileFilterMode(org.alfresco.util.FileFilterMode) Client(org.alfresco.sync.repo.Client)

Example 2 with Visibility

use of org.alfresco.repo.model.filefolder.HiddenAspect.Visibility in project alfresco-repository by Alfresco.

the class FileFolderServiceImpl method setHidden.

@Override
public void setHidden(NodeRef nodeRef, boolean isHidden) {
    int mask = 0;
    boolean allVisible = true;
    Visibility webDavVisibility = isHidden ? Visibility.NotVisible : Visibility.Visible;
    for (Client client : hiddenAspect.getClients()) {
        Visibility clientVisibility = client == FileFilterMode.getClient() ? webDavVisibility : hiddenAspect.getVisibility(client, nodeRef);
        if (clientVisibility != Visibility.Visible) {
            allVisible = false;
        }
        mask |= hiddenAspect.getClientVisibilityMask(client, clientVisibility);
    }
    if (allVisible) {
        hiddenAspect.showNode(nodeRef, true);
    } else {
        hiddenAspect.hideNode(nodeRef, mask, true, true, false);
    }
}
Also used : Visibility(org.alfresco.repo.model.filefolder.HiddenAspect.Visibility) Client(org.alfresco.util.FileFilterMode.Client)

Aggregations

Visibility (org.alfresco.repo.model.filefolder.HiddenAspect.Visibility)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Set (java.util.Set)1 Status (org.alfresco.service.cmr.repository.NodeRef.Status)1 SiteInfo (org.alfresco.service.cmr.site.SiteInfo)1 QName (org.alfresco.service.namespace.QName)1 Client (org.alfresco.sync.repo.Client)1 FileFilterMode (org.alfresco.util.FileFilterMode)1 Client (org.alfresco.util.FileFilterMode.Client)1 MessagingException (org.gytheio.messaging.MessagingException)1