Author: xlawrence
Date: Tue Jun 19 16:23:17 2007
New Revision: 17644
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D17644&repname=
=3Djahia
Log:
Resolve issue http://www.jahia.net/jira/browse/JAHIA-2058: Sp2 URL Integrit=
y Checking: No warning displayed in the workflow engine when there is a bro=
ken link on the page (or a broken file or a WAI problem)
Modified:
branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/fields/Co=
ntentBigTextField.java
Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/fie=
lds/ContentBigTextField.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/services/fields/ContentBigTextField.java&re=
v=3D17644&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/fields/Co=
ntentBigTextField.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/fields/Co=
ntentBigTextField.java Tue Jun 19 16:23:17 2007
@@ -46,52 +46,53 @@
=
=
public class ContentBigTextField extends ContentField {
- =
+
private static final org.apache.log4j.Logger logger
=3D org.apache.log4j.Logger.getLogger(ContentBigTextField.clas=
s);
- =
+
protected ContentBigTextField(final Integer ID,
- final Integer jahiaID,
- final Integer pageID,
- final Integer ctnid,
- final Integer fieldDefID,
- final Integer fieldType,
- final Integer connectType,
- final Integer aclID,
- final List activeAndStagingEntryStates,
- final Map activeAndStagedDBValues) throws JahiaException {
+ final Integer jahiaID,
+ final Integer pageID,
+ final Integer ctnid,
+ final Integer fieldDefID,
+ final Integer fieldType,
+ final Integer connectType,
+ final Integer aclID,
+ final List activeAndStagingEntryStates,
+ final Map activeAndStagedDBValues) throw=
s JahiaException {
super(ID.intValue(), jahiaID.intValue(), pageID.intValue(),
ctnid.intValue(), fieldDefID.intValue(), fieldType.intValu=
e(),
connectType.intValue(), aclID.intValue(),
activeAndStagingEntryStates, activeAndStagedDBValues);
}
- =
+
//--------------------------------------------------------------------=
------
- public static synchronized ContentBigTextField createBigText(final int=
siteID, =
- final int pageID, =
- final int containerID,
- final int fieldDefID, =
- final int parentAclID, =
- final int aclID,
- final String text, =
- final ProcessingContext jParams)
+ public static synchronized ContentBigTextField createBigText(final int=
siteID,
+ final int=
pageID,
+ final int=
containerID,
+ final int=
fieldDefID,
+ final int=
parentAclID,
+ final int=
aclID,
+ final Str=
ing text,
+ final Pro=
cessingContext jParams)
throws JahiaException {
- =
+
final ContentBigTextField result =3D
(ContentBigTextField) ContentField.createField(siteID, pag=
eID,
- containerID, fieldDefID,
- ContentFieldTypes.BIGTEXT,
- ConnectionTypes.LOCAL,
- parentAclID, aclID);
+ containerID, fieldDefID,
+ ContentFieldTypes.BIGTEXT,
+ ConnectionTypes.LOCAL,
+ parentAclID, aclID);
final EntrySaveRequest saveRequest =3D
new EntrySaveRequest(jParams.getUser(),
- jParams.getLocale().toString());
- =
+ jParams.getLocale().toString());
+
result.setText(text, saveRequest);
return result;
}
- =
+
//--------------------------------------------------------------------=
------
+
/**
* Gets the String representation of this field. In case of an Applica=
tion,
* it will be the output of the application, in case of a bigtext it w=
ill
@@ -100,19 +101,19 @@
* This method should call getDBValue to get the DBValue
*/
public String getValue(final ProcessingContext jParams,
- final ContentObjectEntryState entryState)
+ final ContentObjectEntryState entryState)
throws JahiaException {
- =
- logger.debug("Loading big text field... (ID =3D " +getID()+ ")");
- =
+
+ logger.debug("Loading big text field... (ID =3D " + getID() + ")");
+
final JahiaFieldDefinition theDef =3D JahiaFieldDefinitionsRegistr=
y.
getInstance().getDefinition(this.getFieldDefID());
int pageDefID =3D 0;
- if ( theDef.getJahiaID() !=3D 0 ){
+ if (theDef.getJahiaID() !=3D 0) {
if (entryState !=3D null) {
pageDefID =3D
ContentPage.getPage(this.getPageID()).getDefinitio=
nID(
- new EntryLoadRequest(entryState));
+ new EntryLoadRequest(entryState));
} else {
if (jParams !=3D null) {
pageDefID =3D ServicesRegistry.getInstance().getJahiaP=
ageService().
@@ -121,16 +122,16 @@
}
}
}
- =
+
String result =3D ServicesRegistry.getInstance().getJahiaTextFileS=
ervice().
loadBigTextValue(this.getSiteID(),
- this.getPageID(),
- this.getID(),
- theDef.getDefaultValue(pageDefID),
- entryState.getVersionID(),
- entryState.getWorkflowState(),
- entryState.getLanguageCode());
- =
+ this.getPageID(),
+ this.getID(),
+ theDef.getDefaultValue(pageDefID),
+ entryState.getVersionID(),
+ entryState.getWorkflowState(),
+ entryState.getLanguageCode());
+
if (result =3D=3D null || result.equals("<empty>")) {
result =3D new String();
}
@@ -142,14 +143,15 @@
*/
return result;
}
- =
+
//--------------------------------------------------------------------=
------
+
/**
* Sets the String representation of this field.
* This method should call preSet.
*/
- public void setText(final String value, final EntrySaveRequest saveReq=
uest) =
- throws JahiaException {
+ public void setText(final String value, final EntrySaveRequest saveReq=
uest)
+ throws JahiaException {
if ("".equals(value)) {
final ContentObjectEntryState verInfo =3D preSet("<empty>", sa=
veRequest);
logger.debug("Saving big text field..." + verInfo.toString());
@@ -163,7 +165,7 @@
} else {
final ContentObjectEntryState verInfo =3D preSet("<text>", sav=
eRequest);
logger.debug("Saving big text field..." + verInfo.toString());
- =
+
ServicesRegistry.getInstance().getJahiaTextFileService().saveC=
ontents(
this.getSiteID(),
this.getPageID(),
@@ -175,20 +177,22 @@
}
postSet(saveRequest);
}
- =
+
//--------------------------------------------------------------------=
------
+
/**
* get the Value that will be added to the search engine for this fiel=
d.
* for a bigtext it will be the content of the bigtext, for an applica=
tion
* the string will be empty!
* Do not return null, return an empty string instead.
*/
- public String getValueForSearch(final ProcessingContext jParams, =
- final ContentObjectEntryState entryState) {
+ public String getValueForSearch(final ProcessingContext jParams,
+ final ContentObjectEntryState entrySta=
te) {
return new String(); /** todo fixme */
}
- =
+
//--------------------------------------------------------------------=
------
+
/**
* This method is called when there is a workflow state change
* Such as staged mode -> active mode (validation), active -> inactiv=
e (for versioning)
@@ -199,37 +203,36 @@
* @param toEntryState the entry state that will be written to the d=
atabase
* @param jParams ProcessingContext object used to get informat=
ion about the user
* doing the request, the current locale, etc...
- *
* @return null if the entry state change wasn't an activation, otherw=
ise it
* returns an object that contains the status of the activatio=
n (whether
* successfull, partial or failed, as well as messages describ=
ing the
* warnings during the activation process)
*/
public ActivationTestResults changeEntryState(final ContentObjectEntry=
State fromEntryState,
- final ContentObjectEntryState toEntryState,
- final ProcessingContext jParams,
- final StateModificationContext stateModifContext)
+ final ContentObjectEntry=
State toEntryState,
+ final ProcessingContext =
jParams,
+ final StateModificationC=
ontext stateModifContext)
throws JahiaException {
- =
+
logger.debug("From " + fromEntryState.toString()
- + " To " + toEntryState.toString());
- =
+ + " To " + toEntryState.toString());
+
final ActivationTestResults activationResults =3D new ActivationTe=
stResults();
try {
ServicesRegistry.getInstance().getJahiaTextFileService().
renameFile(
- this.getSiteID(),
- this.getPageID(),
- this.getID(),
- fromEntryState.getVersionID(),
- fromEntryState.getWorkflowState(),
- fromEntryState.getLanguageCode(), =
- this.getSiteID(),
- this.getPageID(),
- this.getID(),
- toEntryState.getVersionID(),
- toEntryState.getWorkflowState(),
- toEntryState.getLanguageCode()
+ this.getSiteID(),
+ this.getPageID(),
+ this.getID(),
+ fromEntryState.getVersionID(),
+ fromEntryState.getWorkflowState(),
+ fromEntryState.getLanguageCode(),
+ this.getSiteID(),
+ this.getPageID(),
+ this.getID(),
+ toEntryState.getVersionID(),
+ toEntryState.getWorkflowState(),
+ toEntryState.getLanguageCode()
);
activationResults.setStatus(ActivationTestResults.COMPLETED_OP=
ERATION_STATUS);
} catch (Throwable t) {
@@ -238,9 +241,9 @@
}
return activationResults;
}
- =
+
//--------------------------------------------------------------------=
------
- =
+
/**
* If URL Integrity and WAI compliance are activated (or simply 1 of t=
hem),
* warning messages generated by the URL integrity checker and the WAI
@@ -251,104 +254,97 @@
final ProcessingContext jParams,
final StateModificationContext stateModifContext)
throws JahiaException {
- =
- logger.debug("isContentValidForActivation: (ID =3D " + getID() + "=
)" + =
- languageCodes + ", lang States =3D " + getLanguagesStates(=
));
- =
+
+ logger.debug("isContentValidForActivation: (ID =3D " + getID() + "=
)" + languageCodes);
+
final ActivationTestResults results =3D new ActivationTestResults(=
);
- Iterator iterator =3D getLanguagesStates().keySet().iterator();
- if (!iterator.hasNext()) {
+ final JahiaSite site =3D ServicesRegistry.getInstance().
+ getJahiaSitesService().getSite(jParams.getSiteID());
+
+ if (site.getWAIComplianceCheck() + site.getURLIntegrityCheck() =3D=
=3D 0) {
return results;
}
- final Locale bigTextLocale =3D LanguageCodeConverters.languageCode=
ToLocale((String)iterator.next());
=
final List currentLocales =3D jParams.getLocales();
final Locale currentLocale =3D jParams.getLocale();
- =
- final List locales =3D new Vector();
- // locales.add(new Locale(ContentField.SHARED_LANGUAGE));
- locales.add(bigTextLocale);
- jParams.getEntryLoadRequest().setLocales(locales);
- jParams.setCurrentLocale(bigTextLocale);
- =
- final JahiaBigTextField theField =3D (JahiaBigTextField)ServicesRe=
gistry.getInstance().
- getJahiaFieldService().loadField(getID(), LoadFlags.ALL, j=
Params);
- =
- if (theField =3D=3D null) {
- logger.debug("theField is null...");
+ final Iterator iterator =3D getLanguagesStates().keySet().iterator=
();
+ while (iterator.hasNext()) {
+ final Locale bigTextLocale =3D LanguageCodeConverters.language=
CodeToLocale((String) iterator.next());
+ final List locales =3D new Vector();
+ // locales.add(new Locale(ContentField.SHARED_LANGUAGE));
+ locales.add(bigTextLocale);
+ jParams.getEntryLoadRequest().setLocales(locales);
+ jParams.setCurrentLocale(bigTextLocale);
=
- jParams.getEntryLoadRequest().setLocales(currentLocales);
- jParams.setCurrentLocale(currentLocale);
+ final JahiaBigTextField theField =3D (JahiaBigTextField) Servi=
cesRegistry.getInstance().
+ getJahiaFieldService().loadField(getID(), LoadFlags.AL=
L, jParams);
=
- return results;
- }
- =
- logger.debug("getInternalLinks :" + theField.getInternalLinks());
- =
- final JahiaSite site =3D ServicesRegistry.getInstance().
- getJahiaSitesService().getSite(jParams.getSiteID());
- =
- if (site.getURLIntegrityCheck() =3D=3D 1) { =
- try {
- final Iterator pids =3D theField.getInternalLinks().iterat=
or();
- while (pids.hasNext()) {
- final int pid =3D ((Integer)pids.next()).intValue();
- final ContentPage page;
- try {
- page =3D ContentPage.getPage(pid);
- } catch (JahiaPageNotFoundException e) {
- final EngineMessage msg =3D new EngineMessage(
- "org.jahia.engines.shared.BigText_Field.no=
tExistingWarning",
- Integer.toString(pid));
- final IsValidForActivationResults activationResult=
s =3D
- new IsValidForActivationResults(ContentFie=
ldKey.FIELD_TYPE,
- getID(), jParams.getLocale().toString(), =
- msg);
- results.appendError(activationResults);
- continue;
- }
- =
- if (page =3D=3D null) {
- final EngineMessage msg =3D new EngineMessage(
- "org.jahia.engines.shared.BigText_Field.no=
tExistingWarning",
- Integer.toString(pid));
- final IsValidForActivationResults activationResult=
s =3D
- new IsValidForActivationResults(ContentFie=
ldKey.FIELD_TYPE,
- getID(), jParams.getLocale().toString(),
- msg);
- results.appendError(activationResults);
- continue;
- }
- =
- final HashMap engineMap =3D new HashMap(1);
- final JahiaContainer container =3D ServicesRegistry.ge=
tInstance().
- getJahiaContainersService().loadContainer(getC=
ontainerID(),
- LoadFlags.ALL, jParams);
- engineMap.put("theContainer", container);
- =
- final String noAccess =3D BigText_Field.getInstance().
- getFieldGroupsNotHavingAccessOnPageAsString(
- pid, theField, jParams, engineMap);
- =
- if (noAccess !=3D null && noAccess.length() > 0) {
- final String[] values =3D {Integer.toString(pid), =
noAccess};
- final EngineMessage msg =3D new EngineMessage(
- "org.jahia.engines.shared.BigText_Field.le=
ssAccessWarning",
- values);
- final IsValidForActivationResults activationResult=
s =3D
- new IsValidForActivationResults(ContentFie=
ldKey.FIELD_TYPE,
- getID(), jParams.getLocale().toString(),
- msg);
- results.appendError(activationResults);
- }
- =
- // For each active site language
- final Iterator ite =3D languageCodes.iterator();
- while (ite.hasNext()) {
- final String lang =3D (String)ite.next();
- final String state =3D BigText_Field.getInstance()=
.getPageState(pid, lang);
- =
- if ("active".equals(state) || "staging_OK".equals(=
state)) { continue; }
+ if (theField =3D=3D null) {
+ logger.debug("theField is null...");
+ continue;
+ }
+
+ logger.debug("getInternalLinks :" + theField.getInternalLinks(=
));
+
+ if (site.getURLIntegrityCheck() =3D=3D 1) {
+ try {
+ final Iterator pids =3D theField.getInternalLinks().it=
erator();
+ while (pids.hasNext()) {
+ final int pid =3D ((Integer) pids.next()).intValue=
();
+ final ContentPage page;
+ try {
+ page =3D ContentPage.getPage(pid);
+ } catch (JahiaPageNotFoundException e) {
+ final EngineMessage msg =3D new EngineMessage(
+ "org.jahia.engines.shared.BigText_Fiel=
d.notExistingWarning",
+ Integer.toString(pid));
+ final IsValidForActivationResults activationRe=
sults =3D
+ new IsValidForActivationResults(Conten=
tFieldKey.FIELD_TYPE,
+ getID(), jParams.getLocale().t=
oString(),
+ msg);
+ results.appendError(activationResults);
+ continue;
+ }
+
+ if (page =3D=3D null) {
+ final EngineMessage msg =3D new EngineMessage(
+ "org.jahia.engines.shared.BigText_Fiel=
d.notExistingWarning",
+ Integer.toString(pid));
+ final IsValidForActivationResults activationRe=
sults =3D
+ new IsValidForActivationResults(Conten=
tFieldKey.FIELD_TYPE,
+ getID(), jParams.getLocale().t=
oString(),
+ msg);
+ results.appendError(activationResults);
+ continue;
+ }
+
+ final HashMap engineMap =3D new HashMap(1);
+ final JahiaContainer container =3D ServicesRegistr=
y.getInstance().
+ getJahiaContainersService().loadContainer(=
getContainerID(),
+ LoadFlags.ALL, jParams);
+ engineMap.put("theContainer", container);
+
+ final String noAccess =3D BigText_Field.getInstanc=
e().
+ getFieldGroupsNotHavingAccessOnPageAsStrin=
g(
+ pid, theField, jParams, engineMap);
+
+ if (noAccess !=3D null && noAccess.length() > 0) {
+ final String[] values =3D {Integer.toString(pi=
d), noAccess};
+ final EngineMessage msg =3D new EngineMessage(
+ "org.jahia.engines.shared.BigText_Fiel=
d.lessAccessWarning",
+ values);
+ final IsValidForActivationResults activationRe=
sults =3D
+ new IsValidForActivationResults(Conten=
tFieldKey.FIELD_TYPE,
+ getID(), jParams.getLocale().t=
oString(),
+ msg);
+ results.appendError(activationResults);
+ }
+
+ final String state =3D BigText_Field.getInstance()=
.getPageState(pid, bigTextLocale.toString());
+
+ if ("active".equals(state) || "staging_OK".equals(=
state)) {
+ continue;
+ }
if ("staging".equals(state)) {
if (page.getActiveVersionID() <=3D 0) {
final EngineMessage msg =3D new EngineMess=
age(
@@ -356,22 +352,21 @@
Integer.toString(pid));
final IsValidForActivationResults activati=
onResults =3D
new IsValidForActivationResults(Co=
ntentFieldKey.FIELD_TYPE,
- getID(), jParams.getLocale().toStr=
ing(),
- msg);
+ getID(), jParams.getLocale=
().toString(),
+ msg);
results.appendError(activationResults);
- =
}
- =
+
} else if ("markForDeleted".equals(state)) {
final EngineMessage msg =3D new EngineMessage(
"org.jahia.engines.shared.BigText_Fiel=
d.markForDeleteWarning",
Integer.toString(pid));
final IsValidForActivationResults activationRe=
sults =3D
new IsValidForActivationResults(Conten=
tFieldKey.FIELD_TYPE,
- getID(), jParams.getLocale().toString(=
), =
- msg);
+ getID(), jParams.getLocale().t=
oString(),
+ msg);
results.appendError(activationResults);
- =
+
} else if ("waiting".equals(state)) {
if (page.getActiveVersionID() <=3D 0) {
final EngineMessage msg =3D new EngineMess=
age(
@@ -379,76 +374,78 @@
Integer.toString(pid));
final IsValidForActivationResults activati=
onResults =3D
new IsValidForActivationResults(Co=
ntentFieldKey.FIELD_TYPE,
- getID(), jParams.getLocale().toStr=
ing(),
- msg);
+ getID(), jParams.getLocale=
().toString(),
+ msg);
results.appendError(activationResults);
- =
+
}
- =
+
} else {
- throw new JahiaException("Unknown state value:=
"+state,
- "Unknown state value: "+state,
+ throw new JahiaException("Unknown state value:=
" + state,
+ "Unknown state value: " + state,
JahiaException.ENGINE_ERROR,
JahiaException.ERROR_SEVERITY);
}
+
}
+
+ final Iterator invalidKeys =3D theField.getWrongURLKey=
s().iterator();
+ while (invalidKeys.hasNext()) {
+ final String invalidKey =3D (String) invalidKeys.n=
ext();
+ final EngineMessage msg =3D new EngineMessage(
+ "org.jahia.engines.shared.BigText_Field.wr=
ongKeys",
+ invalidKey);
+ final IsValidForActivationResults activationResult=
s =3D
+ new IsValidForActivationResults(ContentFie=
ldKey.FIELD_TYPE,
+ getID(), jParams.getLocale().toStr=
ing(),
+ msg);
+ results.appendError(activationResults);
+ }
+
+ } catch (ClassNotFoundException e) {
+ logger.error("ClassNotFoundException", e);
}
- =
- final Iterator invalidKeys =3D theField.getWrongURLKeys().=
iterator();
- while (invalidKeys.hasNext()) {
- final String invalidKey =3D (String)invalidKeys.next();
- final EngineMessage msg =3D new EngineMessage(
- "org.jahia.engines.shared.BigText_Field.wrongK=
eys",
- invalidKey);
- final IsValidForActivationResults activationResults =
=3D
- new IsValidForActivationResults(ContentFieldKe=
y.FIELD_TYPE,
- getID(), jParams.getLocale().toString(),
- msg);
- results.appendError(activationResults);
- }
- =
- } catch (ClassNotFoundException e) {
- logger.error("ClassNotFoundException", e);
}
- }
- =
- if (site.getWAIComplianceCheck() =3D=3D 1) {
- try {
- logger.debug("WAI check on: " + theField);
- final EngineValidationHelper evh =3D WAIValidator.getInsta=
nce().
- validate("<html>" + theField.getValue() + "</html>=
");
- =
- logger.debug("EVH: " + evh);
- =
- final Iterator ite =3D evh.getErrors().iterator();
- while (ite.hasNext()) {
- final ValidationError error =3D (ValidationError)ite.n=
ext();
- final EngineMessage msg =3D new EngineMessage(
- error.getRessourceBundleProp(), error.getValue=
s());
- logger.debug("Adding 1 error: " + msg);
- final IsValidForActivationResults activationResults =
=3D
- new IsValidForActivationResults(ContentFieldKe=
y.FIELD_TYPE,
- getID(), jParams.getLocale().toString(), msg);
- results.appendError(activationResults);
+
+ if (site.getWAIComplianceCheck() =3D=3D 1) {
+ try {
+ logger.debug("WAI check on: " + theField);
+ final EngineValidationHelper evh =3D WAIValidator.getI=
nstance().
+ validate("<html>" + theField.getValue() + "</h=
tml>");
+
+ logger.debug("EVH: " + evh);
+
+ final Iterator ite =3D evh.getErrors().iterator();
+ while (ite.hasNext()) {
+ final ValidationError error =3D (ValidationError) =
ite.next();
+ final EngineMessage msg =3D new EngineMessage(
+ error.getRessourceBundleProp(), error.getV=
alues());
+ logger.debug("Adding 1 error: " + msg);
+ final IsValidForActivationResults activationResult=
s =3D
+ new IsValidForActivationResults(ContentFie=
ldKey.FIELD_TYPE,
+ getID(), jParams.getLocale().toStr=
ing(), msg);
+ results.appendError(activationResults);
+ }
+ } catch (ClassNotFoundException e) {
+ logger.error("ClassNotFoundException", e);
}
- } catch (ClassNotFoundException e) {
- logger.error("ClassNotFoundException", e);
}
}
- =
+
if (results.getErrors().size() > 0) {
results.setStatus(ActivationTestResults.FAILED_OPERATION_STATU=
S);
}
- =
- logger.debug("Results for "+ getID() + ": " + results);
- =
+
+ logger.debug("Results for " + getID() + ": " + results);
+
jParams.getEntryLoadRequest().setLocales(currentLocales);
jParams.setCurrentLocale(currentLocale);
- =
+
return results;
}
- =
+
//--------------------------------------------------------------------=
------
+
/**
* This method is called when a entry should be copied into a new entry
* it is called when an old version -> active version move occurs
@@ -458,11 +455,11 @@
* @param toEntryState the entry state that will be written to the d=
atabase
*/
public void copyEntry(final EntryStateable fromEntryState,
- final EntryStateable toEntryState) throws JahiaException {
- =
+ final EntryStateable toEntryState) throws JahiaE=
xception {
+
int fromVersionID =3D fromEntryState.getVersionID();
- =
- if (fromEntryState.getWorkflowState() =3D=3D =
+
+ if (fromEntryState.getWorkflowState() =3D=3D
ContentObjectEntryState.WORKFLOW_STATE_VERSIONING_DELETED)=
{
// lookup for the last archive done before the deleted entrySt=
ate
// and restore it.
@@ -474,7 +471,7 @@
fromVersionID =3D archiveEntryState.getVersionID();
}
}
- =
+
ServicesRegistry.getInstance().getJahiaTextFileService().copyFile(
this.getSiteID(),
this.getPageID(),
@@ -488,12 +485,13 @@
toEntryState.getVersionID(),
toEntryState.getWorkflowState(),
toEntryState.getLanguageCode()
- );
- =
+ );
+
super.copyEntry(fromEntryState, toEntryState);
}
- =
+
//--------------------------------------------------------------------=
------
+
/**
* This method is called when an entry should be deleted for real.
* It is called when a field is deleted, and versioning is disabled, or
@@ -504,7 +502,7 @@
* @param deleteEntryState the entry state to delete
*/
public void deleteEntry(final EntryStateable deleteEntryState)
- throws JahiaException {
+ throws JahiaException {
ServicesRegistry.getInstance().getJahiaTextFileService().deleteFil=
e(
this.getSiteID(),
this.getPageID(),
@@ -512,11 +510,12 @@
deleteEntryState.getVersionID(),
deleteEntryState.getWorkflowState(),
deleteEntryState.getLanguageCode());
- =
+
super.deleteEntry(deleteEntryState);
}
- =
+
//--------------------------------------------------------------------=
------
+
/**
* Is this kind of field shared (i.e. not one version for each languag=
e,
* but one version for every language)
@@ -524,7 +523,7 @@
public boolean isShared() {
return false;
}
- =
+
/**
* This is called on all content fields to have them serialized only t=
heir
* specific part. The actual field metadata seriliazing is handled by =
the
@@ -537,37 +536,36 @@
* output of elements.
* @param entryState the ContentFieldEntryState for which=
to generate the
* XML export.
- * @param processingContext specifies context of seriali=
zation, such as current
+ * @param processingContext specifies context of serialization, =
such as current
* user, current request parameters, en=
try load request, URL generation
* information such as ServerName, Serv=
erPort, ContextPath, etc... URL
* generation is an important part of X=
ML serialization and this is why
* we pass this parameter down, as well=
as user rights checking.
- *
* @throws IOException in case there was an error writing to the Writer
* output object.
*/
protected void serializeContentToXML(final XmlWriter xmlWriter,
- final XMLSerializationOptions xmlSerializationOptions,
- final ContentObjectEntryState entryState,
- final ProcessingContext processingContext) throws IOException {
+ final XMLSerializationOptions xml=
SerializationOptions,
+ final ContentObjectEntryState ent=
ryState,
+ final ProcessingContext processin=
gContext) throws IOException {
try {
final JahiaFieldDefinition theDef =3D JahiaFieldDefinitionsReg=
istry.
getInstance().getDefinition(this.getFieldDefID());
- =
+
final int pageDefID =3D ServicesRegistry.getInstance().getJahi=
aPageService().
lookupContentPage(this.getPageID(), true).
getPageTemplateID(EntryLoadRequest.CURRENT);
- =
+
String result =3D ServicesRegistry.getInstance()
- .getJahiaTextFileService()
- .loadBigTextValue(this.getSiteID(),
- this.getPageID(),
- this.getID(),
- theDef.getDefaultValue(pageDefID),
- entryState.getVersionID(),
- entryState.getWorkflowState(),
- entryState.getLanguageCode());
- =
+ .getJahiaTextFileService()
+ .loadBigTextValue(this.getSiteID(),
+ this.getPageID(),
+ this.getID(),
+ theDef.getDefaultValue(pageDefID),
+ entryState.getVersionID(),
+ entryState.getWorkflowState(),
+ entryState.getLanguageCode());
+
if (result =3D=3D null || result.equals("<empty>")) {
result =3D "";
}
@@ -576,13 +574,13 @@
logger.debug("Error while serializing bigtext to XML : ", je);
}
}
- =
+
protected void purgeContent()
- throws JahiaException {
+ throws JahiaException {
// not necessary since already done in site admin interface, but we
// should implement this if we want to be able to do atomic purgin=
g.
}
- =
+
/**
* Called when marking a language for deletion on a field. This is done
* first to allow field implementation to provide a custom behavior wh=
en
@@ -592,13 +590,12 @@
* @param user
* @param languageCode
* @param stateModifContext used to detect loops in deletion marking.
- *
* @throws JahiaException in the case there was an error processing the
* marking of the content.
*/
protected void markContentLanguageForDeletion(final JahiaUser user,
- final String languageCode,
- final StateModificationContext stateModifContext)
+ final String languageCod=
e,
+ final StateModificationC=
ontext stateModifContext)
throws JahiaException {
final ArrayList locales =3D new ArrayList();
locales.add(LanguageCodeConverters.languageCodeToLocale(languageCo=
de));
@@ -621,7 +618,7 @@
toEntryState.getVersionID(),
toEntryState.getWorkflowState(),
toEntryState.getLanguageCode()
- );
+ );
}
}
}
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list