[TRUNK][FEATURE]
- adds conversions for PhaseDefinitions, LifecycleDefinitions, Lifecycles and Phases - modifies previous conversions to print additional empty line in cmd tool output git-svn-id: https://svn.libreccm.org/ccm/trunk@5359 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
850ff0ea2d
commit
d21d7629d2
|
|
@ -19,6 +19,7 @@
|
||||||
package com.arsdigita.cms.lifecycle;
|
package com.arsdigita.cms.lifecycle;
|
||||||
|
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.persistence.DataAssociation;
|
import com.arsdigita.persistence.DataAssociation;
|
||||||
import com.arsdigita.persistence.DataAssociationCursor;
|
import com.arsdigita.persistence.DataAssociationCursor;
|
||||||
|
|
@ -33,7 +34,9 @@ import com.arsdigita.persistence.SessionManager;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -653,6 +656,29 @@ public class Lifecycle extends ACSObject {
|
||||||
this.setEndDate(finalEndDate);
|
this.setEndDate(finalEndDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all objects of this type stored in the database. Very
|
||||||
|
* necessary for exporting all entities of the current work environment.
|
||||||
|
*
|
||||||
|
* @return List of all objects
|
||||||
|
*/
|
||||||
|
public static List<Lifecycle> getAllObjects() {
|
||||||
|
List<Lifecycle> objectList = new ArrayList<>();
|
||||||
|
|
||||||
|
final Session session = SessionManager.getSession();
|
||||||
|
DomainCollection collection = new DomainCollection(session.retrieve(
|
||||||
|
Lifecycle.BASE_DATA_OBJECT_TYPE));
|
||||||
|
|
||||||
|
while (collection.next()) {
|
||||||
|
Lifecycle object = (Lifecycle) collection
|
||||||
|
.getDomainObject();
|
||||||
|
if (object != null) {
|
||||||
|
objectList.add(object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
collection.close();
|
||||||
|
return objectList;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,15 +19,20 @@
|
||||||
package com.arsdigita.cms.lifecycle;
|
package com.arsdigita.cms.lifecycle;
|
||||||
|
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.persistence.DataAssociation;
|
import com.arsdigita.persistence.DataAssociation;
|
||||||
import com.arsdigita.persistence.DataAssociationCursor;
|
import com.arsdigita.persistence.DataAssociationCursor;
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
|
import com.arsdigita.persistence.Session;
|
||||||
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Definition for a publication lifecycle. Associated with each cycle
|
* Definition for a publication lifecycle. Associated with each cycle
|
||||||
|
|
@ -260,4 +265,29 @@ public class LifecycleDefinition extends ACSObject {
|
||||||
public Lifecycle createFullLifecycle(String listenerClassName) {
|
public Lifecycle createFullLifecycle(String listenerClassName) {
|
||||||
return createFullLifecycle(null, listenerClassName);
|
return createFullLifecycle(null, listenerClassName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all objects of this type stored in the database. Very
|
||||||
|
* necessary for exporting all entities of the current work environment.
|
||||||
|
*
|
||||||
|
* @return List of all objects
|
||||||
|
*/
|
||||||
|
public static List<LifecycleDefinition> getAllObjects() {
|
||||||
|
List<LifecycleDefinition> objectList = new ArrayList<>();
|
||||||
|
|
||||||
|
final Session session = SessionManager.getSession();
|
||||||
|
DomainCollection collection = new DomainCollection(session.retrieve(
|
||||||
|
LifecycleDefinition.BASE_DATA_OBJECT_TYPE));
|
||||||
|
|
||||||
|
while (collection.next()) {
|
||||||
|
LifecycleDefinition object = (LifecycleDefinition) collection
|
||||||
|
.getDomainObject();
|
||||||
|
if (object != null) {
|
||||||
|
objectList.add(object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
collection.close();
|
||||||
|
return objectList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
package com.arsdigita.cms.lifecycle;
|
package com.arsdigita.cms.lifecycle;
|
||||||
|
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.persistence.DataQuery;
|
import com.arsdigita.persistence.DataQuery;
|
||||||
|
|
@ -29,7 +30,9 @@ import com.arsdigita.persistence.SessionManager;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents a phase in Publication Lifecycle for a Content Item.
|
* This class represents a phase in Publication Lifecycle for a Content Item.
|
||||||
|
|
@ -453,4 +456,30 @@ public class Phase extends ACSObject {
|
||||||
set(HAS_ENDED, Boolean.TRUE);
|
set(HAS_ENDED, Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all objects of this type stored in the database. Very
|
||||||
|
* necessary for exporting all entities of the current work environment.
|
||||||
|
*
|
||||||
|
* @return List of all objects
|
||||||
|
*/
|
||||||
|
public static List<Phase> getAllObjects() {
|
||||||
|
List<Phase> objectList = new ArrayList<>();
|
||||||
|
|
||||||
|
final Session session = SessionManager.getSession();
|
||||||
|
DomainCollection collection = new DomainCollection(session.retrieve(
|
||||||
|
Phase.BASE_DATA_OBJECT_TYPE));
|
||||||
|
|
||||||
|
while (collection.next()) {
|
||||||
|
Phase object = (Phase) collection
|
||||||
|
.getDomainObject();
|
||||||
|
if (object != null) {
|
||||||
|
objectList.add(object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
collection.close();
|
||||||
|
return objectList;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,18 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.lifecycle;
|
package com.arsdigita.cms.lifecycle;
|
||||||
|
|
||||||
|
import com.arsdigita.categorization.Category;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
|
import com.arsdigita.persistence.Session;
|
||||||
|
import com.arsdigita.persistence.SessionManager;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -242,4 +248,29 @@ public class PhaseDefinition extends ACSObject {
|
||||||
setAssociation(LIFECYCLE_DEFINITION, lifecycleDefinition);
|
setAssociation(LIFECYCLE_DEFINITION, lifecycleDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all objects of this type stored in the database. Very
|
||||||
|
* necessary for exporting all entities of the current work environment.
|
||||||
|
*
|
||||||
|
* @return List of all objects
|
||||||
|
*/
|
||||||
|
public static List<PhaseDefinition> getAllObjects() {
|
||||||
|
List<PhaseDefinition> objectList = new ArrayList<>();
|
||||||
|
|
||||||
|
final Session session = SessionManager.getSession();
|
||||||
|
DomainCollection collection = new DomainCollection(session.retrieve(
|
||||||
|
PhaseDefinition.BASE_DATA_OBJECT_TYPE));
|
||||||
|
|
||||||
|
while (collection.next()) {
|
||||||
|
PhaseDefinition object = (PhaseDefinition) collection
|
||||||
|
.getDomainObject();
|
||||||
|
if (object != null) {
|
||||||
|
objectList.add(object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
collection.close();
|
||||||
|
return objectList;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,10 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.portation.conversion;
|
package com.arsdigita.cms.portation.conversion;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.portation.conversion.lifecycle.LifecycleConversion;
|
||||||
|
import com.arsdigita.cms.portation.conversion.lifecycle.LifecycleDefinitionConversion;
|
||||||
|
import com.arsdigita.cms.portation.conversion.lifecycle.PhaseConversion;
|
||||||
|
import com.arsdigita.cms.portation.conversion.lifecycle.PhaseDefinitionConversion;
|
||||||
import com.arsdigita.portation.AbstractConverter;
|
import com.arsdigita.portation.AbstractConverter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -47,6 +51,10 @@ public class CmsConverter extends AbstractConverter {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void startConversions() {
|
public void startConversions() {
|
||||||
|
PhaseDefinitionConversion.getInstance().convertAll();
|
||||||
|
LifecycleDefinitionConversion.getInstance().convertAll();
|
||||||
|
LifecycleConversion.getInstance().convertAll();
|
||||||
|
PhaseConversion.getInstance().convertAll();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.portation.conversion.lifecycle;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.portation.conversion.NgCmsCollection;
|
||||||
|
import com.arsdigita.cms.portation.modules.lifecycle.Lifecycle;
|
||||||
|
import com.arsdigita.cms.portation.modules.lifecycle.LifecycleDefinition;
|
||||||
|
import com.arsdigita.portation.AbstractConversion;
|
||||||
|
import com.arsdigita.portation.cmd.ExportLogger;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 3/26/18
|
||||||
|
*/
|
||||||
|
public class LifecycleConversion extends AbstractConversion {
|
||||||
|
private static LifecycleConversion instance;
|
||||||
|
|
||||||
|
static {
|
||||||
|
instance = new LifecycleConversion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all
|
||||||
|
* trunk-{@link com.arsdigita.cms.lifecycle.Lifecycle}s from the
|
||||||
|
* persistent storage and collects them in a list. Then calls for
|
||||||
|
* creating the equivalent ng-{@link Lifecycle}s focusing on keeping all
|
||||||
|
* the associations in tact.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void convertAll() {
|
||||||
|
ExportLogger.fetching("lifecycles");
|
||||||
|
List<com.arsdigita.cms.lifecycle.Lifecycle> trunkLifecycles = com
|
||||||
|
.arsdigita.cms.lifecycle.Lifecycle.getAllObjects();
|
||||||
|
|
||||||
|
ExportLogger.converting("lifecycles");
|
||||||
|
createLifecyclesAndSetAssociations(trunkLifecycles);
|
||||||
|
|
||||||
|
ExportLogger.newLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the equivalent ng-class of the {@code Lifecycle} and restores
|
||||||
|
* the associations to other classes.
|
||||||
|
*
|
||||||
|
* @param trunkLifecycles List of all {@link com.arsdigita.cms.lifecycle.Lifecycle}s
|
||||||
|
* from this old trunk-system.
|
||||||
|
*/
|
||||||
|
private void createLifecyclesAndSetAssociations(final List<com.arsdigita
|
||||||
|
.cms.lifecycle.Lifecycle> trunkLifecycles) {
|
||||||
|
int processed = 0;
|
||||||
|
|
||||||
|
for (com.arsdigita.cms.lifecycle.Lifecycle trunkLifecycle :
|
||||||
|
trunkLifecycles) {
|
||||||
|
// create lifecycle
|
||||||
|
Lifecycle lifecycle = new Lifecycle(trunkLifecycle);
|
||||||
|
|
||||||
|
// set lifecycle definition
|
||||||
|
long lifecycleDefinitionId = trunkLifecycle
|
||||||
|
.getLifecycleDefinition()
|
||||||
|
.getID()
|
||||||
|
.longValue();
|
||||||
|
lifecycle.setLifecycleDefinition(NgCmsCollection
|
||||||
|
.lifecycleDefinitions
|
||||||
|
.get(lifecycleDefinitionId));
|
||||||
|
|
||||||
|
processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExportLogger.created("lifecycles", processed);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for the instance of the singleton.
|
||||||
|
*
|
||||||
|
* @return instance of this singleton
|
||||||
|
*/
|
||||||
|
public static LifecycleConversion getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,110 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.portation.conversion.lifecycle;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.lifecycle.PhaseDefinitionCollection;
|
||||||
|
import com.arsdigita.cms.portation.conversion.NgCmsCollection;
|
||||||
|
import com.arsdigita.cms.portation.modules.lifecycle.LifecycleDefinition;
|
||||||
|
import com.arsdigita.cms.portation.modules.lifecycle.PhaseDefinition;
|
||||||
|
import com.arsdigita.portation.AbstractConversion;
|
||||||
|
import com.arsdigita.portation.cmd.ExportLogger;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 3/26/18
|
||||||
|
*/
|
||||||
|
public class LifecycleDefinitionConversion extends AbstractConversion {
|
||||||
|
private static LifecycleDefinitionConversion instance;
|
||||||
|
|
||||||
|
static {
|
||||||
|
instance = new LifecycleDefinitionConversion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all
|
||||||
|
* trunk-{@link com.arsdigita.cms.lifecycle.LifecycleDefinition}s from
|
||||||
|
* the persistent storage and collects them in a list. Then calls for
|
||||||
|
* creating the equivalent ng-{@link LifecycleDefinition}s focusing on
|
||||||
|
* keeping all the associations in tact.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void convertAll() {
|
||||||
|
ExportLogger.fetching("lifecycle definitions");
|
||||||
|
List<com.arsdigita.cms.lifecycle.LifecycleDefinition>
|
||||||
|
trunkLifecycleDefinitions = com.arsdigita.cms.lifecycle
|
||||||
|
.LifecycleDefinition.getAllObjects();
|
||||||
|
|
||||||
|
ExportLogger.converting("lifecycle definitions");
|
||||||
|
createLifecycleDefinitionsAndSetAssociations(trunkLifecycleDefinitions);
|
||||||
|
|
||||||
|
ExportLogger.newLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the equivalent ng-class of the {@code LifecycleDefinition} and
|
||||||
|
* restores the associations to other classes.
|
||||||
|
*
|
||||||
|
* @param trunkLifecycleDefinitions List of all
|
||||||
|
* {@link com.arsdigita.cms.lifecycle.LifecycleDefinition}s from this old
|
||||||
|
* trunk-system.
|
||||||
|
*/
|
||||||
|
private void createLifecycleDefinitionsAndSetAssociations(final List<com
|
||||||
|
.arsdigita.cms.lifecycle.LifecycleDefinition> trunkLifecycleDefinitions) {
|
||||||
|
int processed = 0;
|
||||||
|
|
||||||
|
for (com.arsdigita.cms.lifecycle.LifecycleDefinition
|
||||||
|
trunkLifecycleDefinition : trunkLifecycleDefinitions) {
|
||||||
|
// create lifecycle definition
|
||||||
|
LifecycleDefinition lifecycleDefinition = new LifecycleDefinition
|
||||||
|
(trunkLifecycleDefinition);
|
||||||
|
|
||||||
|
// set phase definitions
|
||||||
|
PhaseDefinitionCollection phaseDefinitionCollection =
|
||||||
|
trunkLifecycleDefinition.getPhaseDefinitions();
|
||||||
|
|
||||||
|
while (phaseDefinitionCollection.next()) {
|
||||||
|
long phaseDefinitionId = phaseDefinitionCollection
|
||||||
|
.getPhaseDefinition()
|
||||||
|
.getID()
|
||||||
|
.longValue();
|
||||||
|
|
||||||
|
PhaseDefinition phaseDefinition = NgCmsCollection
|
||||||
|
.phaseDefinitions
|
||||||
|
.get(phaseDefinitionId);
|
||||||
|
|
||||||
|
lifecycleDefinition.addPhaseDefinition(phaseDefinition);
|
||||||
|
}
|
||||||
|
|
||||||
|
processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExportLogger.created("lifecycle definitions", processed);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for the instance of the singleton.
|
||||||
|
*
|
||||||
|
* @return instance of this singleton
|
||||||
|
*/
|
||||||
|
public static LifecycleDefinitionConversion getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.portation.conversion.lifecycle;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.portation.conversion.NgCmsCollection;
|
||||||
|
import com.arsdigita.cms.portation.modules.lifecycle.Lifecycle;
|
||||||
|
import com.arsdigita.cms.portation.modules.lifecycle.Phase;
|
||||||
|
import com.arsdigita.cms.portation.modules.lifecycle.PhaseDefinition;
|
||||||
|
import com.arsdigita.portation.AbstractConversion;
|
||||||
|
import com.arsdigita.portation.cmd.ExportLogger;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 3/26/18
|
||||||
|
*/
|
||||||
|
public class PhaseConversion extends AbstractConversion {
|
||||||
|
private static PhaseConversion instance;
|
||||||
|
|
||||||
|
static {
|
||||||
|
instance = new PhaseConversion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all trunk-{@link com.arsdigita.cms.lifecycle.Phase}s from
|
||||||
|
* the persistent storage and collects them in a list. Then calls for
|
||||||
|
* creating the equivalent ng-{@link Phase}s focusing on keeping all the
|
||||||
|
* associations in tact.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void convertAll() {
|
||||||
|
ExportLogger.fetching("phases");
|
||||||
|
List<com.arsdigita.cms.lifecycle.Phase> trunkPhases = com.arsdigita
|
||||||
|
.cms.lifecycle.Phase.getAllObjects();
|
||||||
|
|
||||||
|
ExportLogger.converting("phases");
|
||||||
|
createPhasesAndSetAssociations(trunkPhases);
|
||||||
|
|
||||||
|
ExportLogger.newLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the equivalent ng-class of the {@code Phase} and restores
|
||||||
|
* the associations to other classes.
|
||||||
|
*
|
||||||
|
* @param trunkPhases List of all {@link com.arsdigita.cms.lifecycle.Phase}s
|
||||||
|
* from this old trunk-system.
|
||||||
|
*/
|
||||||
|
private void createPhasesAndSetAssociations(final List<com.arsdigita.cms
|
||||||
|
.lifecycle.Phase> trunkPhases) {
|
||||||
|
int processed = 0;
|
||||||
|
|
||||||
|
for (com.arsdigita.cms.lifecycle.Phase trunkPhase : trunkPhases) {
|
||||||
|
// create phase
|
||||||
|
Phase phase = new Phase(trunkPhase);
|
||||||
|
|
||||||
|
// set phase definition
|
||||||
|
long phaseDefinitionId = trunkPhase
|
||||||
|
.getPhaseDefinition()
|
||||||
|
.getID()
|
||||||
|
.longValue();
|
||||||
|
phase.setPhaseDefinition(NgCmsCollection
|
||||||
|
.phaseDefinitions
|
||||||
|
.get(phaseDefinitionId));
|
||||||
|
|
||||||
|
// set lifecycle and opposed association
|
||||||
|
long lifecycleId = trunkPhase
|
||||||
|
.getLifecycle()
|
||||||
|
.getID()
|
||||||
|
.longValue();
|
||||||
|
Lifecycle lifecycle = NgCmsCollection
|
||||||
|
.lifecycles
|
||||||
|
.get(lifecycleId);
|
||||||
|
phase.setLifecycle(lifecycle);
|
||||||
|
lifecycle.addPhase(phase);
|
||||||
|
|
||||||
|
processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExportLogger.created("phases", processed);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for the instance of the singleton.
|
||||||
|
*
|
||||||
|
* @return instance of this singleton
|
||||||
|
*/
|
||||||
|
public static PhaseConversion getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.portation.conversion.lifecycle;
|
||||||
|
|
||||||
|
|
||||||
|
import com.arsdigita.cms.portation.modules.lifecycle.PhaseDefinition;
|
||||||
|
import com.arsdigita.portation.AbstractConversion;
|
||||||
|
import com.arsdigita.portation.cmd.ExportLogger;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 3/26/18
|
||||||
|
*/
|
||||||
|
public class PhaseDefinitionConversion extends AbstractConversion {
|
||||||
|
private static PhaseDefinitionConversion instance;
|
||||||
|
|
||||||
|
static {
|
||||||
|
instance = new PhaseDefinitionConversion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all trunk-{@link com.arsdigita.cms.lifecycle.PhaseDefinition}s
|
||||||
|
* from the persistent storage and collects them in a list. Then calls for
|
||||||
|
* creating the equivalent ng-{@link PhaseDefinition}s focusing on keeping
|
||||||
|
* all the associations in tact.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void convertAll() {
|
||||||
|
ExportLogger.fetching("phase definitions");
|
||||||
|
List<com.arsdigita.cms.lifecycle.PhaseDefinition> trunkPhaseDefinitions
|
||||||
|
= com.arsdigita.cms.lifecycle.PhaseDefinition.getAllObjects();
|
||||||
|
|
||||||
|
ExportLogger.converting("phase definitions");
|
||||||
|
int processed = 0;
|
||||||
|
for (com.arsdigita.cms.lifecycle.PhaseDefinition
|
||||||
|
trunkPhaseDefinition : trunkPhaseDefinitions) {
|
||||||
|
// create phase definitions
|
||||||
|
new PhaseDefinition(trunkPhaseDefinition);
|
||||||
|
|
||||||
|
processed++;
|
||||||
|
}
|
||||||
|
ExportLogger.created("phase definitions", processed);
|
||||||
|
|
||||||
|
ExportLogger.newLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for the instance of the singleton.
|
||||||
|
*
|
||||||
|
* @return instance of this singleton
|
||||||
|
*/
|
||||||
|
public static PhaseDefinitionConversion getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -43,13 +43,16 @@ public class PhaseDefinition implements Portable {
|
||||||
this.label = new LocalizedString();
|
this.label = new LocalizedString();
|
||||||
this.description = new LocalizedString();
|
this.description = new LocalizedString();
|
||||||
final Locale locale = Locale.getDefault();
|
final Locale locale = Locale.getDefault();
|
||||||
this.label.addValue(locale, trunkPhaseDefinition.getLabel());
|
this.label.addValue(locale,
|
||||||
this.description
|
trunkPhaseDefinition.getLabel());
|
||||||
.addValue(locale, trunkPhaseDefinition.getDescription());
|
this.description.addValue(locale,
|
||||||
|
trunkPhaseDefinition.getDescription());
|
||||||
|
|
||||||
this.defaultDelay = trunkPhaseDefinition.getDefaultDelay().longValue();
|
this.defaultDelay = trunkPhaseDefinition
|
||||||
this.defaultDuration = trunkPhaseDefinition.getDefaultDuration()
|
.getDefaultDelay().longValue();
|
||||||
.longValue();
|
final Integer delay = trunkPhaseDefinition.getDefaultDuration();
|
||||||
|
if (delay != null)
|
||||||
|
this.defaultDuration = delay.longValue();
|
||||||
|
|
||||||
this.defaultListener = trunkPhaseDefinition.getDefaultListener();
|
this.defaultListener = trunkPhaseDefinition.getDefaultListener();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ public class ExportCliTool extends Program {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void doRun(CommandLine cmdLine) {
|
protected void doRun(CommandLine cmdLine) {
|
||||||
final String[] args = cmdLine.getArgs();
|
String[] args = cmdLine.getArgs();
|
||||||
|
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
printUsage();
|
printUsage();
|
||||||
|
|
@ -142,6 +142,7 @@ public class ExportCliTool extends Program {
|
||||||
System.out.print("\n");
|
System.out.print("\n");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
System.err.printf("ERROR while exporting: %s\n", ex);
|
System.err.printf("ERROR while exporting: %s\n", ex);
|
||||||
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,10 @@ public class ExportLogger {
|
||||||
"\t\tSorted %s in %d runs.", className, runs));
|
"\t\tSorted %s in %d runs.", className, runs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void newLine() {
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void exporting(final String className) {
|
public static void exporting(final String className) {
|
||||||
|
|
|
||||||
|
|
@ -38,17 +38,16 @@ public class RootConverter {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static void rootConversionExecution() throws Exception {
|
public static void rootConversionExecution() throws Exception {
|
||||||
// Core conversions
|
// Core conversions
|
||||||
CoreConverter.getInstance().startConversions();
|
//CoreConverter.getInstance().startConversions();
|
||||||
|
|
||||||
// Lnd-Terms conversions
|
// Cms conversions
|
||||||
/*Class cls = Class
|
Class cls = Class.forName("com.arsdigita.cms.portation.conversion" +
|
||||||
.forName("com.arsdigita.london.terms.portation" +
|
".CmsConverter");
|
||||||
".conversion.LdnTermsConverter");
|
|
||||||
if (cls != null) {
|
if (cls != null) {
|
||||||
Method startConversionToNg = cls
|
Method startConversionToNg = cls
|
||||||
.getDeclaredMethod("startConversions");
|
.getDeclaredMethod("startConversions");
|
||||||
startConversionToNg.invoke(cls.newInstance());
|
startConversionToNg.invoke(cls.newInstance());
|
||||||
}*/
|
}
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,11 +59,13 @@ public class CategoryConversion extends AbstractConversion {
|
||||||
.arsdigita.categorization.Category.getAllObjectCategories();
|
.arsdigita.categorization.Category.getAllObjectCategories();
|
||||||
|
|
||||||
ExportLogger.converting("categories and categorizations");
|
ExportLogger.converting("categories and categorizations");
|
||||||
createCategoryAndCategorizations(trunkCategories);
|
createCategoriesAndSetAssociations(trunkCategories);
|
||||||
setRingAssociations(trunkCategories);
|
setRingAssociations(trunkCategories);
|
||||||
|
|
||||||
ExportLogger.sorting("categories");
|
ExportLogger.sorting("categories");
|
||||||
sortCategoryMap();
|
sortCategoryMap();
|
||||||
|
|
||||||
|
ExportLogger.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -74,7 +76,7 @@ public class CategoryConversion extends AbstractConversion {
|
||||||
* {@link com.arsdigita.categorization.Category}s
|
* {@link com.arsdigita.categorization.Category}s
|
||||||
* from this old trunk-system.
|
* from this old trunk-system.
|
||||||
*/
|
*/
|
||||||
private void createCategoryAndCategorizations(
|
private void createCategoriesAndSetAssociations(
|
||||||
List<com.arsdigita.categorization.Category> trunkCategories) {
|
List<com.arsdigita.categorization.Category> trunkCategories) {
|
||||||
int processedCategories = 0, processedCategorizations = 0;
|
int processedCategories = 0, processedCategorizations = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,8 @@ public class DomainConversion extends AbstractConversion {
|
||||||
|
|
||||||
ExportLogger.converting("doamins and domain ownerships");
|
ExportLogger.converting("doamins and domain ownerships");
|
||||||
createDomainsAndSetAssociations(trunkDomains);
|
createDomainsAndSetAssociations(trunkDomains);
|
||||||
|
|
||||||
|
ExportLogger.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -76,7 +78,7 @@ public class DomainConversion extends AbstractConversion {
|
||||||
|
|
||||||
while(trunkDomains.next()) {
|
while(trunkDomains.next()) {
|
||||||
DataObject trunkDomain = trunkDomains.getDataObject();
|
DataObject trunkDomain = trunkDomains.getDataObject();
|
||||||
|
if (trunkDomain != null) {
|
||||||
// create domains
|
// create domains
|
||||||
Domain domain = new Domain(trunkDomain);
|
Domain domain = new Domain(trunkDomain);
|
||||||
|
|
||||||
|
|
@ -101,11 +103,12 @@ public class DomainConversion extends AbstractConversion {
|
||||||
"rootCategory.id", trunkModel.getID());
|
"rootCategory.id", trunkModel.getID());
|
||||||
|
|
||||||
processedDomainOwnerships += createDomainOwnerships(
|
processedDomainOwnerships += createDomainOwnerships(
|
||||||
domain, (DomainCollection) useContexts);
|
domain, new DomainCollection(useContexts));
|
||||||
}
|
}
|
||||||
|
|
||||||
processedDomains++;
|
processedDomains++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ExportLogger.created("domains", processedDomains);
|
ExportLogger.created("domains", processedDomains);
|
||||||
ExportLogger.created("domain ownerships", processedDomainOwnerships);
|
ExportLogger.created("domain ownerships", processedDomainOwnerships);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,8 @@ public class ResourceTypeConversion extends AbstractConversion {
|
||||||
processed++;
|
processed++;
|
||||||
}
|
}
|
||||||
ExportLogger.created("resource types", processed);
|
ExportLogger.created("resource types", processed);
|
||||||
|
|
||||||
|
ExportLogger.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,8 @@ public class GroupConversion extends AbstractConversion {
|
||||||
|
|
||||||
ExportLogger.converting("groups and group memberships");
|
ExportLogger.converting("groups and group memberships");
|
||||||
createGroupsAndSetAssociations(trunkGroups);
|
createGroupsAndSetAssociations(trunkGroups);
|
||||||
|
|
||||||
|
ExportLogger.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,8 @@ public class PermissionConversion extends AbstractConversion {
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExportLogger.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,8 @@ public class RoleConversion extends AbstractConversion{
|
||||||
|
|
||||||
ExportLogger.converting("roles and role memberships");
|
ExportLogger.converting("roles and role memberships");
|
||||||
createRolesAndSetAssociations(trunkRoles);
|
createRolesAndSetAssociations(trunkRoles);
|
||||||
|
|
||||||
|
ExportLogger.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -51,13 +51,15 @@ public class UserConversion extends AbstractConversion {
|
||||||
.User.getAllObjectUsers();
|
.User.getAllObjectUsers();
|
||||||
|
|
||||||
ExportLogger.converting("users");
|
ExportLogger.converting("users");
|
||||||
// create users
|
|
||||||
int processed = 0;
|
int processed = 0;
|
||||||
for (com.arsdigita.kernel.User trunkUser : trunkUsers) {
|
for (com.arsdigita.kernel.User trunkUser : trunkUsers) {
|
||||||
|
// create users
|
||||||
new User(trunkUser);
|
new User(trunkUser);
|
||||||
processed++;
|
processed++;
|
||||||
}
|
}
|
||||||
ExportLogger.created("users", processed);
|
ExportLogger.created("users", processed);
|
||||||
|
|
||||||
|
ExportLogger.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,8 @@ public class CcmApplicationConversion extends AbstractConversion {
|
||||||
|
|
||||||
ExportLogger.sorting("ccm applications");
|
ExportLogger.sorting("ccm applications");
|
||||||
sortCcmApplications();
|
sortCcmApplications();
|
||||||
|
|
||||||
|
ExportLogger.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,8 @@ public class AssignableTaskConversion extends AbstractConversion {
|
||||||
|
|
||||||
ExportLogger.sorting("assignable tasks");
|
ExportLogger.sorting("assignable tasks");
|
||||||
sortAssignableTaskMap();
|
sortAssignableTaskMap();
|
||||||
|
|
||||||
|
ExportLogger.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,8 @@ public class TaskCommentConversion extends AbstractConversion {
|
||||||
|
|
||||||
ExportLogger.converting("task comments");
|
ExportLogger.converting("task comments");
|
||||||
createTaskCommentsAndSetAssociations(trunkTaskComments);
|
createTaskCommentsAndSetAssociations(trunkTaskComments);
|
||||||
|
|
||||||
|
ExportLogger.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,8 @@ public class WorkflowConversion extends AbstractConversion {
|
||||||
|
|
||||||
ExportLogger.sorting("workflows");
|
ExportLogger.sorting("workflows");
|
||||||
sortWorkflowMap();
|
sortWorkflowMap();
|
||||||
|
|
||||||
|
ExportLogger.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -66,19 +66,19 @@ public class Domain extends CcmObject implements Portable {
|
||||||
|
|
||||||
|
|
||||||
public Domain(DataObject trunkDomain) {
|
public Domain(DataObject trunkDomain) {
|
||||||
super(trunkDomain.get("key").toString() + "_DName");
|
super((String) trunkDomain.get("key") + "_DName");
|
||||||
|
|
||||||
this.domainKey = trunkDomain.get("key").toString();
|
this.domainKey = (String) trunkDomain.get("key");
|
||||||
this.uri = trunkDomain.get("url").toString();
|
this.uri = (String) trunkDomain.get("url");
|
||||||
|
|
||||||
this.title = new LocalizedString();
|
this.title = new LocalizedString();
|
||||||
this.title.addValue(Locale.getDefault(),
|
this.title.addValue(Locale.getDefault(), (String) trunkDomain
|
||||||
trunkDomain.get("title").toString());
|
.get("title"));
|
||||||
this.description = new LocalizedString();
|
this.description = new LocalizedString();
|
||||||
this.description.addValue(Locale.getDefault(),
|
this.description.addValue(Locale.getDefault(), (String) trunkDomain
|
||||||
trunkDomain.get("description").toString());
|
.get("description"));
|
||||||
|
|
||||||
this.version = trunkDomain.get("version").toString();
|
this.version = (String) trunkDomain.get("version");
|
||||||
this.released = (Date) trunkDomain.get("released");
|
this.released = (Date) trunkDomain.get("released");
|
||||||
|
|
||||||
//this.root
|
//this.root
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue