Search in sources :

Example 41 with Node

use of org.alfresco.web.bean.repository.Node in project acs-community-packaging by Alfresco.

the class DocumentPreviewBean method previousItem.

public void previousItem(ActionEvent event) {
    UIActionLink link = (UIActionLink) event.getComponent();
    Map<String, String> params = link.getParameterMap();
    String id = params.get("id");
    if (id != null && id.length() != 0) {
        List<Node> nodes = this.browseBean.getContent();
        if (nodes.size() > 1) {
            String currentSortColumn = this.browseBean.getContentRichList().getCurrentSortColumn();
            boolean currentSortDescending = this.browseBean.getContentRichList().isCurrentSortDescending();
            Collections.sort(nodes, new NodePropertyComparator(currentSortColumn, !currentSortDescending));
            Node previous = NodeListUtils.previousItem(nodes, id);
            this.browseBean.setupContentAction(previous.getId(), false);
        }
    }
}
Also used : UIActionLink(org.alfresco.web.ui.common.component.UIActionLink) Node(org.alfresco.web.bean.repository.Node) NodePropertyComparator(org.alfresco.web.ui.common.NodePropertyComparator)

Example 42 with Node

use of org.alfresco.web.bean.repository.Node in project acs-community-packaging by Alfresco.

the class DocumentPreviewBean method nextItem.

public void nextItem(ActionEvent event) {
    UIActionLink link = (UIActionLink) event.getComponent();
    Map<String, String> params = link.getParameterMap();
    String id = params.get("id");
    if (id != null && id.length() != 0) {
        List<Node> nodes = this.browseBean.getContent();
        if (nodes.size() > 1) {
            String currentSortColumn = this.browseBean.getContentRichList().getCurrentSortColumn();
            boolean currentSortDescending = this.browseBean.getContentRichList().isCurrentSortDescending();
            Collections.sort(nodes, new NodePropertyComparator(currentSortColumn, !currentSortDescending));
            Node next = NodeListUtils.nextItem(nodes, id);
            this.browseBean.setupContentAction(next.getId(), false);
        }
    }
}
Also used : UIActionLink(org.alfresco.web.ui.common.component.UIActionLink) Node(org.alfresco.web.bean.repository.Node) NodePropertyComparator(org.alfresco.web.ui.common.NodePropertyComparator)

Example 43 with Node

use of org.alfresco.web.bean.repository.Node in project acs-community-packaging by Alfresco.

the class SpacePreviewBean method nextItem.

public void nextItem(ActionEvent event) {
    UIActionLink link = (UIActionLink) event.getComponent();
    Map<String, String> params = link.getParameterMap();
    String id = params.get("id");
    if (id != null && id.length() != 0) {
        NodeRef currNodeRef = new NodeRef(Repository.getStoreRef(), id);
        List<Node> nodes = this.browseBean.getParentNodes(currNodeRef);
        Node next = null;
        if (nodes.size() > 1) {
            String currentSortColumn = this.browseBean.getSpacesRichList().getCurrentSortColumn();
            boolean currentSortDescending = this.browseBean.getSpacesRichList().isCurrentSortDescending();
            Collections.sort(nodes, new NodePropertyComparator(currentSortColumn, !currentSortDescending));
            next = NodeListUtils.nextItem(nodes, id);
            this.browseBean.setupSpaceAction(next.getId(), false);
        }
        if (next == null) {
            Node currNode = new Node(currNodeRef);
            this.navigator.setupDispatchContext(currNode);
        }
    }
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) UIActionLink(org.alfresco.web.ui.common.component.UIActionLink) Node(org.alfresco.web.bean.repository.Node) NodePropertyComparator(org.alfresco.web.ui.common.NodePropertyComparator)

Example 44 with Node

use of org.alfresco.web.bean.repository.Node in project acs-community-packaging by Alfresco.

the class CreateSpaceWizard method getTemplateSpaces.

/**
 * @return Returns a list of template spaces currently in the system
 */
public List<SelectItem> getTemplateSpaces() {
    if (this.templates == null) {
        this.templates = new ArrayList<SelectItem>();
        FacesContext context = FacesContext.getCurrentInstance();
        String xpath = Application.getRootPath(context) + "/" + Application.getGlossaryFolderName(context) + "/" + Application.getSpaceTemplatesFolderName(context) + "/*";
        NodeRef rootNodeRef = this.getNodeService().getRootNode(Repository.getStoreRef());
        List<NodeRef> results = this.getSearchService().selectNodes(rootNodeRef, xpath, null, this.getNamespaceService(), false);
        if (results.size() != 0) {
            // show templates of the type relating to the space we are creating
            QName spaceType = QName.createQName(this.spaceType);
            for (NodeRef assocRef : results) {
                Node childNode = new Node(assocRef);
                if (this.getDictionaryService().isSubClass(childNode.getType(), spaceType)) {
                    this.templates.add(new SelectItem(childNode.getId(), childNode.getName()));
                }
            }
            // make sure the list is sorted by the label
            QuickSort sorter = new QuickSort(this.templates, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
            sorter.sort();
        }
        // add an entry (at the start) to instruct the user to select a template
        this.templates.add(0, new SelectItem("none", Application.getMessage(FacesContext.getCurrentInstance(), "select_a_template")));
    }
    return this.templates;
}
Also used : FacesContext(javax.faces.context.FacesContext) NodeRef(org.alfresco.service.cmr.repository.NodeRef) QuickSort(org.alfresco.web.data.QuickSort) SelectItem(javax.faces.model.SelectItem) QName(org.alfresco.service.namespace.QName) Node(org.alfresco.web.bean.repository.Node)

Example 45 with Node

use of org.alfresco.web.bean.repository.Node in project acs-community-packaging by Alfresco.

the class DeleteSpaceDialog method getConfirmMessage.

// ------------------------------------------------------------------------------
// Bean Getters and Setters
/**
 * Returns the confirmation to display to the user before deleting the content.
 *
 * @return The formatted message to display
 */
public String getConfirmMessage() {
    String fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(), getConfirmMessageId());
    Node node = this.browseBean.getActionSpace();
    if (node != null) {
        return MessageFormat.format(fileConfirmMsg, new Object[] { node.getName() });
    } else {
        return Application.getMessage(FacesContext.getCurrentInstance(), "delete_node_not_found");
    }
}
Also used : Node(org.alfresco.web.bean.repository.Node)

Aggregations

Node (org.alfresco.web.bean.repository.Node)145 NodeRef (org.alfresco.service.cmr.repository.NodeRef)81 FacesContext (javax.faces.context.FacesContext)44 MapNode (org.alfresco.web.bean.repository.MapNode)38 UIActionLink (org.alfresco.web.ui.common.component.UIActionLink)28 InvalidNodeRefException (org.alfresco.service.cmr.repository.InvalidNodeRefException)26 UserTransaction (javax.transaction.UserTransaction)22 QName (org.alfresco.service.namespace.QName)22 NodePropertyComparator (org.alfresco.web.ui.common.NodePropertyComparator)18 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)17 ArrayList (java.util.ArrayList)10 AccessDeniedException (org.alfresco.repo.security.permissions.AccessDeniedException)8 DictionaryService (org.alfresco.service.cmr.dictionary.DictionaryService)8 TypeDefinition (org.alfresco.service.cmr.dictionary.TypeDefinition)7 TransientNode (org.alfresco.web.bean.repository.TransientNode)7 IOException (java.io.IOException)6 HashMap (java.util.HashMap)6 Map (java.util.Map)6 AbortProcessingException (javax.faces.event.AbortProcessingException)6 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)6