Examples of UserProxy


Examples of com.dotmarketing.beans.UserProxy

      if (requestProxy.getAttribute(ClickstreamFilter.FILTER_APPLIED) == null) {
        requestProxy.setAttribute(ClickstreamFilter.FILTER_APPLIED,
            Boolean.TRUE);

        if (user != null) {
          UserProxy userProxy = null;
          try {
            userProxy = com.dotmarketing.business.APILocator
                .getUserProxyAPI()
                .getUserProxy(
                    user,
View Full Code Here

Examples of com.dotmarketing.beans.UserProxy

            String userId = (String) ((Map<String, Object>) it.next()).get("userid");

            user = APILocator.getUserAPI().loadUserById(userId,APILocator.getUserAPI().getSystemUser(),false);

            UserProxy userProxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(user,APILocator.getUserAPI().getSystemUser(), false);

            List<Address> addresses = user.getAddresses();
            Address address = null;
            if (addresses.size() > 0) {
                address = (Address) addresses.get(0);
            }
            matchesArray[i][0] = (userId == null) ? "" : userId;
            matchesArray[i][1] = (user.getFirstName() == null) ? "" : user.getFirstName();
            matchesArray[i][2] = (user.getMiddleName() == null) ? "" : user.getMiddleName();
            matchesArray[i][3] = (user.getLastName() == null) ? "" : user.getLastName();
            matchesArray[i][4] = (user.getEmailAddress() == null) ? "" : user.getEmailAddress();
            matchesArray[i][5] = (address == null) ? "" : address.getStreet1();
            matchesArray[i][6] = (address == null) ? "" : address.getStreet2();
            matchesArray[i][7] = (address == null) ? "" : address.getCity();
            matchesArray[i][8] = (address == null) ? "" : address.getState();
            matchesArray[i][9] = (address == null) ? "" : address.getZip();
            matchesArray[i][10] = (address == null) ? "" : address.getCountry();
            matchesArray[i][11] = (address == null) ? "" : address.getPhone();
            matchesArray[i][12] = UtilMethods.htmlDateToHTMLTime(user.getCreateDate());

            if (!isUserManagerAdmin) {
                // adding read permission
                try {
                    _checkUserPermissions(userProxy, searcherUser, PERMISSION_READ);
                    matchesArray[i][13] = "true";
                } catch (ActionException ae) {
                    matchesArray[i][13] = "false";
                }

                // adding write permission
                try {
                    _checkUserPermissions(userProxy, searcherUser, PERMISSION_WRITE);
                    matchesArray[i][14] = "true";
                } catch (ActionException ae) {
                    matchesArray[i][14] = "false";
                }
            } else {
                matchesArray[i][13] = "true";
                matchesArray[i][14] = "true";
            }

            matchesArray[i][15] = String.valueOf(userProxy.getInode());
        }

        Map<String, Object> hm = new java.util.HashMap<String, Object>();
        hm.put("matchesArray", matchesArray);
        hm.put("count", count);
View Full Code Here

Examples of com.dotmarketing.beans.UserProxy

        String userId = req.getParameter("userID");
        String companyId = com.dotmarketing.cms.factories.PublicCompanyFactory.getDefaultCompany().getCompanyId();

        User user = APILocator.getUserAPI().loadUserById(userId,APILocator.getUserAPI().getSystemUser(),false);
        UserProxy userProxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(user,APILocator.getUserAPI().getSystemUser(), false);

        //delete user tags
        List<TagInode> userTagsList = TagFactory.getTagInodeByInode(String.valueOf(userProxy.getInode()));
        for (TagInode tag : userTagsList) {
          Tag retrievedTag = TagFactory.getTagByTagId(tag.getTagId());
            TagFactory.deleteTagInode(tag);
            TagFactory.deleteTag(retrievedTag.getTagId());
        }

        if(InodeUtils.isSet(userProxy.getInode())) {
          PermissionAPI perAPI = APILocator.getPermissionAPI();
          perAPI.removePermissions(userProxy);
          // deletes user proxy
          InodeFactory.deleteInode(userProxy);
        }
View Full Code Here

Examples of com.dotmarketing.beans.UserProxy

            //Fix a bug when a userid is a substring of another userid example dotcms.1574 and dotcms15743
            String userIdExt = userId + ",";
            if (usersStr.equalsIgnoreCase("") || usersStr.contains(userIdExt) || fullCommand) {
                user = APILocator.getUserAPI().loadUserById(userId,APILocator.getUserAPI().getSystemUser(),false);

                UserProxy userProxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(user,APILocator.getUserAPI().getSystemUser(), false);

                // adding read permission
                try {
                    _checkUserPermissions(userProxy, searcherUser, PERMISSION_READ);
                } catch (ActionException ae) {
                    continue;
                }

                List addresses = user.getAddresses();
                Address address = null;
                if (addresses.size() > 0) {
                    address = (Address) addresses.get(0);
                }

                matchesArray[i][0] = userId;
                matchesArray[i][1] = (user.getFirstName() == null) ? "" : user.getFirstName();
                matchesArray[i][2] = (user.getMiddleName() == null) ? "" : user.getMiddleName();
                matchesArray[i][3] = (user.getLastName() == null) ? "" : user.getLastName();
                matchesArray[i][4] = (user.getEmailAddress() == null) ? "" : user.getEmailAddress();
                matchesArray[i][5] = (user.getPassword() == null) ? "" : user.getPassword();
                matchesArray[i][6] = UtilMethods.htmlDateToHTMLTime(user.getBirthday());
                matchesArray[i][7] = (address == null) ? "" : address.getStreet1();
                matchesArray[i][8] = (address == null) ? "" : address.getStreet2();
                matchesArray[i][9] = (address == null) ? "" : address.getCity();
                matchesArray[i][10] = (address == null) ? "" : address.getState();
                matchesArray[i][11] = (address == null) ? "" : address.getZip();
                matchesArray[i][12] = (address == null) ? "" : address.getCountry();
                matchesArray[i][13] = (address == null) ? "" : address.getPhone();
                matchesArray[i][14] = (address == null) ? "" : address.getFax();
                matchesArray[i][15] = (address == null) ? "" : address.getCell();

                for (int j = 1; j <= numberGenericVariables; j++) {
                    matchesArray[i][15 + j] = (userProxy.getVar(j) == null) ? "" : userProxy.getVar(j);
                }
            }
        }

        httpRes.setContentType("application/octet-stream");
View Full Code Here

Examples of com.dotmarketing.beans.UserProxy

                                user.setPassword(PublicEncryptionFactory.digestString(password));
                                user.setPasswordEncrypted(true);

                                APILocator.getUserAPI().save(user, APILocator.getUserAPI().getSystemUser(), false);

                                UserProxy userProxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(user,APILocator.getUserAPI().getSystemUser(), false);
                                String userProxyInode = userProxy.getInode();
                                userProxy = (UserProxy) InodeFactory.getInode(userProxyInode, UserProxy.class);
                                userProxy.setInode(userProxyInode);
                                userProxy.setUserId(user.getUserId());
                                // getting and saving the user
                                // additional info
                                String userAdditionalInfo = "";
                                for (int j = 1; j <= numberGenericVariables; j++) {
                                    try {
                                        userAdditionalInfo = lineTok[i++];
                                    } catch (Exception e) {
                                        userAdditionalInfo = "";
                                    }
                                    if (!userAdditionalInfo.equalsIgnoreCase("")) {
                                        userProxy.setVar(j, userAdditionalInfo);
                                    }
                                }

                                com.dotmarketing.business.APILocator.getUserProxyAPI().saveUserProxy(userProxy,APILocator.getUserAPI().getSystemUser(), false);

                                userProxyInode = userProxy.getInode();
                                // adding roles to user
                                Permission permission = null;
                                if (readPermissions != null) {
                                    for (int n = 0; n < readPermissions.length; n++) {
                                        permission = new Permission(userProxyInode, readPermissions[n], PERMISSION_READ);
                                        permissionAPI.save(permission, userProxy, systemUser, false);
                                    }
                                }

                                if (writePermissions != null) {
                                    for (int n = 0; n < writePermissions.length; n++) {
                                        permission = new Permission(userProxyInode, writePermissions[n], PERMISSION_WRITE);
                                        permissionAPI.save(permission, userProxy, systemUser, false);
                                    }
                                }

                                Date today = new Date();

                                Address address = PublicAddressFactory.getInstance();
                                address.setUserName(user.getFullName());
                                address.setCompanyId(companyId);
                                address.setUserId(user.getUserId());
                                address.setCreateDate(today);
                                address.setModifiedDate(today);
                                address.setPriority(1);
                                address.setClassName(user.getClass().getName());
                                address.setClassPK(user.getUserId());
                                address.setDescription("Primary");
                                address.setStreet1(street1);
                                address.setStreet2(street2);
                                address.setCountry(country);
                                address.setCity(city);
                                address.setState(state);
                                address.setZip(zip);
                                address.setPhone(phone);
                                address.setFax(fax);
                                address.setCell(cell);

                                PublicAddressFactory.save(address);

                                // creating tag users
                                if (UtilMethods.isSet(userForm.getTagName())) {
                                    StringTokenizer tagNameToken = new StringTokenizer(userForm.getTagName(), ",");
                                    if (tagNameToken.hasMoreTokens()) {
                                        for (; tagNameToken.hasMoreTokens();) {
                                            String tagTokenized = tagNameToken.nextToken().trim();
                                            TagFactory.addTag(tagTokenized, user.getUserId(),"");
                                        }
                                    }
                                }


                                for (String roleId : roles) {
                                    com.dotmarketing.business.APILocator.getRoleAPI().addRoleToUser(roleId, user);
                                }

                                userCreated++;
                                userTaged++;

                                arrayUserIds.add(user.getUserId());

                            } else {
                                // email duplicated

                                if (userForm.isUpdateDuplicatedUsers()) {
                                    if (UtilMethods.isSet(firstName))
                                        userDuplicated.setFirstName(firstName);

                                    if (UtilMethods.isSet(middleName))
                                        userDuplicated.setMiddleName(middleName);

                                    if (UtilMethods.isSet(lastName))
                                        userDuplicated.setLastName(lastName);

                                    userDuplicated
                                            .setGreeting("Welcome, " + userDuplicated.getFirstName() + " " + userDuplicated.getLastName() + "!");

                                    if (UtilMethods.isSet(email))
                                        userDuplicated.setEmailAddress(email.trim().toLowerCase());

                                    if (UtilMethods.isSet(birthday))
                                        userDuplicated.setBirthday(birthday);

                                    if (UtilMethods.isSet(password)) {
                                        userDuplicated.setPassword(PublicEncryptionFactory.digestString(password));
                                        userDuplicated.setPasswordEncrypted(true);
                                    }

                                    APILocator.getUserAPI().save(userDuplicated,APILocator.getUserAPI().getSystemUser(),false);

                                    UserProxy userProxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(userDuplicated,APILocator.getUserAPI().getSystemUser(), false);
                                    // getting and saving the user
                                    // additional info
                                    String userAdditionalInfo = "";
                                    for (int j = 1; j <= numberGenericVariables; j++) {
                                        try {
                                            userAdditionalInfo = lineTok[i++];
                                        } catch (Exception e) {
                                            userAdditionalInfo = "";
                                        }
                                        if (!userAdditionalInfo.equalsIgnoreCase("")) {
                                            userProxy.setVar(j, userAdditionalInfo);
                                        }
                                    }

                                    com.dotmarketing.business.APILocator.getUserProxyAPI().saveUserProxy(userProxy,APILocator.getUserAPI().getSystemUser(), false);

                                   String userProxyInode = userProxy.getInode();

                                   permissionAPI.removePermissions(userProxy);

                                    // adding roles to user
                                    if (readPermissions != null) {
                                        for (int n = 0; n < readPermissions.length; n++) {
                                            permissionAPI.save(new Permission(userProxyInode, readPermissions[n], PERMISSION_READ), userProxy, systemUser, false);
                                        }
                                    }

                                    if (writePermissions != null) {
                                        for (int n = 0; n < writePermissions.length; n++) {
                                            permissionAPI.save(new Permission(userProxyInode, writePermissions[n], PERMISSION_WRITE), userProxy, systemUser, false);
                                        }
                                    }

                                    Address address = null;
                                    List<Address> addresses = PublicAddressFactory.getAddressesByUserId(userDuplicated.getUserId());
                                    for (int pos = 0; pos < addresses.size(); ++pos) {
                                        if ((addresses.get(pos).getDescription() != null) && (addresses.get(pos).getDescription().equals("Primary"))) {
                                            address = addresses.get(pos);
                                            break;
                                        }
                                    }

                                    Date today = new Date();

                                    if (address == null) {
                                        address = PublicAddressFactory.getInstance();
                                        address.setUserName(userDuplicated.getFullName());
                                        address.setCompanyId(companyId);
                                        address.setUserId(userDuplicated.getUserId());
                                        address.setCreateDate(today);
                                        address.setModifiedDate(today);
                                        address.setPriority(1);
                                        address.setClassName(userDuplicated.getClass().getName());
                                        address.setClassPK(userDuplicated.getUserId());
                                        address.setDescription("Primary");
                                        address.setStreet1(street1);
                                        address.setStreet2(street2);
                                        address.setCountry(country);
                                        address.setCity(city);
                                        address.setState(state);
                                        address.setZip(zip);
                                        address.setPhone(phone);
                                        address.setFax(fax);
                                        address.setCell(cell);
                                    } else {
                                        address.setModifiedDate(today);

                                        if (UtilMethods.isSet(street1))
                                            address.setStreet1(street1);

                                        if (UtilMethods.isSet(street2))
                                            address.setStreet2(street2);

                                        if (UtilMethods.isSet(country))
                                            address.setCountry(country);

                                        if (UtilMethods.isSet(city))
                                            address.setCity(city);

                                        if (UtilMethods.isSet(state))
                                            address.setState(state);

                                        if (UtilMethods.isSet(zip))
                                            address.setZip(zip);

                                        if (UtilMethods.isSet(phone))
                                            address.setPhone(phone);

                                        if (UtilMethods.isSet(fax))
                                            address.setFax(fax);

                                        if (UtilMethods.isSet(cell))
                                            address.setCell(cell);
                                    }

                                    PublicAddressFactory.save(address);

                                    for (String roleId : roles) {
                                        com.dotmarketing.business.APILocator.getRoleAPI().addRoleToUser(roleId, userDuplicated);
                                    }

                                    countUserDuplicated++;
                                } else {
                                    if (!someError) {
                                        returnMessage.append(LanguageUtil.get(com.liferay.portal.util.PortalUtil.getUser(req), "Errors-loading-users-br-br"));
                                        someError = true;
                                    }

                                    returnMessage.append(LanguageUtil.get(com.liferay.portal.util.PortalUtil.getUser(req), "Duplicated-Email")+": " + email + " "+LanguageUtil.get(com.liferay.portal.util.PortalUtil.getUser(req), "user.duplicated.email.line")+" " + lineNumber + "<br>");
                                }

                                if (UtilMethods.isSet(userForm.getTagName())) {
                                    StringTokenizer tagNameToken = new StringTokenizer(userForm.getTagName(), ",");
                                    if (tagNameToken.hasMoreTokens()) {
                                        UserProxy userProxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(userDuplicated,APILocator.getUserAPI().getSystemUser(), false);
                                        for (; tagNameToken.hasMoreTokens();) {
                                            String tagTokenized = tagNameToken.nextToken().trim();
                                            TagFactory.addTagInode(tagTokenized, String.valueOf(userProxy.getUserId()), "");
                                        }
                                    }
                                }

                                arrayUserIds.add(userDuplicated.getUserId());
View Full Code Here

Examples of com.dotmarketing.beans.UserProxy

    String userId = req.getParameter("userID");
    String companyId = com.dotmarketing.cms.factories.PublicCompanyFactory.getDefaultCompany().getCompanyId();

    User user = APILocator.getUserAPI().loadUserById(userId,APILocator.getUserAPI().getSystemUser(),false);
    UserProxy userProxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(user,APILocator.getUserAPI().getSystemUser(), false);
 
    //deletes user proxy
    InodeFactory.deleteInode(userProxy);
    //deletes liferay user
    APILocator.getUserAPI().delete(APILocator.getUserAPI().loadUserById(userId,APILocator.getUserAPI().getSystemUser(),false),com.dotmarketing.business.APILocator.getUserAPI().getSystemUser(), false);
View Full Code Here

Examples of gaetest.shared.UserProxy

        // Then, we send the input to the server.
        sendButton.setEnabled(false);
        textToServerLabel.setText(textToServer);
        serverResponseLabel.setText("");
        UserRequest userContext = requests.userRequest();
        UserProxy user = userContext.create(UserProxy.class);
        user.setName(textToServer);
        userContext.save(user).fire(new Receiver<Long>() {

          @Override
          public void onSuccess(Long response) {
//            String result = response.toString();
View Full Code Here

Examples of gaetest.shared.UserProxy

        // Then, we send the input to the server.
        sendButton.setEnabled(false);
        textToServerLabel.setText(textToServer);
        serverResponseLabel.setText("");
        UserRequest userContext = requests.userRequest();
        UserProxy user = userContext.create(UserProxy.class);
        user.setName(textToServer);
        userContext.save(user).fire(new Receiver<Long>() {

          @Override
          public void onSuccess(Long response) {
//            String result = response.toString();
View Full Code Here

Examples of org.appfuse.webapp.client.proxies.UserProxy

  return this.requests.userRequest();
    }

    @Override
    protected UserProxy createProxy(final RequestContext requestContext) {
  final UserProxy user = requestContext.create(UserProxy.class);
  final AddressProxy address = requestContext.create(AddressProxy.class);
  user.setAddress(address);
  return user;
    }
View Full Code Here

Examples of testrf.shared.UserProxy

        sendButton.setEnabled(false);
        textToServerLabel.setText(textToServer);
        serverResponseLabel.setText("");

        UserRequest userContext = requests.userRequest();
        UserProxy user = userContext.create(UserProxy.class);
        user.setName(textToServer);
        userContext.save(user).fire(new Receiver<Long>() {

          @Override
          public void onSuccess(Long response) {
            Long id = response;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.