Package com.ibm.xsp.extlib.sbt.files

Examples of com.ibm.xsp.extlib.sbt.files.FileEntry


        ArrayList<FileEntry> entries = new ArrayList<FileEntry>();
        String epName = accessor.findEndpointName();
        JsonNavigator navigator = new JsonNavigator(jsonObject);
        DataNavigator contentsNav = navigator.get("contents");
        for (int i = 0; i < contentsNav.getCount(); ++i) {
            FileEntry entry = new FileEntry();
            DataNavigator nav = contentsNav.get(i);
            try {
                String title = nav.stringValue("path");
                String[] result = title.split("/");
                entry.setTitle(result[result.length - 1]);
                entry.setUpdated(nav.dateValue("modified"));
                entry.setBytes(nav.intValue("bytes"));
                entry.setSize(nav.stringValue("size"));
                entry.setAuthorName(params.get("subscriberId"));
                entry.setVersion(String.valueOf( nav.doubleValue("revision")));
                boolean isDir = nav.booleanValue("is_dir");
                entry.setIsDirectory(isDir);
                if(!isDir){
                    entry.setMimeType(nav.stringValue("mime_type"));
                }
                else{
                    entry.setMimeType("undefined");
                }
                entry.setIcon(MimeIconRegistry.getInstance().get(entry.getMimeType()));
                entry.setPath(nav.stringValue("path"));
                String proxyUrl = "xsp/.proxy/files/" + title + "?" + PARAM_TYPE + "=" + TYPE + "&path=" + entry.getPath() + "&mimeType=" + entry.getMimeType() + "&" + PARAM_ENDPOINT_NAME + "=";
                if(StringUtil.isNotEmpty(epName)){
                    proxyUrl = proxyUrl + epName;
                }
                else{
                    proxyUrl = proxyUrl + TYPE;
                }
                entry.setProxyURL(proxyUrl);
                entry.setUniqueId(entry.getPath());
            } catch (Exception e) {
                throw new FacesExceptionEx(e);
            }
            entries.add(entry);
        }
View Full Code Here


    public void deleteRow(FileServiceAccessor accessor, Endpoint endpoint, String rowId) {
        // /basic/api/myuserlibrary/document/{document-id}/entry
        int rows = accessor.getCount();
        String rep = null;
        for (int i = 0; i < rows; i++) {
            FileEntry entry = (FileEntry) accessor.get(i);
            if (StringUtil.equals(rowId, entry.getUniqueId())) {
                rep = entry.getRepository();
                break;
            }
        }
        if (StringUtil.isEmpty(rep)) {
            return;
View Full Code Here

                        }
                        if (entries != null) {
                            String epName = accessor.findEndpointName();
                            for (int i = 0; i < entries.getCount(); i++) {
                                DataNavigator navigator = entries.get(i);
                                FileEntry fe = new FileEntry();
                                fe.setRepository(repId);
                                fe.setTitle(navigator.stringValue(TAG_LABEL));
                                fe.setUpdated(navigator.dateValue(TAG_MODIFIED));
                                fe.setAuthorName(navigator.stringValue(TAG_AUTHOR + "/" + TAG_NAME));
                                fe.setDescription(navigator.stringValue(TAG_SUMMARY));
                                fe.setFileId(navigator.stringValue(TAG_UUID));
                                fe.setUniqueId(fe.getFileId());
                                fe.setMimeType(getMimeType(navigator.stringValue(TAG_LABEL)));
                                fe.setIcon(MimeIconRegistry.getInstance().get(fe.getMimeType()));
                                String proxyUrl = "xsp/.proxy/files/"+accessor.findEndpointName()+"/connections/" + fe.getTitle() + "?" + PARAM_TYPE + "=" + TYPE + "&" + PARAM_ID
                                        + "=" + fe.getUniqueId() + "&" + PARAM_REPOSITORY_ID + "=" + repId + "&"+"fileName="+fe.getTitle()+"&" + PARAM_ENDPOINT_NAME
                                        + "=";
                                if (StringUtil.isNotEmpty(epName)) {
                                    proxyUrl = proxyUrl + epName;
                                }
                                else {
                                    proxyUrl = proxyUrl + TYPE;
                                }
                                fe.setProxyURL(proxyUrl);

                                fe.setPublished(navigator.dateValue(TAG_PUBLISHED));
                                fe.setVersion(navigator.stringValue(TAG_VERSION));
                                fe.setVisibility(navigator.stringValue(TAG_VISIBILITY));
                                fileEntries.add(fe);
                            }
                        }
                    }
                }
View Full Code Here

        DataNavigator mynav = navigator.get("feed/entry");

        if (mynav != null) {
            String epName = accessor.findEndpointName();
            for (int i = 0; i < mynav.getCount(); i++) {
                FileEntry entry = new FileEntry();
                DataNavigator nav = mynav.get(i);
                entry.setUserId((String) UserBean.get().getPerson().getField(LOTUS_LIVE_SUBSCRIBER_ID));
                entry.setTitle(nav.stringValue("title"));
                entry.setUpdated(nav.dateValue("updated"));
                entry.setPublished(nav.dateValue("published"));
                entry.setAuthorName(nav.stringValue("author/name"));
               
                String id = nav.stringValue("id");
                if (StringUtil.isNotEmpty(id)) {
                    int index = id.indexOf("snx:file!");
                    if (index != -1) {
                        index = index + "snx:file!".length();
                        id = id.substring(index);
                    }
                }
                //hack
                id=id.replace("http://www.ibm.com/xmlns/prod/sn/cmis/00000000-0000-0000-0001-000000000000!", "");
                entry.setFileId(id);
                entry.setUniqueId(id);
                DataNavigator propsNavigator = nav.get("object/properties");

                String description = propsNavigator.get("propertyString").selectEq("@displayName", "Description").stringValue("value");
                entry.setDescription(StringUtil.getNonNullString(description));
                String size = propsNavigator.get("propertyInteger").selectEq("@propertyDefinitionId", "cmis:contentStreamLength").stringValue("value");
                entry.setSize(calculateBytes(size));
                String version = propsNavigator.get("propertyString").selectEq("@propertyDefinitionId", "cmis:versionLabel").stringValue("value");
                entry.setVersion(StringUtil.getNonNullString(version));
                String visibility = propsNavigator.get("propertyString").selectEq("@propertyDefinitionId", "snx:visibilityComputed").stringValue("value");
                entry.setVisibility(StringUtil.getNonNullString(visibility));
                String mimeType = propsNavigator.get("propertyString").selectEq("@propertyDefinitionId", "cmis:contentStreamMimeType").stringValue("value");
                entry.setMimeType(mimeType);
                entry.setIcon(MimeIconRegistry.getInstance().get(mimeType));
               
                String proxyUrl = "xsp/.proxy/files/" + entry.getTitle() + "?" + PARAM_TYPE + "=" + TYPE + "&" + PARAM_ID + "="
                        + entry.getFileId() + "&" + PARAM_REPOSITORY_ID + "=" + composeRepositoryID(entry) + "&"+"fileName="+entry.getTitle()+ "&" + PARAM_ENDPOINT_NAME
                        + "=";
               
                if (StringUtil.isNotEmpty(epName)) {
                    proxyUrl = proxyUrl + epName;
                }
                else {
                    proxyUrl = proxyUrl + TYPE;
                }
                entry.setProxyURL(proxyUrl);
                entries.add(entry);
            }
        }
        return entries;
    }
View Full Code Here

TOP

Related Classes of com.ibm.xsp.extlib.sbt.files.FileEntry

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.