Author: tdraier
Date: Thu Jul 12 11:04:29 2007
New Revision: 17942
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D17942&repname=
=3Djahia
Log:
-use stateModificationContext to store the list of all activated objects
-links do not display validation errors if destination is part of validation
-correctly propagate delete validation, removed inconsistent warning =
(port 17925)
Modified:
trunk/core/src/java/org/jahia/services/fields/ContentPageField.java
trunk/core/src/java/org/jahia/services/version/StateModificationContext=
.java
trunk/core/src/java/org/jahia/services/workflow/ActivationJob.java
trunk/core/src/java/org/jahia/services/workflow/NotifyAllJob.java
trunk/core/src/java/org/jahia/services/workflow/PublishAllJob.java
trunk/core/src/java/org/jahia/services/workflow/SimpleActivationJob.java
trunk/core/src/java/org/jahia/services/workflow/WorkflowService.java
Modified: trunk/core/src/java/org/jahia/services/fields/ContentPageField.ja=
va
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/services/fields/ContentPageField.java&rev=3D17942&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
--- trunk/core/src/java/org/jahia/services/fields/ContentPageField.java (or=
iginal)
+++ trunk/core/src/java/org/jahia/services/fields/ContentPageField.java Thu=
Jul 12 11:04:29 2007
@@ -404,7 +404,8 @@
linkPage =3D null;
}
if (linkPage !=3D null) {
- if (linkPage.hasActiveEntries() || isMarkedFor=
Delete()) {
+ if (linkPage.hasActiveEntries() || isMarkedFor=
Delete() ||
+ stateModifContext.isModifiedObject(Wor=
kflowService.getInstance().getMainLinkObject(new ContentPageKey(linkPage.ge=
tID())))) {
activationTestResults.setStatus(Activation=
TestResults.COMPLETED_OPERATION_STATUS);
} else {
activationTestResults.setStatus(Activation=
TestResults.PARTIAL_OPERATION_STATUS);
Modified: trunk/core/src/java/org/jahia/services/version/StateModificationC=
ontext.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/services/version/StateModificationContext.java&rev=3D17942&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
--- trunk/core/src/java/org/jahia/services/version/StateModificationContext=
.java (original)
+++ trunk/core/src/java/org/jahia/services/version/StateModificationContext=
.java Thu Jul 12 11:04:29 2007
@@ -19,8 +19,10 @@
import java.util.HashSet;
import java.util.Set;
import java.util.Stack;
+import java.util.Collection;
=
import org.jahia.content.ObjectKey;
+import org.jahia.content.ContentObjectKey;
=
/**
* <p>Title: Contains the "context" of an activation operation</p>
@@ -56,6 +58,8 @@
// for deletion operations because we might break content tree nodes.
private Stack allLanguagesStack =3D new Stack();
=
+ private Set allModifiedObjects =3D new HashSet();
+
/**
* Making the default constructor private because we want to enforce t=
he
* creation of this object only with valid language codes.
@@ -215,4 +219,16 @@
final Boolean removedElement =3D (Boolean) allLanguagesStack.pop();
return removedElement.booleanValue();
}
+
+ public void addModifiedObject(ContentObjectKey k) {
+ allModifiedObjects.add(k);
+ }
+
+ public void addModifiedObjects(Collection c) {
+ allModifiedObjects.addAll(c);
+ }
+
+ public boolean isModifiedObject(ContentObjectKey k) {
+ return allModifiedObjects.contains(k);
+ }
}
\ No newline at end of file
Modified: trunk/core/src/java/org/jahia/services/workflow/ActivationJob.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/services/workflow/ActivationJob.java&rev=3D17942&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
--- trunk/core/src/java/org/jahia/services/workflow/ActivationJob.java (ori=
ginal)
+++ trunk/core/src/java/org/jahia/services/workflow/ActivationJob.java Thu =
Jul 12 11:04:29 2007
@@ -1,18 +1,18 @@
/*
* Copyright 2002-2006 Jahia Ltd
*
- * Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (J=
CDDL), =
- * Version 1.0 (the "License"), or (at your option) any later version; you=
may =
- * not use this file except in compliance with the License. You should hav=
e =
- * received a copy of the License along with this program; if not, you may=
obtain =
- * a copy of the License at =
+ * Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (J=
CDDL),
+ * Version 1.0 (the "License"), or (at your option) any later version; you=
may
+ * not use this file except in compliance with the License. You should have
+ * received a copy of the License along with this program; if not, you may=
obtain
+ * a copy of the License at
*
* http://www.jahia.org/license/
*
- * Unless required by applicable law or agreed to in writing, software =
- * distributed under the License is distributed on an "AS IS" BASIS, =
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied=
. =
- * See the License for the specific language governing permissions and =
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jahia.services.workflow;
@@ -102,16 +102,20 @@
String additionalKey =3D (String) additionalIt.next();
Set languageCodes =3D (Set) options.get(additionalKey);
=
+
+ final StateModificationContext stateModifContext =3D n=
ew StateModificationContext(key, languageCodes);
+ stateModifContext.addModifiedObjects(ordered);
+
ExternalWorkflow externalWorkflow =3D processWorkflow(=
processingContext, workflowHelper, key,
additionalKey, action, languageCodes, saveVers=
ion,
- userNotifData, comment, activationTestResults);
- if(externalWorkflow!=3D null) {
+ userNotifData, comment, activationTestResults,=
stateModifContext);
+ if (externalWorkflow !=3D null) {
externalWorkflows.put(externalWorkflow, externalWo=
rkflow);
}
}
}
} finally {
- if(externalWorkflows.size()>0) {
+ if (externalWorkflows.size() > 0) {
Iterator it =3D externalWorkflows.keySet().iterator();
while (it.hasNext()) {
ExternalWorkflow externalWorkflow =3D (ExternalWorkflo=
w) it.next();
@@ -134,10 +138,8 @@
final JahiaSaveVersion =
saveVersion,
Map userNotifData,
String comment,
- ActivationTestResults a=
ctivationTestResults)
+ ActivationTestResults a=
ctivationTestResults, StateModificationContext stateModifContext)
throws JahiaException {
- final StateModificationContext stateModifContext =3D new StateModi=
ficationContext(key, languageCodes);
- stateModifContext.setDescendingInSubPages(false);
=
ContentObject object =3D null;
ExternalWorkflow externalWorkflow =3D null;
@@ -151,25 +153,6 @@
=
try {
ContentObject contentObject =3D (ContentObject) ContentObject.=
getInstance(key, true);
- if (contentObject instanceof ContentPage) {
- ContentPage contentPage =3D (ContentPage) contentObject;
- if (contentObject.isMarkedForDelete()) {
- List childs =3D ServicesRegistry.getInstance().getJahi=
aPageService().getPageSubTree(contentPage.getPageID(), PageLoadFlags.DIRECT=
, jParams);
- for (int i =3D 0; i < childs.size() && activationTestR=
esults.getStatus()!=3DActivationTestResults.FAILED_OPERATION_STATUS; i++) {
- JahiaPage curJahiaPage =3D (JahiaPage) childs.get(=
i);
- ContentPage curContentPage =3D curJahiaPage.getCon=
tentPage();
- processWorkflow(jParams, workflowHelper, curConten=
tPage.getObjectKey(), additionalKey, action, languageCodes, saveVersion, us=
erNotifData, comment, activationTestResults);
- }
- } else if (contentObject.getPickedObject() !=3D null) {
- List childs =3D ServicesRegistry.getInstance().getJahi=
aPageService().getPageSubTree(contentPage.getPageID(), PageLoadFlags.DIRECT=
, jParams);
- for (int i =3D 0; i < childs.size(); i++) {
- JahiaPage curJahiaPage =3D (JahiaPage) childs.get(=
i);
- ContentPage curContentPage =3D curJahiaPage.getCon=
tentPage();
- if(curContentPage.isMarkedForDelete())
- processWorkflow(jParams, workflowHelper, curCo=
ntentPage.getObjectKey(), additionalKey, action, languageCodes, saveVersion=
, userNotifData, comment, activationTestResults);
- }
- }
- }
if (mode =3D=3D WorkflowService.INACTIVE) {
if (action.equals(AdvancedWorkflowEngine.APPROVE_PENDING_P=
AGES)
&& additionalKey.equals(AdvancedWorkflowEngine.ACC=
EPT)) {
@@ -180,7 +163,7 @@
saveVersion, jParams,
stateModifContext));
} catch (JahiaException je) {
- logger.error("Cannot change Jahia Page staging sta=
tus",je);
+ logger.error("Cannot change Jahia Page staging sta=
tus", je);
}
}
} else if (mode =3D=3D WorkflowService.JAHIA_INTERNAL) {
@@ -192,44 +175,44 @@
pageID =3D contentObject.getID();
parentPage =3D (ContentPage) contentObject;
} else if (contentObject instanceof ContentContainer ||
- contentObject instanceof ContentContainerLi=
st) {
+ contentObject instanceof ContentContainerList)=
{
pageID =3D contentObject.getPageID();
- parentPage =3D ContentPage.getPage(pageID,false,tr=
ue);
+ parentPage =3D ContentPage.getPage(pageID, false, =
true);
} else if (contentObject instanceof ContentField) {
ContentField contentField =3D (ContentField) conte=
ntObject;
if (contentField.getType() !=3D FieldTypes.PAGE) {
pageID =3D contentField.getPageID();
- parentPage =3D ContentPage.getPage(pageID,fals=
e,true);
+ parentPage =3D ContentPage.getPage(pageID, fal=
se, true);
}
}
if (action.equals(AdvancedWorkflowEngine.NOTIFY_COMPLE=
TED_PAGES)) {
service.changeStagingStatus(contentObject, languag=
eCodes,
- EntryLoadRequest.WAITI=
NG_WORKFLOW_STATE, stateModifContext, jParams,
- false);
- if(pageID>0)
- pageNotifData =3D new PageNotifData(
- jParams.getSiteURL(jParams.getSite(), page=
ID, false, false, true), comment,
- parentPage, languageCodes, true, null, nul=
l);
+ EntryLoadRequest.WAITING_WORKFLOW_STATE, s=
tateModifContext, jParams,
+ false);
+ if (pageID > 0)
+ pageNotifData =3D new PageNotifData(
+ jParams.getSiteURL(jParams.getSite(), =
pageID, false, false, true), comment,
+ parentPage, languageCodes, true, null,=
null);
} else if (action.equals(AdvancedWorkflowEngine.APPROV=
E_PENDING_PAGES) &&
- additionalKey.equals(AdvancedWorkflowEngine=
.ACCEPT)) {
+ additionalKey.equals(AdvancedWorkflowEngine.AC=
CEPT)) {
ActivationTestResults res =3D service.activate(con=
tentObject, languageCodes, saveVersion, jParams,
- state=
ModifContext);
+ stateModifContext);
final boolean workflowSuccessful =3D (res.getStatu=
s() !=3D ActivationTestResults.FAILED_OPERATION_STATUS);
- if(pageID>0)
- pageNotifData =3D new PageNotifData(
- jParams.getSiteURL(jParams.getSite(), page=
ID, false, false, true), comment,
- parentPage, languageCodes, workflowSuccess=
ful, res.getErrors(),
- res.getWarnings());
+ if (pageID > 0)
+ pageNotifData =3D new PageNotifData(
+ jParams.getSiteURL(jParams.getSite(), =
pageID, false, false, true), comment,
+ parentPage, languageCodes, workflowSuc=
cessful, res.getErrors(),
+ res.getWarnings());
activationTestResults.merge(res);
} else if (action.equals(AdvancedWorkflowEngine.APPROV=
E_PENDING_PAGES) &&
- additionalKey.equals(AdvancedWorkflowEngine=
.REFUSE)) {
+ additionalKey.equals(AdvancedWorkflowEngine.RE=
FUSE)) {
service.changeStagingStatus(contentObject, languag=
eCodes,
- EntryLoadRequest.STAGI=
NG_WORKFLOW_STATE, stateModifContext, jParams,
- true);
- if(pageID>0)
- pageNotifData =3D new PageNotifData(
- jParams.getSiteURL(jParams.getSite(), page=
ID, false, false, true), comment,
- parentPage, languageCodes, true, null, nul=
l);
+ EntryLoadRequest.STAGING_WORKFLOW_STATE, s=
tateModifContext, jParams,
+ true);
+ if (pageID > 0)
+ pageNotifData =3D new PageNotifData(
+ jParams.getSiteURL(jParams.getSite(), =
pageID, false, false, true), comment,
+ parentPage, languageCodes, true, null,=
null);
}
} catch (JahiaException je) {
logger.error("Cannot change Jahia Page staging status"=
, je);
@@ -246,10 +229,10 @@
while (iterator2.hasNext()) {
final String language =3D (String) iterator2.next(=
);
if (AdvancedWorkflowEngine.APPROVE_PENDING_PAGES.e=
quals(action)
- && additionalKey.equals(AdvancedWorkflowEngine=
.ACCEPT)) {
+ && additionalKey.equals(AdvancedWorkflowEn=
gine.ACCEPT)) {
try {
ActivationTestResults res =3D service.acti=
vate(contentObject, languageCodes, saveVersion,
- =
jParams, stateModifContext);
+ jParams, stateModifContext);
if (res.getStatus() =3D=3D ActivationTestR=
esults.COMPLETED_OPERATION_STATUS) {
externalWorkflow.abortProcess(processI=
d, key.toString(), language, jParams);
}
@@ -257,13 +240,13 @@
} catch (JahiaException je) {
logger.error("Cannot change Jahia Page sta=
ging status", je);
}
- =
+
} else if (AdvancedWorkflowEngine.APPROVE_PENDING_=
PAGES.equals(action)
- && additionalKey.equals(AdvancedWorkflowEngine=
.REFUSE)) {
+ && additionalKey.equals(AdvancedWorkflowEn=
gine.REFUSE)) {
try {
service.changeStagingStatus(contentObject,=
languageCodes,
- EntryLoadReque=
st.STAGING_WORKFLOW_STATE, stateModifContext,
- jParams, true);
+ EntryLoadRequest.STAGING_WORKFLOW_=
STATE, stateModifContext,
+ jParams, true);
} catch (JahiaException je) {
logger.error("Cannot change Jahia Page sta=
ging status", je);
}
@@ -273,8 +256,8 @@
} else if (action.indexOf('.') > -1) {
final String actionName =3D action.substring(a=
ction.lastIndexOf('.') + 1);
boolean result =3D externalWorkflow.sendAction=
(processId, key.toString(), language,
- a=
ctionName, jParams, activationTestResults,
- u=
serNotifData);
+ actionName, jParams, activationTestRes=
ults,
+ userNotifData);
if (!result)
break;
}
@@ -292,17 +275,17 @@
pageID =3D contentObject.getID();
parentPage =3D (ContentPage) contentObject;
} else if (contentObject instanceof ContentContainer ||
- contentObject instanceof ContentContainerLi=
st) {
+ contentObject instanceof ContentContainerList)=
{
pageID =3D contentObject.getPageID();
- parentPage =3D ContentPage.getPage(pageID,false,tr=
ue);
+ parentPage =3D ContentPage.getPage(pageID, false, =
true);
} else if (contentObject instanceof ContentField) {
ContentField contentField =3D (ContentField) conte=
ntObject;
if (contentField.getType() !=3D FieldTypes.PAGE) {
pageID =3D contentField.getPageID();
- parentPage =3D ContentPage.getPage(pageID,fals=
e,true);
+ parentPage =3D ContentPage.getPage(pageID, fal=
se, true);
}
}
- if(pageID>0) {
+ if (pageID > 0) {
PageNotifData pageNotifData =3D new PageNotifData(
jParams.getSiteURL(jParams.getSite(), page=
ID, false, false, true), comment,
parentPage, languageCodes, false, res.getE=
rrors(),
@@ -312,7 +295,7 @@
}
}
} catch (Throwable e) {
- logger.error("Error during workflow operation! We must flush a=
ll caches to ensure integrity between database and viewing",e);
+ logger.error("Error during workflow operation! We must flush a=
ll caches to ensure integrity between database and viewing", e);
ServicesRegistry.getInstance().getCacheService().flushAllCache=
s();
throw new JahiaException(e.getMessage(), e.getMessage(),
JahiaException.DATABASE_ERROR,
@@ -361,9 +344,9 @@
{
return;
}
- Iterator userIter =3D userNotifData.keySet ().iterator ();
+ Iterator userIter =3D userNotifData.keySet().iterator();
=
- MailService mailService =3D ServicesRegistry.getInstance ().getMai=
lService ();
+ MailService mailService =3D ServicesRegistry.getInstance().getMail=
Service();
=
GroovyScriptEngine groovyScriptEngine =3D (GroovyScriptEngine) Spr=
ingContextSingleton.getInstance().getContext().getBean("groovyScriptEngine"=
);
GroovyMimeMessagePreparator workflowMimePreparator =3D new GroovyM=
imeMessagePreparator();
@@ -372,10 +355,10 @@
int userCount =3D 0;
String lastSubject =3D null;
=
- while (userIter.hasNext () && userCount < jParams.settings().getWo=
rkflowMaxNotificationEmails()) {
- String curEmail =3D (String) userIter.next ();
- Map operationMap =3D (Map) userNotifData.get (curEmail);
- logger.debug ("Sending custom notification data to email " +
+ while (userIter.hasNext() && userCount < jParams.settings().getWor=
kflowMaxNotificationEmails()) {
+ String curEmail =3D (String) userIter.next();
+ Map operationMap =3D (Map) userNotifData.get(curEmail);
+ logger.debug("Sending custom notification data to email " +
curEmail);
Binding userBinding =3D new Binding();
=
@@ -394,8 +377,8 @@
while (pageIter.hasNext()) {
PageNotifData curPageNotifData =3D (PageNotifData) pag=
eIter.next();
if (AdvancedWorkflowEngine.APPROVAL_OPNAME.equals(curO=
perationName)) {
- if ( (!curPageNotifData.getContentPage().hasActive=
Entries()) &&
- (curPageNotifData.isWorkflowSuccessful()) ) {
+ if ((!curPageNotifData.getContentPage().hasActiveE=
ntries()) &&
+ (curPageNotifData.isWorkflowSuccessful()))=
{
curPageNotifData.setDeleted(true);
deletedPages.add(curPageNotifData);
}
@@ -417,7 +400,7 @@
PageNotifData pageNotifData =3D (PageNotifData) failed=
Iterator.next();
pageSet.remove(pageNotifData);
}
- if(pageSet.size()=3D=3D0) {
+ if (pageSet.size() =3D=3D 0) {
voidOperation.add(curOperationName);
}
}
@@ -440,7 +423,7 @@
userBinding.setVariable("to", curEmail);
userBinding.setVariable("from", mailService.defaultSender());
userBinding.setVariable("comment", comment);
- userBinding.setVariable("bundle", ResourceBundle.getBundle("Ja=
hiaMessageResources",(Locale) jParams.getSite().getLanguageSettingsAsLocale=
s(true).get(0)));
+ userBinding.setVariable("bundle", ResourceBundle.getBundle("Ja=
hiaMessageResources", (Locale) jParams.getSite().getLanguageSettingsAsLocal=
es(true).get(0)));
workflowMimePreparator.setTemplatePath(jParams.settings().getW=
orkflowNotificationTemplate());
workflowMimePreparator.setBinding(userBinding);
=
@@ -455,7 +438,7 @@
userCount++;
}
=
- if (jParams.settings().isWorkflowNotifyAdminOnMaxNotificationReach=
ed() && =
+ if (jParams.settings().isWorkflowNotifyAdminOnMaxNotificationReach=
ed() &&
userNotifData.size() > jParams.settings().getWorkflowMaxNotifi=
cationEmails() ) {
GroovyMimeMessagePreparator adminMessageMimePreparator =3D new=
GroovyMimeMessagePreparator();
adminMessageMimePreparator.setGroovyScriptEngine(groovyScriptE=
ngine);
@@ -473,67 +456,67 @@
=
}
=
- protected String getRecipientsString (ContentObject contentObject, int=
siteID, int access) {
+ protected String getRecipientsString(ContentObject contentObject, int =
siteID, int access) {
=
- Set recipientList =3D getRecipients (contentObject, siteID, access=
);
+ Set recipientList =3D getRecipients(contentObject, siteID, access);
Iterator recipientIter =3D recipientList.iterator();
- StringBuffer emailListBuf =3D new StringBuffer ();
+ StringBuffer emailListBuf =3D new StringBuffer();
while (recipientIter.hasNext()) {
String email =3D (String) recipientIter.next();
- if (email !=3D null && !"".equals (email)) {
+ if (email !=3D null && !"".equals(email)) {
/** todo : @localhost address generates problems with Wind=
ows */
- if (email.indexOf ("@localhost") !=3D -1) {
+ if (email.indexOf("@localhost") !=3D -1) {
continue;
}
- if (emailListBuf.length () > 0) {
- emailListBuf.append (",");
+ if (emailListBuf.length() > 0) {
+ emailListBuf.append(",");
}
- emailListBuf.append (email);
+ emailListBuf.append(email);
}
}
- logger.debug ("Using email recipient list :" + emailListBuf);
- return emailListBuf.toString ();
+ logger.debug("Using email recipient list :" + emailListBuf);
+ return emailListBuf.toString();
}
=
protected static Set getRecipients(ContentObject contentObject, int si=
teID, int access) {
- Set result =3D new HashSet ();
- result.add (ServicesRegistry.getInstance ().getMailService ().defa=
ultRecipient ());
+ Set result =3D new HashSet();
+ result.add(ServicesRegistry.getInstance().getMailService().default=
Recipient());
// StringBuffer emailListBuf =3D new StringBuffer ();
/**
* todo we could optimize this if we retrieved really only the list
* of using that have write and admin accesses instead of retrievi=
ng
* all users in the ACL.
*/
- JahiaBaseACL pageACL =3D contentObject.getACL ();
+ JahiaBaseACL pageACL =3D contentObject.getACL();
try {
- Vector users =3D pageACL.getUsernameListAlsoGroupUsers (null);
+ Vector users =3D pageACL.getUsernameListAlsoGroupUsers(null);
=
- for (int i =3D 0; i < users.size (); i++) {
- JahiaUser user =3D ServicesRegistry.getInstance ().
- getJahiaUserManagerService ().lookupUser ((String)=
users.get (
- i));
+ for (int i =3D 0; i < users.size(); i++) {
+ JahiaUser user =3D ServicesRegistry.getInstance().
+ getJahiaUserManagerService().lookupUser((String) u=
sers.get(
+ i));
if (user =3D=3D null)
continue;
- String email =3D user.getProperty ("email");
- if (email !=3D null && !"".equals (email)) {
+ String email =3D user.getProperty("email");
+ if (email !=3D null && !"".equals(email)) {
/** todo : @localhost address generates problems with =
Windows */
- if (email.indexOf ("@localhost") !=3D -1) {
+ if (email.indexOf("@localhost") !=3D -1) {
continue;
}
boolean shouldCheckWriteAccess =3D (access & 0x01) !=
=3D 0;
boolean shouldCheckAdminAccess =3D (access & 0x02) !=
=3D 0;
if (shouldCheckWriteAccess &&
- contentObject.checkWriteAccess (user,true) ||
+ contentObject.checkWriteAccess(user, true) ||
shouldCheckAdminAccess &&
- contentObject.checkAdminAccess (user,true)) {
- result.add (email);
+ contentObject.checkAdminAccess(user, t=
rue)) {
+ result.add(email);
}
}
}
} catch (JahiaACLException jae) {
- logger.error ("Error while retrieving users from ACL", jae);
+ logger.error("Error while retrieving users from ACL", jae);
}
- logger.debug ("Using email recipient list :" + result);
+ logger.debug("Using email recipient list :" + result);
return result;
}
=
Modified: trunk/core/src/java/org/jahia/services/workflow/NotifyAllJob.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/services/workflow/NotifyAllJob.java&rev=3D17942&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
--- trunk/core/src/java/org/jahia/services/workflow/NotifyAllJob.java (orig=
inal)
+++ trunk/core/src/java/org/jahia/services/workflow/NotifyAllJob.java Thu J=
ul 12 11:04:29 2007
@@ -22,6 +22,7 @@
import org.jahia.services.lock.LockKey;
import org.jahia.services.version.JahiaSaveVersion;
import org.jahia.services.version.ActivationTestResults;
+import org.jahia.services.version.StateModificationContext;
import org.jahia.services.sites.SiteLanguageSettings;
import org.jahia.registries.ServicesRegistry;
import org.jahia.params.ProcessingContext;
@@ -72,11 +73,17 @@
final ActivationTestResults activationTestResults =3D new Activati=
onTestResults();
final Map userNotifData =3D new HashMap();
try {
- final Iterator iterator =3D allStagingAndWaitingObjects.iterat=
or();
+ List allKeys =3D new ArrayList();
+ for (Iterator iterator =3D allStagingAndWaitingObjects.iterato=
r(); iterator.hasNext();) {
+ String key =3D (String) iterator.next();
+ final ObjectKey objectKey =3D ObjectKey.getInstance(key);
+ allKeys.add(objectKey);
+ }
+ final Iterator iterator =3D allKeys.iterator();
while (iterator.hasNext()) {
- final String key =3D (String) iterator.next();
+ final ObjectKey objectKey =3D (ObjectKey) iterator.next();
+ String key =3D objectKey.toString();
if (logger.isDebugEnabled()) logger.debug("Processing obje=
ct: " + key);
- final ObjectKey objectKey =3D ObjectKey.getInstance(key);
final ContentObject theObject =3D ContentObject.getContent=
ObjectInstance(objectKey);
if (theObject =3D=3D null || ! theObject.checkWriteAccess(=
jParams.getUser())) {
if (logger.isDebugEnabled()) logger.debug("No Write ac=
cess on " + key);
@@ -130,6 +137,10 @@
actionName =3D AdvancedWorkflowEngine.NOTIFY_COMPLETED=
_PAGES;
}
=
+
+ final StateModificationContext stateModifContext =3D new S=
tateModificationContext(objectKey, languageCodes);
+ stateModifContext.addModifiedObjects(allKeys);
+
final ExternalWorkflow externalWorkflow =3D ActivationJob.=
processWorkflow(
jParams,
workflowHelper,
@@ -140,7 +151,7 @@
saveVersion,
userNotifData,
comment,
- activationTestResults);
+ activationTestResults, stateModifContext);
if (externalWorkflow !=3D null) {
externalWorkflows.put(externalWorkflow, externalWorkfl=
ow);
}
Modified: trunk/core/src/java/org/jahia/services/workflow/PublishAllJob.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/services/workflow/PublishAllJob.java&rev=3D17942&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
--- trunk/core/src/java/org/jahia/services/workflow/PublishAllJob.java (ori=
ginal)
+++ trunk/core/src/java/org/jahia/services/workflow/PublishAllJob.java Thu =
Jul 12 11:04:29 2007
@@ -29,6 +29,7 @@
import org.jahia.services.scheduler.BackgroundJob;
import org.jahia.services.version.JahiaSaveVersion;
import org.jahia.services.version.ActivationTestResults;
+import org.jahia.services.version.StateModificationContext;
import org.jahia.services.sites.SiteLanguageSettings;
import org.jahia.workflow.nstep.NStepWorkflow;
import org.quartz.JobDataMap;
@@ -73,11 +74,17 @@
final ActivationTestResults activationTestResults =3D new Activati=
onTestResults();
final Map userNotifData =3D new HashMap();
try {
- final Iterator iterator =3D allStagingAndWaitingObjects.iterat=
or();
+ List allKeys =3D new ArrayList();
+ for (Iterator iterator =3D allStagingAndWaitingObjects.iterato=
r(); iterator.hasNext();) {
+ String key =3D (String) iterator.next();
+ final ObjectKey objectKey =3D ObjectKey.getInstance(key);
+ allKeys.add(objectKey);
+ }
+ final Iterator iterator =3D allKeys.iterator();
while (iterator.hasNext()) {
- final String key =3D (String) iterator.next();
+ final ObjectKey objectKey =3D (ObjectKey) iterator.next();
+ String key =3D objectKey.toString();
if (logger.isDebugEnabled()) logger.debug("Processing obje=
ct: " + key);
- final ObjectKey objectKey =3D ObjectKey.getInstance(key);
final ContentObject theObject =3D ContentObject.getContent=
ObjectInstance(objectKey);
if (theObject =3D=3D null || ! theObject.checkAdminAccess(=
jParams.getUser())) {
if (logger.isDebugEnabled()) logger.debug("No Admin ac=
cess on " + key);
@@ -121,6 +128,9 @@
}
}
=
+ final StateModificationContext stateModifContext =3D new S=
tateModificationContext(objectKey, languageCodes);
+ stateModifContext.addModifiedObjects(allKeys);
+
final ExternalWorkflow externalWorkflow =3D ActivationJob.=
processWorkflow(
jParams,
workflowHelper,
@@ -131,7 +141,7 @@
saveVersion,
userNotifData,
comment,
- activationTestResults);
+ activationTestResults, stateModifContext);
if (externalWorkflow !=3D null) {
externalWorkflows.put(externalWorkflow, externalWorkfl=
ow);
}
Modified: trunk/core/src/java/org/jahia/services/workflow/SimpleActivationJ=
ob.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/services/workflow/SimpleActivationJob.java&rev=3D17942&repname=3Dj=
ahia
=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
--- trunk/core/src/java/org/jahia/services/workflow/SimpleActivationJob.jav=
a (original)
+++ trunk/core/src/java/org/jahia/services/workflow/SimpleActivationJob.jav=
a Thu Jul 12 11:04:29 2007
@@ -1,19 +1,19 @@
-/*
- * Copyright 2002-2006 Jahia Ltd
- *
- * Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (J=
CDDL), =
- * Version 1.0 (the "License"), or (at your option) any later version; you=
may =
- * not use this file except in compliance with the License. You should hav=
e =
- * received a copy of the License along with this program; if not, you may=
obtain =
- * a copy of the License at =
- *
- * http://www.jahia.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software =
- * distributed under the License is distributed on an "AS IS" BASIS, =
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied=
. =
- * See the License for the specific language governing permissions and =
- * limitations under the License.
+/*
+ * Copyright 2002-2006 Jahia Ltd
+ *
+ * Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (J=
CDDL), =
+ * Version 1.0 (the "License"), or (at your option) any later version; you=
may =
+ * not use this file except in compliance with the License. You should hav=
e =
+ * received a copy of the License along with this program; if not, you may=
obtain =
+ * a copy of the License at =
+ *
+ * http://www.jahia.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software =
+ * distributed under the License is distributed on an "AS IS" BASIS, =
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied=
. =
+ * See the License for the specific language governing permissions and =
+ * limitations under the License.
*/package org.jahia.services.workflow;
=
import org.jahia.content.ContentObject;
@@ -61,7 +61,7 @@
try {
object =3D (ContentObject) JahiaObject.getInstance(key);
StateModificationContext stateModifContext =3D new StateMo=
dificationContext(object.getObjectKey(), languages);
-
+ stateModifContext.addModifiedObjects(keys);
service.activate(object, languages, saveVersion, processin=
gContext, stateModifContext);
} catch (ClassNotFoundException e) {
throw new JobExecutionException(e);
Modified: trunk/core/src/java/org/jahia/services/workflow/WorkflowService.j=
ava
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/services/workflow/WorkflowService.java&rev=3D17942&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
--- trunk/core/src/java/org/jahia/services/workflow/WorkflowService.java (o=
riginal)
+++ trunk/core/src/java/org/jahia/services/workflow/WorkflowService.java Th=
u Jul 12 11:04:29 2007
@@ -1137,26 +1137,6 @@
unlinkedContents.add(co);
}
=
- try {
- ContentObject object =3D (ContentObject) ContentObject.getInst=
ance(objectKey);
- if (object.isMarkedForDelete() && !unlinkedContents.isEmpty())=
{
- activationTestResults.setStatus(ActivationTestResults.FAIL=
ED_OPERATION_STATUS);
- try {
- final EngineMessage msg =3D new EngineMessage(
- "org.jahia.services.workflow.WorkflowService.c=
hildObjectsNotValidatedError");
- activationTestResults
- .appendError(new IsValidForActivationResults(o=
bjectKey
- .getType(), Integer
- .parseInt(objectKey.getIDInType()),
- ContentField.SHARED_LANGUAGE, msg));
- } catch (ClassNotFoundException cnfe) {
- logger.debug ("Error while creating activation test no=
de result",
- cnfe);
- }
- }
- } catch (ClassNotFoundException e) {
- }
-
return activationTestResults;
}
=
@@ -1190,6 +1170,7 @@
=
boolean versioningActive =3D jParams.getSite().isVersioningEnabled=
();
ActivationTestResults activationResults =3D new ActivationTestResu=
lts ();
+ Set deletedChilds =3D new HashSet();
List objects =3D getLinkedContentObjects(objectKey, stateModifCont=
ext.isDescendingInSubPages());
for (Iterator iterator =3D objects.iterator(); iterator.hasNext();=
) {
ContentObjectKey contentObjectKey =3D (ContentObjectKey) itera=
tor.next();
@@ -1212,6 +1193,9 @@
cnfe);
}
} else {
+ if (contentObject.isMarkedForDelete()) {
+ deletedChilds.addAll(getUnlinkedContentObjects=
(objectKey,false,false));
+ }
activationResults.merge(contentObject.activate(lan=
guageCodes, versioningActive, saveVersion, jParams.getUser(), jParams, stat=
eModifContext));
}
}
@@ -1221,8 +1205,15 @@
}
=
ContentObject contentObject =3D null;
- try {
+ try { =
contentObject =3D (ContentObject) ContentObject.getInstance(ob=
jectKey);
+
+ // propagate deletion to childs
+ for (Iterator iterator =3D deletedChilds.iterator(); iterator.=
hasNext();) {
+ ContentObjectKey childObject =3D (ContentObjectKey) iterat=
or.next();
+ activationResults.merge(activate(childObject, languageCode=
s, saveVersion, jParams, stateModifContext));
+ }
+ =
// propagate to parent container list if need
if ( contentObject instanceof ContentContainer ){
ContentContainer container =3D (ContentContainer)contentOb=
ject;
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list