📄 cmspublishlist.java
字号:
*/
public CmsUUID getPublishHistoryId() {
return m_publishHistoryId;
}
/**
* Checks if this is a publish list is used for a "direct publish" operation.<p>
*
* @return true if this is a publish list is used for a "direct publish" operation
*/
public boolean isDirectPublish() {
return m_projectId < 0;
}
/**
* Returns <code>true</code> if all siblings of the project resources are to be published.<p>
*
* @return <code>true</code> if all siblings of the project resources are to be publisheds
*/
public boolean isPublishSiblings() {
return m_publishSiblings;
}
/**
* Returns <code>true</code> if sub-resources in folders should be published (for direct publish only).<p>
*
* @return <code>true</code> if sub-resources in folders should be published (for direct publish only)
*/
public boolean isPublishSubResources() {
return m_publishSubResources;
}
/**
* @see java.lang.Object#toString()
*/
public String toString() {
StringBuffer result = new StringBuffer();
result.append("\n[\n");
if (isDirectPublish()) {
result.append("direct publish of resources: ").append(m_directPublishResources.toString()).append("\n");
} else {
result.append("publish of project: ").append(m_projectId).append("\n");
}
result.append("publish history ID: ").append(m_publishHistoryId.toString()).append("\n");
result.append("resources: ").append(m_fileList.toString()).append("\n");
result.append("folders: ").append(m_folderList.toString()).append("\n");
result.append("]\n");
return result.toString();
}
/**
* Adds a new/changed/deleted Cms file resource to the publish list.<p>
*
* @param resource a new/changed/deleted Cms file resource
* @throws CmsIllegalArgumentException if the specified resource is not a file or unchanged
*/
protected void addFile(CmsResource resource) throws CmsIllegalArgumentException {
// it is essential that this method is only visible within the db package!
if (resource.isFolder()) {
throw new CmsIllegalArgumentException(Messages.get().container(
Messages.ERR_PUBLISH_NO_CMS_FILE_1,
resource.getRootPath()));
}
if (resource.getState() == CmsResource.STATE_UNCHANGED) {
throw new CmsIllegalArgumentException(Messages.get().container(
Messages.ERR_PUBLISH_UNCHANGED_RESOURCE_1,
resource.getRootPath()));
}
if (!m_fileList.contains(resource)) {
// only add files not already contained in the list
// this is required to make sure no siblings are duplicated
m_fileList.add(resource);
}
}
/**
* Appends all of the new/changed/deleted Cms file resources in the specified list to the end
* of this publish list.<p>
*
* @param list a list with new/changed/deleted Cms file resources to be added to this publish list
* @throws IllegalArgumentException if one of the resources is not a file or unchanged
*/
protected void addFiles(List list) throws IllegalArgumentException {
// it is essential that this method is only visible within the db package!
Iterator i = list.iterator();
while (i.hasNext()) {
addFile((CmsResource)i.next());
}
}
/**
* Adds a new/changed Cms folder resource to the publish list.<p>
*
* @param resource a new/changed Cms folder resource
* @throws IllegalArgumentException if the specified resource is not a folder or unchanged
*/
protected void addFolder(CmsResource resource) throws IllegalArgumentException {
// it is essential that this method is only visible within the db package!
if (resource.isFile()) {
throw new CmsIllegalArgumentException(Messages.get().container(
Messages.ERR_PUBLISH_NO_FOLDER_1,
resource.getRootPath()));
}
if (resource.getState() == CmsResource.STATE_UNCHANGED) {
throw new CmsIllegalArgumentException(Messages.get().container(
Messages.ERR_PUBLISH_UNCHANGED_RESOURCE_1,
resource.getRootPath()));
}
if (resource.getState() == CmsResource.STATE_DELETED) {
m_deletedFolderList.add(resource);
} else {
m_folderList.add(resource);
}
}
/**
* Appends all of the new/changed Cms folder resources in the specified list to the end
* of this publish list.<p>
*
* @param list a list with new/changed Cms folder resources to be added to this publish list
* @throws IllegalArgumentException if one of the resources is not a folder or unchanged
*/
protected void addFolders(List list) throws IllegalArgumentException {
// it is essential that this method is only visible within the db package!
Iterator i = list.iterator();
while (i.hasNext()) {
addFolder((CmsResource)i.next());
}
}
/**
* @see java.lang.Object#finalize()
*/
protected void finalize() throws Throwable {
try {
if (m_fileList != null) {
m_fileList.clear();
}
m_fileList = null;
if (m_folderList != null) {
m_folderList.clear();
}
m_folderList = null;
if (m_deletedFolderList != null) {
m_deletedFolderList.clear();
}
m_deletedFolderList = null;
} catch (Throwable t) {
// ignore
}
super.finalize();
}
/**
* Returns the list with the new/changed Cms folder resources.<p>
*
* @return the list with the new/changed Cms folder resources
*/
protected List getFolderListInstance() {
// it is essential that this method is only visible within the db package!
return m_folderList;
}
/**
* Initializes the publish list, ensuring all internal lists are in the right order.<p>
*/
protected void initialize() {
if (m_folderList != null) {
// ensure folders are sorted starting with parent folders
Collections.sort(m_folderList, CmsResource.COMPARE_ROOT_PATH);
}
if (m_fileList != null) {
// ensure files are sorted starting with files in parent folders
Collections.sort(m_fileList, CmsResource.COMPARE_ROOT_PATH);
}
if (m_deletedFolderList != null) {
// ensure deleted folders are sorted starting with child folders
Collections.sort(m_deletedFolderList, CmsResource.COMPARE_ROOT_PATH);
Collections.reverse(m_deletedFolderList);
}
}
/**
* Removes a Cms resource from the publish list.<p>
*
* @param resource a Cms resource
* @return true if this publish list contains the specified resource
* @see List#remove(java.lang.Object)
*/
protected boolean remove(CmsResource resource) {
// it is essential that this method is only visible within the db package!
return m_fileList.remove(resource);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -