cmsobject.java

来自「找了很久才找到到源代码」· Java 代码 · 共 1,624 行 · 第 1/5 页

JAVA
1,624
字号

    /**
     * Creates a new project.<p>
     *
     * @param name the name of the project to create
     * @param description the description for the new project
     * @param groupname the name of the project user group
     * @param managergroupname the name of the project manager group
     * @param projecttype the type of the project (normal or temporary)
     * 
     * @return the created project
     * 
     * @throws CmsException if operation was not successful
     * @deprecated use {@link #createProject(String,String,String,String,CmsProject.CmsProjectType)} method instead
     */
    public CmsProject createProject(
        String name,
        String description,
        String groupname,
        String managergroupname,
        int projecttype) throws CmsException {

        return createProject(
            name,
            description,
            groupname,
            managergroupname,
            CmsProject.CmsProjectType.valueOf(projecttype));
    }

    /**
     * Creates a property definition.<p>
     *
     * Property definitions are valid for all resource types.<p>
     * 
     * @param name the name of the property definition to create
     * 
     * @return the created property definition
     * 
     * @throws CmsException if something goes wrong
     */
    public CmsPropertyDefinition createPropertyDefinition(String name) throws CmsException {

        return (m_securityManager.createPropertyDefinition(m_context, name));
    }

    /**
     * Creates a new resource of the given resource type with 
     * empty content and no properties.<p>
     * 
     * @param resourcename the name of the resource to create (full current site relative path)
     * @param type the type of the resource to create
     * 
     * @return the created resource
     * 
     * @throws CmsException if something goes wrong
     * @throws CmsIllegalArgumentException if the given <code>resourcename</code> is null or of length 0
     * 
     * @see #createResource(String, int, byte[], List)
     */
    public CmsResource createResource(String resourcename, int type) throws CmsException, CmsIllegalArgumentException {

        return createResource(resourcename, type, new byte[0], Collections.EMPTY_LIST);
    }

    /**
     * Creates a new resource of the given resource type
     * with the provided content and properties.<p>
     * 
     * @param resourcename the name of the resource to create (full current site relative path)
     * @param type the type of the resource to create
     * @param content the contents for the new resource
     * @param properties the properties for the new resource
     * 
     * @return the created resource
     * 
     * @throws CmsException if something goes wrong
     * @throws CmsIllegalArgumentException if the <code>resourcename</code> argument is null or of length 0
     */
    public CmsResource createResource(String resourcename, int type, byte[] content, List properties)
    throws CmsException, CmsIllegalArgumentException {

        return getResourceType(type).createResource(this, m_securityManager, resourcename, content, properties);
    }

    /**
     * Creates a new sibling of the source resource.<p>
     * 
     * @param source the name of the resource to create a sibling for with complete path
     * @param destination the name of the sibling to create with complete path
     * @param properties the individual properties for the new sibling
     * 
     * @return the new created sibling
     * 
     * @throws CmsException if something goes wrong
     */
    public CmsResource createSibling(String source, String destination, List properties) throws CmsException {

        CmsResource resource = readResource(source, CmsResourceFilter.IGNORE_EXPIRATION);
        return getResourceType(resource).createSibling(this, m_securityManager, resource, destination, properties);
    }

    /**
     * Creates the project for the temporary workplace files.<p>
     *
     * @return the created project for the temporary workplace files
     * 
     * @throws CmsException if something goes wrong
     */
    public CmsProject createTempfileProject() throws CmsException {

        return m_securityManager.createTempfileProject(m_context);
    }

    /**
     * Creates a new user.<p>
     * 
     * @param userFqn the name for the new user
     * @param password the password for the new user
     * @param description the description for the new user
     * @param additionalInfos the additional infos for the user
     *
     * @return the created user
     * 
     * @throws CmsException if something goes wrong
     */
    public CmsUser createUser(String userFqn, String password, String description, Map additionalInfos)
    throws CmsException {

        return m_securityManager.createUser(m_context, userFqn, password, description, additionalInfos);
    }

    /**
     * Deletes all published resource entries.<p>
     * 
     * @param linkType the type of resource deleted (0= non-parameter, 1=parameter)
     * 
     * @throws CmsException if something goes wrong
     */
    public void deleteAllStaticExportPublishedResources(int linkType) throws CmsException {

        m_securityManager.deleteAllStaticExportPublishedResources(m_context, linkType);
    }

    /**
     * Deletes the versions from the backup tables that are older then the given time stamp  
     * and/or number of remaining versions.<p>
     * 
     * The number of versions always wins, i.e. if the given time stamp would delete more versions 
     * than given in the versions parameter, the time stamp will be ignored. <p>
     * 
     * Deletion will delete file header, content and properties. <p>
     * 
     * @param timestamp time stamp which defines the date after which backup resources must be deleted.
     *                  This parameter must be 0 if the backup should be deleted by number of version
     * @param versions the number of versions per file which should kept in the system. 
     * @param report the report for output logging
     * 
     * @throws CmsException if something goes wrong
     * 
     * @deprecated use {@link #deleteHistoricalVersions(String, int, int, long, I_CmsReport)} instead,
     *             notice that there is no longer possible to delete historical versions by date
     */
    public void deleteBackups(long timestamp, int versions, I_CmsReport report) throws CmsException {

        if (timestamp != 0) {
            if (versions == 0) {
                // use default value
                versions = OpenCms.getSystemInfo().getHistoryVersions();
            }
        }
        deleteHistoricalVersions("/", versions, versions, timestamp, report);
    }

    /**
     * Deletes a group, where all permissions, users and children of the group
     * are transfered to a replacement group.<p>
     * 
     * @param groupId the id of the group to be deleted
     * @param replacementId the id of the group to be transfered, can be <code>null</code>
     *
     * @throws CmsException if operation was not successful
     */
    public void deleteGroup(CmsUUID groupId, CmsUUID replacementId) throws CmsException {

        m_securityManager.deleteGroup(m_context, groupId, replacementId);
    }

    /**
     * Deletes a user group.<p>
     *
     * Only groups that contain no subgroups can be deleted.<p>
     * 
     * @param group the name of the group
     * 
     * @throws CmsException if operation was not successful
     */
    public void deleteGroup(String group) throws CmsException {

        m_securityManager.deleteGroup(m_context, group);
    }

    /**
     * Deletes the versions from the history tables, keeping the given number of versions per resource.<p>
     * 
     * @param folderName the name of the folder (with sub resources) to delete historical versions for 
     * @param versionsToKeep number of versions to keep, is ignored if negative 
     * @param versionsDeleted number of versions to keep for deleted resources, is ignored if negative
     * @param timeDeleted deleted resources older than this will also be deleted, is ignored if negative
     * @param report the report for output logging
     * 
     * @throws CmsException if operation was not successful
     */
    public void deleteHistoricalVersions(
        String folderName,
        int versionsToKeep,
        int versionsDeleted,
        long timeDeleted,
        I_CmsReport report) throws CmsException {

        CmsFolder folder = readFolder(folderName);
        m_securityManager.deleteHistoricalVersions(
            m_context,
            folder,
            versionsToKeep,
            versionsDeleted,
            timeDeleted,
            report);
    }

    /**
     * Deletes a project.<p>
     *
     * All resources inside the project have to be be reset to their online state.<p>
     * 
     * @param id the id of the project to delete
     *
     * @throws CmsException if operation was not successful
     */
    public void deleteProject(CmsUUID id) throws CmsException {

        m_securityManager.deleteProject(m_context, id);
    }

    /**
     * Deletes a project.<p>
     *
     * All resources inside the project have to be be reset to their online state.<p>
     * 
     * @param id the id of the project to delete
     *
     * @throws CmsException if operation was not successful
     * 
     * @deprecated use {@link #deleteProject(CmsUUID)} instead
     */
    public void deleteProject(int id) throws CmsException {

        deleteProject(m_securityManager.getProjectId(m_context, id));
    }

    /**
     * Deletes a property for a file or folder.<p>
     *
     * @param resourcename the name of a resource for which the property should be deleted
     * @param key the name of the property
     * 
     * @throws CmsException if something goes wrong
     * 
     * @deprecated use <code>{@link #writePropertyObject(String, CmsProperty)}</code> instead.
     */
    public void deleteProperty(String resourcename, String key) throws CmsException {

        CmsProperty property = new CmsProperty();
        property.setName(key);
        property.setStructureValue(CmsProperty.DELETE_VALUE);

        writePropertyObject(resourcename, property);
    }

    /**
     * Deletes a property definition.<p>
     *
     * @param name the name of the property definition to delete
     *
     * @throws CmsException if something goes wrong
     */
    public void deletePropertyDefinition(String name) throws CmsException {

        m_securityManager.deletePropertyDefinition(m_context, name);
    }

    /**
     * Deletes the relations to a given resource.<p>
     *
     * @param resourceName the resource to delete the relations from
     * @param filter the filter to use for deleting the relations
     *
     * @throws CmsException if something goes wrong
     */
    public void deleteRelationsFromResource(String resourceName, CmsRelationFilter filter) throws CmsException {

        CmsResource resource = readResource(resourceName, CmsResourceFilter.ALL);
        m_securityManager.deleteRelationsForResource(m_context, resource, filter);
    }

    /**
     * Deletes a resource given its name.<p>
     * 
     * The <code>siblingMode</code> parameter controls how to handle siblings 
     * during the delete operation.<br>
     * Possible values for this parameter are: <br>
     * <ul>
     * <li><code>{@link CmsResource#DELETE_REMOVE_SIBLINGS}</code></li>
     * <li><code>{@link CmsResource#DELETE_PRESERVE_SIBLINGS}</code></li>
     * </ul><p>
     * 
     * @param resourcename the name of the resource to delete (full current site relative path)
     * @param siblingMode indicates how to handle siblings of the deleted resource
     *
     * @throws CmsException if something goes wrong
     */
    public void deleteResource(String resourcename, CmsResource.CmsResourceDeleteMode siblingMode) throws CmsException {

        CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
        getResourceType(resource).deleteResource(this, m_securityManager, resource, siblingMode);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?