/*
* *
* Copyright (C) 2014 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* /
*/
package org.anhonesteffort.flock.sync;
import org.anhonesteffort.flock.util.guava.Optional;
import org.anhonesteffort.flock.webdav.InvalidComponentException;
import org.apache.jackrabbit.webdav.xml.Namespace;
/**
* Programmer: rhodey
*/
public class InvalidLocalComponentException extends InvalidComponentException {
private long localId;
public InvalidLocalComponentException(InvalidComponentException e) {
super(e.getMessage(), e.getNamespace(), e.getPath(), e.getCause());
if (e.getUid().isPresent())
this.uid = e.getUid().get();
}
public InvalidLocalComponentException(String message,
Namespace namespace,
String path)
{
super(message, namespace, path);
}
public InvalidLocalComponentException(String message,
Namespace namespace,
String path,
Long localId)
{
super(message, namespace, path);
this.localId = localId;
}
public InvalidLocalComponentException(String message,
Namespace namespace,
String path,
String uid)
{
super(message, namespace, path, uid);
}
public InvalidLocalComponentException(String message,
Namespace namespace,
String path,
String uid,
Long localId)
{
super(message, namespace, path, uid);
this.localId = localId;
}
public InvalidLocalComponentException(String message,
Namespace namespace,
String path,
Throwable cause)
{
super(message, namespace, path, cause);
}
public InvalidLocalComponentException(String message,
Namespace namespace,
String path,
Long localId,
Throwable cause)
{
super(message, namespace, path, cause);
this.localId = localId;
}
public InvalidLocalComponentException(String message,
Namespace namespace,
String path,
String uid,
Throwable cause)
{
super(message, namespace, path, uid, cause);
}
public InvalidLocalComponentException(String message,
Namespace namespace,
String path,
String uid,
Long localId,
Throwable cause)
{
super(message, namespace, path, uid, cause);
this.localId = localId;
}
public Optional<Long> getLocalId() {
return Optional.fromNullable(localId);
}
@Override
public String toString() {
if (getLocalId().isPresent())
return super.toString() + ", local id: " + getLocalId().get();
return super.toString();
}
}