eu.europa.esig.dss.tsl.ServiceInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dss-model Show documentation
Show all versions of dss-model Show documentation
DSS Model contains the data model representation for DSS
/**
* DSS - Digital Signature Services
* Copyright (C) 2015 European Commission, provided under the CEF programme
*
* This file is part of the "DSS - Digital Signature Services" project.
*
* 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 eu.europa.esig.dss.tsl;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
/**
* From a validation point of view, a Service is a set of pair ("Qualification Statement", "Condition").
*
*/
public class ServiceInfo implements Serializable {
private static final long serialVersionUID = 4903410679096343832L;
/**
*
*/
private String tspName;
/**
*
*/
private String tspTradeName;
/**
*
*/
private String tspPostalAddress;
/**
*
*/
private String tspElectronicAddress;
/**
*
*/
private String type;
/**
*
*/
private String serviceName;
/**
*
*/
private String status;
/**
*
*/
private Date statusStartDate;
/**
* The start date of the previous service history or null if current service
*/
private Date statusEndDate;
private Map> qualifiersAndConditions = new HashMap>();
private boolean tlWellSigned;
/**
*
* -
* - -
* - - -
* - - - -
* - - - - -
* - - - - - -
*/
private Date expiredCertsRevocationInfo;
/**
* Add a qualifier and the corresponding conditionEntry
*
* @param qualifier
* @param condition
*/
public void addQualifierAndCondition(String qualifier, Condition condition) {
List conditions = qualifiersAndConditions.get(qualifier);
if (conditions == null) {
conditions = new ArrayList();
qualifiersAndConditions.put(qualifier, conditions);
}
conditions.add(condition);
}
public Map> getQualifiersAndConditions() {
return qualifiersAndConditions;
}
/**
* @return
*/
public String getServiceName() {
return serviceName;
}
/**
* @return
*/
public String getStatus() {
return status;
}
/**
* @return
*/
public Date getStatusEndDate() {
return statusEndDate;
}
/**
* @return
*/
public Date getStatusStartDate() {
return statusStartDate;
}
/**
* @return
*/
public String getTspElectronicAddress() {
return tspElectronicAddress;
}
/**
* @return
*/
public String getTspName() {
return tspName;
}
/**
* @return
*/
public String getTspPostalAddress() {
return tspPostalAddress;
}
/**
* @return
*/
public String getTspTradeName() {
return tspTradeName;
}
/**
* Return the type of the service
*
* @return
*/
public String getType() {
return type;
}
/**
* @return the tlWellSigned
*/
public boolean isTlWellSigned() {
return tlWellSigned;
}
/**
* @param serviceName
*/
public void setServiceName(String serviceName) {
this.serviceName = trim(serviceName);
}
/**
* @param status
*/
public void setStatus(String status) {
this.status = trim(status);
}
/**
* @param statusStartDate
*/
public void setStatusStartDate(Date statusStartDate) {
this.statusStartDate = statusStartDate;
}
/**
* @param statusEndDate
*/
public void setStatusEndDate(Date statusEndDate) {
this.statusEndDate = statusEndDate;
}
/**
* @param tlWellSigned the tlWellSigned to set
*/
public void setTlWellSigned(boolean tlWellSigned) {
this.tlWellSigned = tlWellSigned;
}
/**
* @param tspElectronicAddress
*/
public void setTspElectronicAddress(String tspElectronicAddress) {
this.tspElectronicAddress = trim(tspElectronicAddress);
}
/**
* @param tspName
*/
public void setTspName(String tspName) {
this.tspName = trim(tspName);
}
/**
* @param tspPostalAddress
*/
public void setTspPostalAddress(String tspPostalAddress) {
this.tspPostalAddress = trim(tspPostalAddress);
}
/**
* @param tspTradeName
*/
public void setTspTradeName(String tspTradeName) {
this.tspTradeName = trim(tspTradeName);
}
/**
* Define the type of the service
*
* @param type
*/
public void setType(String type) {
this.type = trim(type);
}
public Date getExpiredCertsRevocationInfo() {
return expiredCertsRevocationInfo;
}
public void setExpiredCertsRevocationInfo(Date expiredCertsRevocationInfo) {
this.expiredCertsRevocationInfo = expiredCertsRevocationInfo;
}
/**
* @param indent
* @return
*/
public String toString(String indent) {
try {
StringBuffer buffer = new StringBuffer();
buffer.append(indent).append("Type \t= ").append(type).append('\n');
buffer.append(indent).append("TSPName \t= ").append(tspName).append('\n');
buffer.append(indent).append("ServiceName \t= ").append(serviceName).append('\n');
buffer.append(indent).append("Status \t= ").append(status).append('\n');
if (statusStartDate != null) {
buffer.append(indent).append("StatusStartDate \t= ").append(statusStartDate).append('\n');
}
if (statusEndDate != null) {
buffer.append(indent).append("StatusEndDate \t= ").append(statusEndDate).append('\n');
}
for (final Entry> conditionEntry : qualifiersAndConditions.entrySet()) {
buffer.append(indent).append("QualifiersAndConditions \t= ").append(conditionEntry.getKey()).append(":").append('\n');
indent += "\t\t\t\t\t\t\t\t";
final List conditions = conditionEntry.getValue();
for (final Condition condition : conditions) {
buffer.append(condition.toString(indent));
}
indent = indent.substring(8);
}
buffer.append(indent).append("TSPTradeName \t= ").append(tspTradeName).append('\n');
buffer.append(indent).append("TSPPostalAddress \t= ").append(tspPostalAddress).append('\n');
buffer.append(indent).append("TSPElectronicAddress \t= ").append(tspElectronicAddress).append("\n\n");
if (expiredCertsRevocationInfo != null) {
buffer.append(indent).append("ExpiredCertsRevocationInfo\t= ").append(expiredCertsRevocationInfo).append("\n\n");
}
buffer.append(indent).append("TLWellSigned \t= ").append(tlWellSigned).append('\n');
return buffer.toString();
} catch (Exception e) {
return super.toString();
}
}
private String trim(String str) {
if (str != null) {
return str.trim();
}
return str;
}
@Override
public String toString() {
return toString("");
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = (prime * result)
+ ((serviceName == null) ? 0 : serviceName.hashCode());
result = (prime * result)
+ ((statusStartDate == null) ? 0 : statusStartDate.hashCode());
result = (prime * result) + ((tspName == null) ? 0 : tspName.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
ServiceInfo other = (ServiceInfo) obj;
if (serviceName == null) {
if (other.serviceName != null) {
return false;
}
} else if (!serviceName.equals(other.serviceName)) {
return false;
}
if (statusStartDate == null) {
if (other.statusStartDate != null) {
return false;
}
} else if (!statusStartDate.equals(other.statusStartDate)) {
return false;
}
if (tspName == null) {
if (other.tspName != null) {
return false;
}
} else if (!tspName.equals(other.tspName)) {
return false;
}
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy