Search in sources :

Example 1 with XmlTransient

use of javax.xml.bind.annotation.XmlTransient in project candlepin by candlepin.

the class Product method getSkuDisabledContentIds.

@XmlTransient
public List<String> getSkuDisabledContentIds() {
    List<String> skus = new LinkedList<>();
    String attrib = this.getAttributeValue(Attributes.CONTENT_OVERRIDE_DISABLED);
    if (attrib != null && !attrib.isEmpty()) {
        StringTokenizer tokenizer = new StringTokenizer(attrib, ",");
        while (tokenizer.hasMoreElements()) {
            skus.add((String) tokenizer.nextElement());
        }
    }
    return skus;
}
Also used : StringTokenizer(java.util.StringTokenizer) LinkedList(java.util.LinkedList) XmlTransient(javax.xml.bind.annotation.XmlTransient)

Example 2 with XmlTransient

use of javax.xml.bind.annotation.XmlTransient in project winery by eclipse.

the class TEntityType method getWinerysPropertiesDefinition.

/**
 * This is a special method for Winery. Winery allows to define a property definition by specifying name/type
 * values. Instead of parsing the extensible elements returned TDefinitions, this method is a convenience method to
 * access this information
 *
 * @return a WinerysPropertiesDefinition object, which includes a map of name/type-pairs denoting the associated
 * property definitions. A default element name and namespace is added if it is not defined in the underlying XML.
 * null if no Winery specific KV properties are defined for the given entity type
 */
@XmlTransient
@JsonIgnore
public WinerysPropertiesDefinition getWinerysPropertiesDefinition() {
    if (properties == null || !(properties instanceof WinerysPropertiesDefinition)) {
        return null;
    }
    WinerysPropertiesDefinition res = (WinerysPropertiesDefinition) properties;
    // we put defaults if element name and namespace have not been set
    if (res.getElementName() == null) {
        res.setElementName("Properties");
    }
    if (res.getNamespace() == null) {
        // we use the target namespace of the original element
        String ns = this.getTargetNamespace();
        if (!ns.endsWith("/")) {
            ns += "/";
        }
        ns += NS_SUFFIX_PROPERTIES_DEFINITION_WINERY;
        res.setNamespace(ns);
    }
    return res;
}
Also used : WinerysPropertiesDefinition(org.eclipse.winery.model.tosca.extensions.kvproperties.WinerysPropertiesDefinition) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore) XmlTransient(javax.xml.bind.annotation.XmlTransient)

Example 3 with XmlTransient

use of javax.xml.bind.annotation.XmlTransient in project cxf by apache.

the class JAXBContextInitializer method isMethodAccepted.

/**
 * Checks if the method is accepted as a JAXB property getter.
 */
static boolean isMethodAccepted(Method method, XmlAccessType accessType) {
    // We only accept non static property getters which are not marked @XmlTransient
    if (Modifier.isStatic(method.getModifiers()) || method.isAnnotationPresent(XmlTransient.class) || !Modifier.isPublic(method.getModifiers()) || "getClass".equals(method.getName())) {
        return false;
    }
    // must not have parameters and return type must not be void
    if (method.getReturnType() == Void.class || method.getReturnType() == Void.TYPE || method.getParameterTypes().length != 0 || (method.getDeclaringClass().equals(Throwable.class) && !("getMessage".equals(method.getName()))) || !(method.getName().startsWith("get") || method.getName().startsWith("is"))) {
        return false;
    }
    int beginIndex = 3;
    if (method.getName().startsWith("is")) {
        beginIndex = 2;
    }
    Method setter = null;
    try {
        setter = method.getDeclaringClass().getMethod("set" + method.getName().substring(beginIndex), new Class[] { method.getReturnType() });
    } catch (Exception e) {
    // getter, but no setter
    }
    if (setter != null) {
        if (setter.isAnnotationPresent(XmlTransient.class) || !Modifier.isPublic(setter.getModifiers())) {
            return false;
        }
    } else if (!Collection.class.isAssignableFrom(method.getReturnType()) && !Throwable.class.isAssignableFrom(method.getDeclaringClass())) {
        // not an Exception,
        return false;
    }
    if (accessType == XmlAccessType.NONE || accessType == XmlAccessType.FIELD) {
        return checkJaxbAnnotation(method.getAnnotations());
    }
    return true;
}
Also used : Collection(java.util.Collection) Method(java.lang.reflect.Method) XmlTransient(javax.xml.bind.annotation.XmlTransient)

Example 4 with XmlTransient

use of javax.xml.bind.annotation.XmlTransient in project candlepin by candlepin.

the class Product method getSkuEnabledContentIds.

@XmlTransient
public List<String> getSkuEnabledContentIds() {
    List<String> skus = new LinkedList<>();
    String attrib = this.getAttributeValue(Attributes.CONTENT_OVERRIDE_ENABLED);
    if (attrib != null && !attrib.isEmpty()) {
        StringTokenizer tokenizer = new StringTokenizer(attrib, ",");
        while (tokenizer.hasMoreElements()) {
            skus.add((String) tokenizer.nextElement());
        }
    }
    return skus;
}
Also used : StringTokenizer(java.util.StringTokenizer) LinkedList(java.util.LinkedList) XmlTransient(javax.xml.bind.annotation.XmlTransient)

Example 5 with XmlTransient

use of javax.xml.bind.annotation.XmlTransient in project candlepin by candlepin.

the class User method getPermissions.

/**
 * Full list of permissions for this user.
 *
 * Includes those from roles stored in the database, as well as those explicitly added
 * by the user service adapter.
 *
 * @return full list of permissions for this user.
 */
@XmlTransient
public Set<Permission> getPermissions() {
    PermissionFactory permFactory = new PermissionFactory();
    Set<Permission> perms = new HashSet<>();
    for (Role r : getRoles()) {
        perms.addAll(permFactory.createPermissions(this, r.getPermissions()));
    }
    perms.addAll(this.permissions);
    return perms;
}
Also used : PermissionFactory(org.candlepin.auth.permissions.PermissionFactory) Permission(org.candlepin.auth.permissions.Permission) HashSet(java.util.HashSet) XmlTransient(javax.xml.bind.annotation.XmlTransient)

Aggregations

XmlTransient (javax.xml.bind.annotation.XmlTransient)8 Method (java.lang.reflect.Method)3 Collection (java.util.Collection)2 LinkedList (java.util.LinkedList)2 StringTokenizer (java.util.StringTokenizer)2 JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)1 Annotation (java.lang.annotation.Annotation)1 Field (java.lang.reflect.Field)1 HashSet (java.util.HashSet)1 XmlAccessType (javax.xml.bind.annotation.XmlAccessType)1 XmlAccessorType (javax.xml.bind.annotation.XmlAccessorType)1 XmlRootElement (javax.xml.bind.annotation.XmlRootElement)1 XmlType (javax.xml.bind.annotation.XmlType)1 Permission (org.candlepin.auth.permissions.Permission)1 PermissionFactory (org.candlepin.auth.permissions.PermissionFactory)1 WinerysPropertiesDefinition (org.eclipse.winery.model.tosca.extensions.kvproperties.WinerysPropertiesDefinition)1 GuiFragment (org.entando.entando.aps.system.services.guifragment.GuiFragment)1