}
protected void updatePage(CPPage page) {
DefaultElement ele = cpcore.getElementByIdentifier(page.getIdentifier());
if (ele instanceof CPItem) {
CPItem item = (CPItem) ele;
item.setTitle(page.getTitle());
item.setMetadata(page.getMetadata());
String itemIdentifierRef = item.getIdentifierRef();
if (itemIdentifierRef == null || itemIdentifierRef.equals("")) {
// This item has no linked resource yet. Add one if there is a page file
// attached.
VFSLeaf pageFile = page.getPageFile();
if (pageFile != null) {
CPResource res = new CPResource();
CPFile file = new CPFile(pageFile);
res.addFile(file);
// TODO:GW Set type according to file
res.setType("text/html");
res.setHref(file.getHref());
item.setIdentifierRef(res.getIdentifier());
cpcore.getRootNode().getResources().addResource(res);
}
} else {// this item has already a linked resource
// this is not supported, we don't change linked resources...
}