Added: ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/security/SecurityServerLocator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/security/SecurityServerLocator.java?rev=767305&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/security/SecurityServerLocator.java (added) +++ ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/security/SecurityServerLocator.java Tue Apr 21 21:32:49 2009 @@ -0,0 +1,162 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + *******************************************************************************/ +/** + * SecurityServerLocator.java + * + * This file was auto-generated from WSDL + * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. + */ + +package org.ofbiz.crowd.security; + +import org.ofbiz.base.util.UtilProperties; + +public class SecurityServerLocator extends org.apache.axis.client.Service implements org.ofbiz.crowd.security.SecurityServer { + + public SecurityServerLocator() { + } + + + public SecurityServerLocator(org.apache.axis.EngineConfiguration config) { + super(config); + } + + public SecurityServerLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException { + super(wsdlLoc, sName); + } + + // Use to get a proxy class for SecurityServerHttpPort + private java.lang.String SecurityServerHttpPort_address = UtilProperties.getPropertyValue("crowd.properties", "crowd.server.address"); + + public java.lang.String getSecurityServerHttpPortAddress() { + return SecurityServerHttpPort_address; + } + + // The WSDD service name defaults to the port name. + private java.lang.String SecurityServerHttpPortWSDDServiceName = "SecurityServerHttpPort"; + + public java.lang.String getSecurityServerHttpPortWSDDServiceName() { + return SecurityServerHttpPortWSDDServiceName; + } + + public void setSecurityServerHttpPortWSDDServiceName(java.lang.String name) { + SecurityServerHttpPortWSDDServiceName = name; + } + + public org.ofbiz.crowd.security.SecurityServerPortType getSecurityServerHttpPort() throws javax.xml.rpc.ServiceException { + java.net.URL endpoint; + try { + endpoint = new java.net.URL(SecurityServerHttpPort_address); + } + catch (java.net.MalformedURLException e) { + throw new javax.xml.rpc.ServiceException(e); + } + return getSecurityServerHttpPort(endpoint); + } + + public org.ofbiz.crowd.security.SecurityServerPortType getSecurityServerHttpPort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException { + try { + org.ofbiz.crowd.security.SecurityServerHttpBindingStub _stub = new org.ofbiz.crowd.security.SecurityServerHttpBindingStub(portAddress, this); + _stub.setPortName(getSecurityServerHttpPortWSDDServiceName()); + return _stub; + } + catch (org.apache.axis.AxisFault e) { + return null; + } + } + + public void setSecurityServerHttpPortEndpointAddress(java.lang.String address) { + SecurityServerHttpPort_address = address; + } + + /** + * For the given interface, get the stub implementation. + * If this service has no port for the given interface, + * then ServiceException is thrown. + */ + public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException { + try { + if (org.ofbiz.crowd.security.SecurityServerPortType.class.isAssignableFrom(serviceEndpointInterface)) { + org.ofbiz.crowd.security.SecurityServerHttpBindingStub _stub = new org.ofbiz.crowd.security.SecurityServerHttpBindingStub(new java.net.URL(SecurityServerHttpPort_address), this); + _stub.setPortName(getSecurityServerHttpPortWSDDServiceName()); + return _stub; + } + } + catch (java.lang.Throwable t) { + throw new javax.xml.rpc.ServiceException(t); + } + throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName())); + } + + /** + * For the given interface, get the stub implementation. + * If this service has no port for the given interface, + * then ServiceException is thrown. + */ + public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException { + if (portName == null) { + return getPort(serviceEndpointInterface); + } + java.lang.String inputPortName = portName.getLocalPart(); + if ("SecurityServerHttpPort".equals(inputPortName)) { + return getSecurityServerHttpPort(); + } + else { + java.rmi.Remote _stub = getPort(serviceEndpointInterface); + ((org.apache.axis.client.Stub) _stub).setPortName(portName); + return _stub; + } + } + + public javax.xml.namespace.QName getServiceName() { + return new javax.xml.namespace.QName("urn:SecurityServer", "SecurityServer"); + } + + private java.util.HashSet ports = null; + + public java.util.Iterator getPorts() { + if (ports == null) { + ports = new java.util.HashSet(); + ports.add(new javax.xml.namespace.QName("urn:SecurityServer", "SecurityServerHttpPort")); + } + return ports.iterator(); + } + + /** + * Set the endpoint address for the specified port name. + */ + public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException { + +if ("SecurityServerHttpPort".equals(portName)) { + setSecurityServerHttpPortEndpointAddress(address); + } + else +{ // Unknown Port Name + throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName); + } + } + + /** + * Set the endpoint address for the specified port name. + */ + public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException { + setEndpointAddress(portName.getLocalPart(), address); + } + +} Added: ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/security/SecurityServerPortType.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/security/SecurityServerPortType.java?rev=767305&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/security/SecurityServerPortType.java (added) +++ ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/security/SecurityServerPortType.java Tue Apr 21 21:32:49 2009 @@ -0,0 +1,71 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + *******************************************************************************/ +/** + * SecurityServerPortType.java + * + * This file was auto-generated from WSDL + * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. + */ + +package org.ofbiz.crowd.security; + +public interface SecurityServerPortType extends java.rmi.Remote { + public com.atlassian.crowd.integration.soap.SOAPNestableGroup[] findAllGroupRelationships(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException; + public com.atlassian.crowd.integration.soap.SOAPGroup addGroup(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, com.atlassian.crowd.integration.soap.SOAPGroup in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException, com.atlassian.crowd.integration.exception.InvalidGroupException; + public void addPrincipalToRole(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1, java.lang.String in2) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public com.atlassian.crowd.integration.soap.SOAPPrincipal findPrincipalByToken(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, com.atlassian.crowd.integration.exception.InvalidTokenException, java.rmi.RemoteException; + public void updatePrincipalCredential(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1, com.atlassian.crowd.integration.authentication.PasswordCredential in2) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, com.atlassian.crowd.integration.exception.InvalidCredentialException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public java.lang.String[] getGrantedAuthorities(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException; + public com.atlassian.crowd.integration.soap.SOAPPrincipal addPrincipal(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, com.atlassian.crowd.integration.soap.SOAPPrincipal in1, com.atlassian.crowd.integration.authentication.PasswordCredential in2) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, com.atlassian.crowd.integration.exception.InvalidCredentialException, com.atlassian.crowd.integration.exception.InvalidPrincipalException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException; + public void addAttributeToPrincipal(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1, com.atlassian.crowd.integration.soap.SOAPAttribute in2) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public void invalidatePrincipalToken(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException; + public java.lang.String[] findAllGroupNames(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException; + public java.lang.String[] findRoleMemberships(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public void removePrincipal(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public boolean isValidPrincipalToken(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1, com.atlassian.crowd.integration.authentication.ValidationFactor[] in2) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, com.atlassian.crowd.integration.exception.ApplicationAccessDeniedException, java.rmi.RemoteException; + public java.lang.String authenticatePrincipalSimple(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1, java.lang.String in2) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, com.atlassian.crowd.integration.exception.InvalidAuthenticationException, com.atlassian.crowd.integration.exception.ApplicationAccessDeniedException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InactiveAccountException; + public void removeRole(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public com.atlassian.crowd.integration.soap.SOAPCookieInfo getCookieInfo(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException; + public void updatePrincipalAttribute(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1, com.atlassian.crowd.integration.soap.SOAPAttribute in2) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public com.atlassian.crowd.integration.soap.SOAPGroup[] searchGroups(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, com.atlassian.crowd.integration.soap.SearchRestriction[] in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException; + public long getCacheTime(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException; + public boolean isRoleMember(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1, java.lang.String in2) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException; + public void updateGroup(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1, java.lang.String in2, boolean in3) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public java.lang.String[] findAllRoleNames(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException; + public com.atlassian.crowd.integration.soap.SOAPRole findRoleByName(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public boolean isCacheEnabled(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException; + public com.atlassian.crowd.integration.soap.SOAPGroup findGroupByName(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public void removePrincipalFromRole(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1, java.lang.String in2) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public java.lang.String authenticatePrincipal(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, com.atlassian.crowd.integration.authentication.PrincipalAuthenticationContext in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, com.atlassian.crowd.integration.exception.InvalidAuthenticationException, com.atlassian.crowd.integration.exception.ApplicationAccessDeniedException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InactiveAccountException; + public java.lang.String[] findGroupMemberships(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public void addPrincipalToGroup(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1, java.lang.String in2) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public void removeGroup(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public void removeAttributeFromPrincipal(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1, java.lang.String in2) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public java.lang.String[] findAllPrincipalNames(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException; + public com.atlassian.crowd.integration.soap.SOAPRole addRole(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, com.atlassian.crowd.integration.soap.SOAPRole in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException, com.atlassian.crowd.integration.exception.InvalidRoleException; + public java.lang.String createPrincipalToken(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1, com.atlassian.crowd.integration.authentication.ValidationFactor[] in2) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, com.atlassian.crowd.integration.exception.InvalidAuthenticationException, com.atlassian.crowd.integration.exception.ApplicationAccessDeniedException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InactiveAccountException; + public com.atlassian.crowd.integration.soap.SOAPRole[] searchRoles(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, com.atlassian.crowd.integration.soap.SearchRestriction[] in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException; + public void removePrincipalFromGroup(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1, java.lang.String in2) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public com.atlassian.crowd.integration.soap.SOAPPrincipal findPrincipalByName(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public void resetPrincipalCredential(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, com.atlassian.crowd.integration.exception.InvalidCredentialException, java.rmi.RemoteException, com.atlassian.crowd.integration.exception.ApplicationPermissionException, com.atlassian.crowd.integration.exception.ObjectNotFoundException; + public boolean isGroupMember(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, java.lang.String in1, java.lang.String in2) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException; + public com.atlassian.crowd.integration.soap.SOAPPrincipal[] searchPrincipals(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0, com.atlassian.crowd.integration.soap.SearchRestriction[] in1) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException; + public java.lang.String getDomain(com.atlassian.crowd.integration.authentication.AuthenticatedToken in0) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, java.rmi.RemoteException; + public com.atlassian.crowd.integration.authentication.AuthenticatedToken authenticateApplication(com.atlassian.crowd.integration.authentication.ApplicationAuthenticationContext in0) throws java.rmi.RemoteException, com.atlassian.crowd.integration.exception.InvalidAuthorizationTokenException, com.atlassian.crowd.integration.exception.InvalidAuthenticationException, java.rmi.RemoteException; +} Added: ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/user/UserAttributeMapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/user/UserAttributeMapper.java?rev=767305&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/user/UserAttributeMapper.java (added) +++ ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/user/UserAttributeMapper.java Tue Apr 21 21:32:49 2009 @@ -0,0 +1,124 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.ofbiz.crowd.user; + +import java.util.Properties; +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; + +import org.ofbiz.base.util.UtilProperties; +import com.atlassian.crowd.integration.soap.SOAPAttribute; + +/** + * UserAttributeMapper + */ +public class UserAttributeMapper { + + private List<SOAPAttribute> attributes; + + public UserAttributeMapper(SOAPAttribute[] attributes) { + this(); + setAttributes(attributes); + } + + public UserAttributeMapper() { + this.attributes = new ArrayList<SOAPAttribute>(); + } + + public SOAPAttribute[] getAttributes() { + SOAPAttribute[] attrs = new SOAPAttribute[attributes.size()]; + int index = 0; + for (SOAPAttribute a : attributes) { + attrs[index] = a; + index++; + } + return attrs; + } + + public void setAttributes(SOAPAttribute[] attributes) { + this.attributes.addAll(Arrays.asList(attributes)); + } + + public String getFirstName() { + return getOFBizValue("firstName"); + } + + public void setFirstName(String firstName) { + makeAttribute("firstName", firstName); + } + + public String getLastName() { + return getOFBizValue("lastName"); + } + + public void setLastName(String lastName) { + makeAttribute("lastName", lastName); + } + + public String getEmail() { + return getOFBizValue("email"); + } + + public void setEmail(String email) { + makeAttribute("email", email); + } + + private String getOFBizValue(String name) { + String key = getCrowdKey(name); + if (key != null) { + for (SOAPAttribute a : attributes) { + if (a.getName().equals(key)) { + if (a.getValues() != null && a.getValues().length > 0) { + return a.getValues()[0]; + } + } + } + } + return null; + } + + private String getCrowdKey(String name) { + Properties props = UtilProperties.getProperties("crowd.properties"); + return (String) props.get("crowd.attribute.map." + name); + } + + private SOAPAttribute makeAttribute(String name, String value) { + SOAPAttribute attr = new SOAPAttribute(); + attr.setName(getCrowdKey(name)); + attr.setValues(new String[] {value}); + + removeAttributeByName(attr.getName()); + attributes.add(attr); + return attr; + } + + private void removeAttributeByName(String name) { + List<SOAPAttribute> toRemove = new ArrayList<SOAPAttribute>(); + for (SOAPAttribute a : attributes) { + if (a.getName().equals(name)) { + toRemove.add(a); + } + } + for (SOAPAttribute a : toRemove) { + attributes.remove(a); + } + } +} Added: ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/user/UserGroupMapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/user/UserGroupMapper.java?rev=767305&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/user/UserGroupMapper.java (added) +++ ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/user/UserGroupMapper.java Tue Apr 21 21:32:49 2009 @@ -0,0 +1,64 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.ofbiz.crowd.user; + +import java.util.List; +import java.util.Properties; +import java.util.Arrays; +import java.util.Set; + +import org.ofbiz.base.util.UtilProperties; +import javolution.util.FastSet; + +/** + * UserGroupMapper + */ +public class UserGroupMapper { + + protected List<String> groups; + + public UserGroupMapper(String[] groups) { + this.groups = Arrays.asList(groups); + } + + public Set<String> getSecurityGroups() { + Properties props = UtilProperties.getProperties("crowd.properties"); + + Set<String> secGroups = FastSet.newInstance(); + boolean running = true; + int index = 1; + + while (running) { + String groupStr = (String) props.get("crowd.group.map." + index); + if (groupStr == null) { + running = false; + } else { + String[] groupSplit = groupStr.split("="); + if (groupSplit.length == 2) { + if (groups.contains(groupSplit[0])) { + secGroups.add(groupSplit[1]); + } + } + } + index++; + } + return secGroups; + } +} Added: ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/user/UserWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/user/UserWrapper.java?rev=767305&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/user/UserWrapper.java (added) +++ ofbiz/trunk/specialpurpose/crowd/src/org/ofbiz/crowd/user/UserWrapper.java Tue Apr 21 21:32:49 2009 @@ -0,0 +1,58 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.ofbiz.crowd.user; + +import com.atlassian.crowd.integration.soap.SOAPPrincipal; + +/** + * UserWrapper + */ +public class UserWrapper { + + protected UserAttributeMapper attMapper; + protected UserGroupMapper grpMapper; + protected SOAPPrincipal user; + + public UserWrapper(SOAPPrincipal user, String[] groups) { + this.user = user; + this.attMapper = new UserAttributeMapper(user.getAttributes()); + this.grpMapper = new UserGroupMapper(groups); + } + + public SOAPPrincipal getSOAPPrincipal() { + return user; + } + + public UserAttributeMapper getUserAttributeMapper() { + return attMapper; + } + + public UserGroupMapper getUserGroupMapper() { + return grpMapper; + } + + public String getName() { + return user.getName(); + } + + public String getDescription() { + return user.getDescription(); + } +} |
Free forum by Nabble | Edit this page |