001/**
002 * Copyright 2013 John Ericksen
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *    http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.androidtransfuse.model.manifest;
017
018import org.androidtransfuse.annotations.ProtectionLevel;
019import org.androidtransfuse.model.Identified;
020import org.androidtransfuse.model.Mergeable;
021import org.androidtransfuse.processor.Merge;
022
023import javax.xml.bind.annotation.XmlAttribute;
024import javax.xml.bind.annotation.XmlTransient;
025import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
026
027/**
028 * attributes:
029 * android:description="string resource"
030 * android:icon="drawable resource"
031 * android:label="string resource"
032 * android:name="string"
033 * android:permissionGroup="string"
034 * android:protectionLevel=["normal" | "dangerous" |
035 * "signature" | "signatureOrSystem"]
036 *
037 * @author John Ericksen
038 */
039public class Permission extends Mergeable implements Identified {
040
041    private String description;
042    private String icon;
043    private String label;
044    private String name;
045    private String permissionGroup;
046    private ProtectionLevel protectionLevel;
047
048    @Merge("d")
049    @XmlAttribute(name = "description", namespace = ManifestNamespaceMapper.ANDROID_URI)
050    public String getDescription() {
051        return description;
052    }
053
054    public void setDescription(String description) {
055        this.description = description;
056    }
057
058    @Merge("i")
059    @XmlAttribute(name = "icon", namespace = ManifestNamespaceMapper.ANDROID_URI)
060    public String getIcon() {
061        return icon;
062    }
063
064    public void setIcon(String icon) {
065        this.icon = icon;
066    }
067
068    @Merge("l")
069    @XmlAttribute(name = "label", namespace = ManifestNamespaceMapper.ANDROID_URI)
070    public String getLabel() {
071        return label;
072    }
073
074    public void setLabel(String label) {
075        this.label = label;
076    }
077
078
079    @Merge("n")
080    @XmlAttribute(name = "name", namespace = ManifestNamespaceMapper.ANDROID_URI)
081    public String getName() {
082        return name;
083    }
084
085    public void setName(String name) {
086        this.name = name;
087    }
088
089    @Merge("g")
090    @XmlAttribute(name = "permissionGroup", namespace = ManifestNamespaceMapper.ANDROID_URI)
091    public String getPermissionGroup() {
092        return permissionGroup;
093    }
094
095    public void setPermissionGroup(String permissionGroup) {
096        this.permissionGroup = permissionGroup;
097    }
098
099    @Merge("p")
100    @XmlAttribute(name = "protectionLevel", namespace = ManifestNamespaceMapper.ANDROID_URI)
101    @XmlJavaTypeAdapter(LabeledConverter.ProtectionLevelConverter.class)
102    public ProtectionLevel getProtectionLevel() {
103        return protectionLevel;
104    }
105
106    public void setProtectionLevel(ProtectionLevel protectionLevel) {
107        this.protectionLevel = protectionLevel;
108    }
109
110    @XmlTransient
111    public String getIdentifier(){
112        return name;
113    }
114}