Commit 8857bfdb authored by Gianluca Filippone's avatar Gianluca Filippone
Browse files

Code refactoring

parent eaacddbb
/*
* Copyright 2016 The CHOReVOLUTION project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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 eu.choreovolution.idm.common.to;
import org.apache.syncope.common.lib.AbstractBaseBean;
public class ChoreographyDataTO extends AbstractBaseBean {
private static final long serialVersionUID = 3720573261603720603L;
private String choreographyName;
private String instanceName;
private String cdName;
private String operationName;
private long timestamp;
public String getChoreographyName() {
return choreographyName;
}
public void setChoreographyName(final String choreographyName) {
this.choreographyName = choreographyName;
}
public String getInstanceName() {
return instanceName;
}
public void setInstanceName(final String instanceName) {
this.instanceName = instanceName;
}
public String getCdName() {
return cdName;
}
public void setCdName(final String cdName) {
this.cdName = cdName;
}
public String getOperationName() {
return operationName;
}
public void setOperationName(final String operationName) {
this.operationName = operationName;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(final long timestamp) {
this.timestamp = timestamp;
}
}
......@@ -17,60 +17,17 @@ package eu.choreovolution.idm.common.to;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.syncope.common.lib.AbstractBaseBean;
@XmlRootElement(name = "coordMessage")
@XmlType
public class CoordMessageTO extends AbstractBaseBean {
public class CoordMessageTO extends ChoreographyDataTO {
private static final long serialVersionUID = 6203745231037592740L;
private String choreographyName;
private String instanceName;
private String cdName;
private String operationName;
private String sourceState;
private String targetState;
private long timestamp;
public String getChoreographyName() {
return choreographyName;
}
public void setChoreographyName(final String choreographyName) {
this.choreographyName = choreographyName;
}
public String getInstanceName() {
return instanceName;
}
public void setInstanceName(final String instanceName) {
this.instanceName = instanceName;
}
public String getCdName() {
return cdName;
}
public void setCdName(final String cdName) {
this.cdName = cdName;
}
public String getOperationName() {
return operationName;
}
public void setOperationName(final String operationName) {
this.operationName = operationName;
}
public String getSourceState() {
return sourceState;
}
......@@ -87,12 +44,4 @@ public class CoordMessageTO extends AbstractBaseBean {
this.targetState = targetState;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(final long timestamp) {
this.timestamp = timestamp;
}
}
......@@ -17,61 +17,11 @@ package eu.choreovolution.idm.common.to;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.syncope.common.lib.AbstractBaseBean;
@XmlRootElement(name = "endRequest")
@XmlType
public class EndRequestTO extends AbstractBaseBean {
public class EndRequestTO extends ChoreographyDataTO {
private static final long serialVersionUID = 7390327483273850702L;
private String choreographyName;
private String instanceName;
private String cdName;
private String operationName;
private long timestamp;
public String getChoreographyName() {
return choreographyName;
}
public void setChoreographyName(final String choreographyName) {
this.choreographyName = choreographyName;
}
public String getInstanceName() {
return instanceName;
}
public void setInstanceName(final String instanceName) {
this.instanceName = instanceName;
}
public String getCdName() {
return cdName;
}
public void setCdName(final String cdName) {
this.cdName = cdName;
}
public String getOperationName() {
return operationName;
}
public void setOperationName(final String operationName) {
this.operationName = operationName;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(final long timestamp) {
this.timestamp = timestamp;
}
}
......@@ -17,61 +17,11 @@ package eu.choreovolution.idm.common.to;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.syncope.common.lib.AbstractBaseBean;
@XmlRootElement(name = "ForwardRequest")
@XmlType
public class ForwardRequestTO extends AbstractBaseBean {
public class ForwardRequestTO extends ChoreographyDataTO {
private static final long serialVersionUID = 2839502748372350719L;
private String choreographyName;
private String instanceName;
private String cdName;
private String operationName;
private long timestamp;
public String getChoreographyName() {
return choreographyName;
}
public void setChoreographyName(final String choreographyName) {
this.choreographyName = choreographyName;
}
public String getInstanceName() {
return instanceName;
}
public void setInstanceName(final String instanceName) {
this.instanceName = instanceName;
}
public String getCdName() {
return cdName;
}
public void setCdName(final String cdName) {
this.cdName = cdName;
}
public String getOperationName() {
return operationName;
}
public void setOperationName(final String operationName) {
this.operationName = operationName;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(final long timestamp) {
this.timestamp = timestamp;
}
}
......@@ -17,61 +17,11 @@ package eu.choreovolution.idm.common.to;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.syncope.common.lib.AbstractBaseBean;
@XmlRootElement(name = "forwardResponse")
@XmlType
public class ForwardResponseTO extends AbstractBaseBean {
public class ForwardResponseTO extends ChoreographyDataTO {
private static final long serialVersionUID = 1030274326023519463L;
private String choreographyName;
private String instanceName;
private String cdName;
private String operationName;
private long timestamp;
public String getChoreographyName() {
return choreographyName;
}
public void setChoreographyName(final String choreographyName) {
this.choreographyName = choreographyName;
}
public String getInstanceName() {
return instanceName;
}
public void setInstanceName(final String instanceName) {
this.instanceName = instanceName;
}
public String getCdName() {
return cdName;
}
public void setCdName(final String cdName) {
this.cdName = cdName;
}
public String getOperationName() {
return operationName;
}
public void setOperationName(final String operationName) {
this.operationName = operationName;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(final long timestamp) {
this.timestamp = timestamp;
}
}
......@@ -17,62 +17,11 @@ package eu.choreovolution.idm.common.to;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.syncope.common.lib.AbstractBaseBean;
@XmlRootElement(name = "startRequest")
@XmlType
public class StartRequestTO extends AbstractBaseBean {
public class StartRequestTO extends ChoreographyDataTO {
private static final long serialVersionUID = 8493022748347827873L;
private String choreographyName;
private String instanceName;
private String cdName;
private String operationName;
private long timestamp;
public String getChoreographyName() {
return choreographyName;
}
public void setChoreographyName(final String choreographyName) {
this.choreographyName = choreographyName;
}
public String getInstanceName() {
return instanceName;
}
public void setInstanceName(final String instanceName) {
this.instanceName = instanceName;
}
public String getCdName() {
return cdName;
}
public void setCdName(final String cdName) {
this.cdName = cdName;
}
public String getOperationName() {
return operationName;
}
public void setOperationName(final String operationName) {
this.operationName = operationName;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(final long timestamp) {
this.timestamp = timestamp;
}
}
......@@ -15,6 +15,7 @@
*/
package org.apache.syncope.core.logic;
import eu.choreovolution.idm.common.to.ChoreographyDataTO;
import eu.chorevolution.idm.common.to.ChoreographyInstanceTO;
import eu.chorevolution.idm.common.to.ChoreographyTO;
import eu.chorevolution.idm.common.to.CoordinationDelegateTO;
......@@ -37,7 +38,6 @@ import org.apache.syncope.core.persistence.api.entity.EndRequest;
import org.apache.syncope.core.persistence.api.entity.ForwardRequest;
import org.apache.syncope.core.persistence.api.entity.ForwardResponse;
import org.apache.syncope.core.persistence.api.entity.StartRequest;
import org.apache.syncope.core.persistence.api.entity.TimeData;
import org.apache.syncope.core.persistence.jpa.entity.JPAEndRequest;
import org.apache.syncope.core.persistence.jpa.entity.JPAForwardRequest;
import org.apache.syncope.core.persistence.jpa.entity.JPAForwardResponse;
......@@ -47,6 +47,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.apache.syncope.core.persistence.api.dao.CoordMessageDAO;
import org.apache.syncope.core.persistence.api.entity.CoordMessage;
import org.apache.syncope.core.persistence.api.entity.ChoreographyData;
@Component
public class MonitorLogic extends AbstractTransactionalLogic<AbstractBaseBean> {
......@@ -207,9 +208,9 @@ public class MonitorLogic extends AbstractTransactionalLogic<AbstractBaseBean> {
* @param data
* @param type
*/
public void saveTimeData(final AbstractBaseBean data, final String type) {
public void saveTimeData(final ChoreographyDataTO data, final String type) {
TimeData requestEntity;
ChoreographyData requestEntity;
switch (type) {
case "start_request":
StartRequestTO startRequest = (StartRequestTO) data;
......
/*
* Copyright 2016 The CHOReVOLUTION project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.apache.syncope.core.persistence.api.dao;
import java.util.List;
import org.apache.syncope.core.persistence.api.entity.ChoreographyData;
public interface ChoreographyDataDAO<M extends ChoreographyData> extends DAO<M, Long> {
List<M> findAll();
M find(String cdName, String operationName, String instanceName, String choreographyName);
void save(M data);
void delete(M data);
void deleteAll();
}
......@@ -18,15 +18,10 @@ package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
import org.apache.syncope.core.persistence.api.entity.CoordMessage;
public interface CoordMessageDAO extends DAO<CoordMessage, Long> {
public interface CoordMessageDAO extends ChoreographyDataDAO<CoordMessage> {
List<CoordMessage> findIntervalMessages(
String cdName, String operationName, String instanceName, String choreographyname,
long startTime, long endTime);
List<CoordMessage> findAll();
void save(CoordMessage messages);
void delete(String key);
}
......@@ -15,16 +15,8 @@
*/
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
import org.apache.syncope.core.persistence.api.entity.EndRequest;
public interface EndRequestDAO extends DAO<EndRequest, Long> {
public interface EndRequestDAO extends ChoreographyDataDAO<EndRequest> {
EndRequest find(String cdName, String operationName, String instanceName, String choreographyName);
List<EndRequest> findAll();
void save(EndRequest request);
void delete(String key);
}
......@@ -15,16 +15,8 @@
*/
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
import org.apache.syncope.core.persistence.api.entity.ForwardRequest;
public interface ForwardRequestDAO extends DAO<ForwardRequest, Long> {
public interface ForwardRequestDAO extends ChoreographyDataDAO<ForwardRequest> {
ForwardRequest find(String cdName, String operationName, String instanceName, String choreographyName);
List<ForwardRequest> findAll();
void save(ForwardRequest request);
void delete(String key);
}
......@@ -15,16 +15,8 @@
*/
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
import org.apache.syncope.core.persistence.api.entity.ForwardResponse;
public interface ForwardResponseDAO extends DAO<ForwardResponse, Long> {
public interface ForwardResponseDAO extends ChoreographyDataDAO<ForwardResponse> {
ForwardResponse find(String cdName, String operationName, String instanceName, String choreographyName);
List<ForwardResponse> findAll();
void save(ForwardResponse response);
void delete(String key);
}
......@@ -15,16 +15,8 @@
*/
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
import org.apache.syncope.core.persistence.api.entity.StartRequest;
public interface StartRequestDAO extends DAO<StartRequest, Long> {
public interface StartRequestDAO extends ChoreographyDataDAO<StartRequest> {
StartRequest find(String cdName, String operationName, String instanceName, String choreographyName);
List<StartRequest> findAll();
void save(StartRequest request);
void delete(String key);
}