[UPDATE]
Unload einsatzfähig. Alle bekannten Fehler behoben. git-svn-id: https://svn.libreccm.org/ccm/trunk@3523 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
43891e180c
commit
c56db8ae78
|
|
@ -130,14 +130,16 @@ public class ExternalLinkPropertyForm extends BasicPageForm
|
||||||
description.setValue(state, extLink.getDescription());
|
description.setValue(state, extLink.getDescription());
|
||||||
url.setValue(state, extLink.getURL());
|
url.setValue(state, extLink.getURL());
|
||||||
comment.setValue(state, extLink.getComment());
|
comment.setValue(state, extLink.getComment());
|
||||||
if (extLink.getShowComment()) {
|
if (extLink.getShowComment() != null
|
||||||
|
&& extLink.getShowComment()) {
|
||||||
showCommentCheckBox.setValue(
|
showCommentCheckBox.setValue(
|
||||||
state, new String[]{ExternalLink.SHOW_COMMENT});
|
state, new String[]{ExternalLink.SHOW_COMMENT});
|
||||||
} else {
|
} else {
|
||||||
showCommentCheckBox.setValue(state, null);
|
showCommentCheckBox.setValue(state, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extLink.getTargetNewWindow()) {
|
if (extLink.getTargetNewWindow() != null
|
||||||
|
&& extLink.getTargetNewWindow()) {
|
||||||
targetWindowCheckBox.setValue(
|
targetWindowCheckBox.setValue(
|
||||||
state, new String[]{ExternalLink.TARGET_WINDOW});
|
state, new String[]{ExternalLink.TARGET_WINDOW});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import com.arsdigita.persistence.DataCollection;
|
||||||
import com.arsdigita.persistence.Session;
|
import com.arsdigita.persistence.Session;
|
||||||
import com.arsdigita.runtime.ScriptContext;
|
import com.arsdigita.runtime.ScriptContext;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -37,7 +38,7 @@ import org.apache.log4j.Logger;
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Tobias Osmers <tosmers@uni-bremen.de>
|
* @author Tobias Osmers <tosmers@uni-bremen.de>
|
||||||
* @version $Revision: #1 $ $Date: 2015/05/18 $
|
* @version $Revision: #2 $ $Date: 2015/07/13 $
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractContentTypeUnloader extends PackageLoader {
|
public abstract class AbstractContentTypeUnloader extends PackageLoader {
|
||||||
/**
|
/**
|
||||||
|
|
@ -84,13 +85,16 @@ public abstract class AbstractContentTypeUnloader extends PackageLoader {
|
||||||
*/
|
*/
|
||||||
private void sweepTypes(ScriptContext ctx) {
|
private void sweepTypes(ScriptContext ctx) {
|
||||||
XMLContentTypeHandler handler = new XMLContentTypeHandler(false);
|
XMLContentTypeHandler handler = new XMLContentTypeHandler(false);
|
||||||
// Retrieve the content type definition file(s)
|
ArrayList<ContentTypeHelper> deletableCTs = new ArrayList();
|
||||||
|
// Retrieve the content type definition file(s) and store all
|
||||||
|
// content-type-helper to delete all content types later
|
||||||
String[] contentTypes = getTypes();
|
String[] contentTypes = getTypes();
|
||||||
for (String contentType : contentTypes) {
|
for (String contentType : contentTypes) {
|
||||||
XML.parseResource(contentType, handler);
|
XML.parseResource(contentType, handler);
|
||||||
|
deletableCTs.add(handler.getContentTypeHelper());
|
||||||
}
|
}
|
||||||
|
|
||||||
List types = handler.getContentTypes();
|
List<ContentType> types = handler.getContentTypes();
|
||||||
Session ssn = ctx.getSession();
|
Session ssn = ctx.getSession();
|
||||||
|
|
||||||
// Removes all contentitems/instances of the specified
|
// Removes all contentitems/instances of the specified
|
||||||
|
|
@ -105,13 +109,17 @@ public abstract class AbstractContentTypeUnloader extends PackageLoader {
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (contentItem == null || !contentItem.isPublished()) {
|
if (contentItem == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (Iterator it = types.iterator(); it.hasNext(); ) {
|
//for (Iterator it = types.iterator(); it.hasNext(); ) {
|
||||||
final ContentType type = (ContentType) it.next();
|
//final ContentType type = (ContentType) it.next();
|
||||||
if (contentItem.getContentType().equals(type)) {
|
for (ContentType type : types) {
|
||||||
contentItem.unpublish();
|
ContentType ctype = contentItem.getContentType();
|
||||||
|
if (ctype != null && ctype.equals(type)) {
|
||||||
|
if (contentItem.isPublished()) {
|
||||||
|
contentItem.unpublish();
|
||||||
|
}
|
||||||
contentItem.delete();
|
contentItem.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -132,6 +140,11 @@ public abstract class AbstractContentTypeUnloader extends PackageLoader {
|
||||||
section.removeContentType(type);
|
section.removeContentType(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete content types
|
||||||
|
for (ContentTypeHelper deletableCT : deletableCTs) {
|
||||||
|
deletableCT.deleteType();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,13 @@ public class XMLContentTypeHandler extends DefaultHandler {
|
||||||
return m_types;
|
return m_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ContentTypeHelper getContentTypeHelper() {
|
||||||
|
return m_type;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startElement(String uri, String name,
|
public void startElement(String uri, String name,
|
||||||
String qName, Attributes atts) {
|
String qName, Attributes atts) {
|
||||||
boolean deletableType = false;
|
|
||||||
if (name.equals("content-types")) {
|
if (name.equals("content-types")) {
|
||||||
s_log.debug("matched content-types");
|
s_log.debug("matched content-types");
|
||||||
} else if (name.equals("content-type")) {
|
} else if (name.equals("content-type")) {
|
||||||
|
|
@ -103,9 +106,6 @@ public class XMLContentTypeHandler extends DefaultHandler {
|
||||||
|
|
||||||
m_contentType = m_type.createType();
|
m_contentType = m_type.createType();
|
||||||
m_types.add(m_contentType);
|
m_types.add(m_contentType);
|
||||||
|
|
||||||
// m_type has been initialized
|
|
||||||
deletableType = true;
|
|
||||||
} else if (name.equals("authoring-kit")) {
|
} else if (name.equals("authoring-kit")) {
|
||||||
if (!m_including) {
|
if (!m_including) {
|
||||||
s_log.debug("matched authoring-kit");
|
s_log.debug("matched authoring-kit");
|
||||||
|
|
@ -114,9 +114,6 @@ public class XMLContentTypeHandler extends DefaultHandler {
|
||||||
}
|
}
|
||||||
m_authoringKit = m_type.createAuthoringKit();
|
m_authoringKit = m_type.createAuthoringKit();
|
||||||
m_nextOrder = 1;
|
m_nextOrder = 1;
|
||||||
|
|
||||||
// only true if it has been initialized
|
|
||||||
deletableType &= true;
|
|
||||||
}
|
}
|
||||||
} else if (name.equals("authoring-step")) {
|
} else if (name.equals("authoring-step")) {
|
||||||
String label = atts.getValue("label");
|
String label = atts.getValue("label");
|
||||||
|
|
@ -144,10 +141,5 @@ public class XMLContentTypeHandler extends DefaultHandler {
|
||||||
s_log.error("None of the elements match! name: " + name
|
s_log.error("None of the elements match! name: " + name
|
||||||
+ " qName: " + qName + " URI: " + uri);
|
+ " qName: " + qName + " URI: " + uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!create && deletableType) {
|
|
||||||
m_type.deleteType();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue