Removed unused classes

pull/28/head
Jens Pelzetter 2022-03-19 16:28:55 +01:00
parent a127e7ea62
commit c19796a181
3 changed files with 0 additions and 219 deletions

View File

@ -1,102 +0,0 @@
/*
* 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 org.librecms.workflow;
import org.libreccm.workflow.AssignableTask;
import org.librecms.contentsection.ContentItem;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import static org.librecms.CmsConstants.*;
/**
* A special tasks for {@link ContentItem}s.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Entity
@Table(name = "WORKFLOW_TASKS", schema = DB_SCHEMA)
public class CmsTask extends AssignableTask implements Serializable {
private static final long serialVersionUID = -3988352366529930659L;
/**
* The type of the task.
*/
@Column(name = "TASK_TYPE")
@Enumerated(EnumType.STRING)
private CmsTaskType taskType;
public CmsTaskType getTaskType() {
return taskType;
}
public void setTaskType(final CmsTaskType taskType) {
this.taskType = taskType;
}
@Override
public int hashCode() {
int hash = super.hashCode();
hash = 79 * hash + Objects.hashCode(taskType);
return hash;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!super.equals(obj)) {
return false;
}
if (obj instanceof CmsTask) {
return false;
}
final CmsTask other = (CmsTask) obj;
if (!other.canEqual(this)) {
return false;
}
return Objects.equals(taskType, other.getTaskType());
}
@Override
public boolean canEqual(final Object obj) {
return obj instanceof CmsTask;
}
@Override
public String toString(final String data) {
return super.toString(String.format(", taskType = %s%s",
Objects.toString(taskType),
data));
}
}

View File

@ -1,61 +0,0 @@
/*
* Copyright (C) 2016 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 org.librecms.workflow;
import com.arsdigita.cms.workflow.TaskURLGenerator;
import org.libreccm.core.UnexpectedErrorException;
import org.librecms.contentsection.ContentItem;
import java.lang.reflect.InvocationTargetException;
import javax.enterprise.context.RequestScoped;
/**
* Manager for {@link CmsTask}s.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
public class CmsTaskManager {
/**
* Retrieves the URL for finishing the task for a certain {@link ContentItem}.
*
* @param item The item.
* @param task The task.
* @return The finish URL.
*/
public String getFinishUrl(final ContentItem item, final CmsTask task) {
final Class<? extends TaskURLGenerator> urlGeneratorClass = task
.getTaskType().getUrlGenerator();
final TaskURLGenerator urlGenerator;
try {
urlGenerator = urlGeneratorClass.getDeclaredConstructor().newInstance();
} catch (IllegalAccessException
| InstantiationException
| NoSuchMethodException
| InvocationTargetException ex) {
throw new UnexpectedErrorException(ex);
}
return urlGenerator.generateURL(item.getObjectId(), task.getTaskId());
}
}

View File

@ -1,56 +0,0 @@
/*
* Copyright (C) 2016 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 org.librecms.workflow;
import com.arsdigita.cms.workflow.AuthoringTaskURLGenerator;
import com.arsdigita.cms.workflow.DeployTaskURLGenerator;
import com.arsdigita.cms.workflow.EditingTaskURLGenerator;
import com.arsdigita.cms.workflow.TaskURLGenerator;
import org.librecms.contentsection.privileges.ItemPrivileges;
/**
* Possible types of a {@link CmsTask}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public enum CmsTaskType {
AUTHOR(AuthoringTaskURLGenerator.class, ItemPrivileges.EDIT),
EDIT(EditingTaskURLGenerator.class, ItemPrivileges.APPROVE),
DEPLOY(DeployTaskURLGenerator.class, ItemPrivileges.PUBLISH);
private final Class<? extends TaskURLGenerator> urlGenerator;
private final String privilege;
private CmsTaskType(final Class<? extends TaskURLGenerator> urlGenerator,
final String privilege) {
this.urlGenerator = urlGenerator;
this.privilege = privilege;
}
public Class<? extends TaskURLGenerator> getUrlGenerator() {
return urlGenerator;
}
public String getPrivilege() {
return privilege;
}
}