All Downloads are FREE. Search and download functionalities are using the official Maven repository.

flowable.Sample15RestApplication Maven / Gradle / Ivy

The newest version!
/* 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 flowable;

import org.flowable.engine.IdentityService;
import org.flowable.idm.api.Group;
import org.flowable.idm.api.User;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * @author Filip Hrisafov
 */
@SpringBootApplication
public class Sample15RestApplication {

    public static void main(String[] args) {
        SpringApplication.run(Sample15RestApplication.class, args);
    }

    @Bean
    public CommandLineRunner usersAndGroupsInitializer(final IdentityService identityService) {
        return args -> {
            // install groups & users
            Group group = identityService.newGroup("user");
            group.setName("users");
            group.setType("security-role");
            identityService.saveGroup(group);

            User joram = identityService.newUser("jbarrez");
            joram.setFirstName("Joram");
            joram.setLastName("Barrez");
            joram.setPassword("password");
            identityService.saveUser(joram);

            User filip = identityService.newUser("filiphr");
            filip.setFirstName("Filip");
            filip.setLastName("Hrisafov");
            filip.setPassword("password");
            identityService.saveUser(filip);

            User josh = identityService.newUser("jlong");
            josh.setFirstName("Josh");
            josh.setLastName("Long");
            josh.setPassword("password");
            identityService.saveUser(josh);

            identityService.createMembership("jbarrez", "user");
            identityService.createMembership("filiphr", "user");
            identityService.createMembership("jlong", "user");
        };
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy