org.linguafranca.pwdb.kdbx.simple.model.EntryClasses Maven / Gradle / Ivy
/*
* Copyright 2015 Jo Rabin
*
* 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.linguafranca.pwdb.kdbx.simple.model;
import org.linguafranca.pwdb.kdbx.simple.SimpleEntry;
import org.linguafranca.pwdb.kdbx.simple.converter.KeePassBooleanConverter;
import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.Text;
import org.simpleframework.xml.convert.Convert;
import java.util.List;
/**
* @author jo
*/
@SuppressWarnings("unused")
public abstract class EntryClasses {
public static StringProperty getStringProperty(String name, List string) {
for (StringProperty property : string) {
if (property.key.equals(name)) {
return property;
}
}
return null;
}
public static String getStringContent(StringProperty property) {
return property == null || property.value == null? null:property.value.text;
}
public static BinaryProperty getBinaryProp(String name, List binary) {
for (BinaryProperty property : binary) {
if (property.key.equals(name)) {
return property;
}
}
return null;
}
public static String getBinaryContent(BinaryProperty property) {
return property == null || property.value == null ? null : property.value.ref;
}
@Root(name = "AutoType")
public static class AutoType {
@Element(name = "Enabled", type = Boolean.class)
@Convert(KeePassBooleanConverter.class)
protected Boolean enabled;
@Element(name = "DataTransferObfuscation")
protected int dataTransferObfuscation;
@Element(name = "DefaultSequence", required = false)
protected String defaultSequence;
@Element(name = "Association", required = false)
protected AutoType.Association association;
public static class Association {
@Element(name = "Window")
protected String window;
@Element(name="KeystrokeSequence")
protected String keystrokeSequence;
protected List