⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmsresource.java

📁 java 编写的程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     public int getLauncherType() {
         return m_launcherType;
     }
     /**
     * Gets the length of the content (filesize).
     *
     * @return the length of the content.
     */
     public int getLength() {
        return m_size;
     }
    /**
     * Returns the name of this resource.<BR/>
     * Example: retuns language.cms for the
     * resource /system/def/language.cms
     *
     * @return the name of this resource.
     */
     public String getName() {
         String name= null;
         String absoluteName = getAbsolutePath();
         // check if this is a file
         if (!absoluteName.endsWith("/")) {
             name=absoluteName.substring(absoluteName.lastIndexOf("/")+1,
                                           absoluteName.length());
         }else{
              name=absoluteName.substring(0,absoluteName.length()-1);
              name=name.substring(name.lastIndexOf("/")+1,
                                  name.length());
         }

         return name;
     }
    /**
     * Returns the userid of the resource owner.
     *
     * @return the userid of the resource owner.
     */
    public int getOwnerId() {
         return m_user;
      }
    /**
     * Returns the absolute path of the parent.<BR/>
     * Example: /system/def has the parent /system/<BR/>
     * / has no parent
     *
     * @return the parent absolute path, or null if this is the root-resource.
     */
     public String getParent(){
         String parent=null;
         String resourceName = getAbsolutePath();
         // check if this is the root resource
         if (!resourceName.equals(C_ROOT)) {
                parent=resourceName.substring(0,resourceName.length()-1);
                parent=parent.substring(0,parent.lastIndexOf("/")+1);
         }
         return parent;
     }
     /**
     * Gets the Parent database id for this resource.
     *
     * @return the Parent database id of this resource.
     */
    public int getParentId(){
        return m_parentId;
    }
    /**
     * Returns the path for this resource.<BR/>
     * Example: retuns /system/def/ for the
     * resource /system/def/language.cms
     *
     * @return the path for this resource.
     */
     public String getPath() {
        int rootIndex = m_resourceName.indexOf("/", m_resourceName.indexOf("/",1)+1);
        return m_resourceName.substring(rootIndex, m_resourceName.lastIndexOf("/")+1);
     }
    /**
     * Returns the project id for this resource.
     *
     * @return the project id for this resource.
     */
      public int getProjectId() {
          return m_projectId;
      }
    /**
     * Gets the database id for this resource.
     *
     * @return the database id of this resource.
     */
     public int getResourceId(){
        return m_resourceId;
     }
    /**
     * Gets the userId from the user who made the last change.
     *
     * @return the userId from the user who made the last change.
     */
     public int getResourceLastModifiedBy(){
        return m_resourceLastModifiedBy;
     }
    /**
     * Returns the state of this resource.<BR/>
     * This may be C_STATE_UNCHANGED, C_STATE_CHANGED, C_STATE_NEW or C_STATE_DELETED.
     *
     * @return the state of this resource.
     */
      public int getState() {
      return m_state;
      }
    /**
     * Gets the type id for this resource.
     *
     * @return the type id of this resource.
     */
     public int getType() {
       return m_resourceType;
     }
    /**
     * Gets the project id of the project that has locked this resource.
     *
     * @return the project id.
     */
     public int getLockedInProject() {
       return m_lockedInProject;
     }
     /**
      * Checks if a resource belongs to a project.
      * @param project The project which the resources is checked about.
      * @return true if the resource is in the project, false otherwise.
      */
     public boolean inProject(CmsProject project){
         boolean inProject=false;
         if (project.getId() == m_projectId) {
             inProject=true;
         }
         return inProject;
     }
    /**
     * Determines, if this resource is a file.
     *
     * @return true, if this resource is a file, else it returns false.
     */
      public boolean isFile() {
         boolean isFile=true;
         if (m_resourceName.endsWith("/")){
             isFile=false;
         }
         return isFile;
      }
    /**
     * Determines, if this resource is a folder.
     *
     * @return true, if this resource is a folder, else it returns false.
     */
      public boolean isFolder(){
         boolean isFolder=false;
         if (m_resourceName.endsWith("/")){
             isFolder=true;
         }
         return isFolder;

      }
    /**
     * Determines, if this resource is locked by a user.
     *
     * @return true, if this resource is locked by a user, else it returns false.
     */
      public boolean isLocked() {
          boolean isLocked=true;
          //check if the user id in the locked by field is the unknown user id.
          if (m_lockedBy == C_UNKNOWN_ID) {
              isLocked=false;
          }
          return isLocked;
      }
    /**
     * Returns the user idthat locked this resource.
     *
     * @return the user id that locked this resource.
     * If this resource is free it returns the unknown user id.
     */
      public int isLockedBy() {
        return m_lockedBy;
      }
     /**
     * Sets the accessflags of this resource.
     *
     * @param The new accessflags of this resource.
     */
      public void setAccessFlags(int flags){
          m_accessFlags=flags;
      }
    /**
     * Sets the File id for this resource.
     *
     * @param The File id of this resource.
     */
    public void setFileId(int fileId){
        m_fileId = fileId;
    }
     /**
     * Sets the flags of this resource.
     *
     * @param The new flags of this resource.
     */
      void setFlags(int flags){
          m_resourceFlags=flags;
      }
    /**
     * Sets the groupId of this resource.
     *
     * @param The new groupId of this resource.
     */
      public void setGroupId(int group) {
          m_group= group;
      }
     /**
     * Sets launcher classname for this resource.
     *
     * @param The new launcher classname for this resource.
     */
     void setLauncherClassname(String name) {
      m_launcherClassname=name;
         }
     /**
     * Sets launcher the type id for this resource.
     *
     * @param The new launcher type id of this resource.
     */
     public void setLauncherType(int type){
         m_launcherType=type;
     }
     /**
     * Sets the the user id that locked this resource.
     *
     * @param The new the user id that locked this resource.
     */
     public void setLocked(int id) {
          m_lockedBy=id;
      }
     /**
     * Sets the parent database id for this resource.
     *
     * @param The new database id of this resource.
     */
    public void setParentId(int parentId){
        m_parentId = parentId;
    }
    /**
     * Sets the user id from the user who changes the resource.
     *
     * @param The userId from the user who changes the resource.
     */
    void setResourceLastModifiedBy(int resourceLastModifiedBy){
        m_resourceLastModifiedBy = resourceLastModifiedBy;
    }
      /**
     * Sets the state of this resource.
     *
     * @param The new state of this resource.
     */
      public void setState(int state) {
          m_state=state;
      }
     /**
     * Sets the type id for this resource.
     *
     * @param The new type id of this resource.
     */
     public void setType(int type) {
         m_resourceType=type;
     }
    /**
     * Sets the userId of this resource.
     *
     * @param The new userId of this resource.
     */
    public  void setUserId(int user) {
          m_user = user;
      }

    /**
     * Sets the projectId of this resource.
     *
     * @param The new projectId of this resource.
     */
    public  void setProjectId(int project) {
          m_projectId = project;
      }


    /**
     * Sets the projectId in which this resource is locked.
     *
     * @param The new projectId of this resource.
     */
    public  void setLockedInProject(int project) {
          m_lockedInProject = project;
      }

    /**
     * Returns a string-representation for this object.
     * This can be used for debugging.
     *
     * @return string-representation for this object.
     */
      public String toString() {
        StringBuffer output=new StringBuffer();
        output.append("[Resource]:");
        output.append(m_resourceName);
        output.append(" ID: ");
        output.append(m_resourceId);
        output.append(" ParentID: ");
        output.append(m_parentId);
        output.append(" , Project=");
        output.append(m_projectId);
        output.append(" , User=");
        output.append(m_user);
        output.append(" , Group=");
        output.append(m_group);
        output.append(" : Access=");
        output.append(getFlagString());
        output.append(" : Resource-type=");
        output.append(getType());
        output.append(" : Locked=");
        output.append(isLockedBy());
        output.append(" : length=");
        output.append(getLength());
        output.append(" : state=");
        output.append(getState());
        return output.toString();
      }
}

⌨️ 快捷键说明

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