本文整理汇总了Java中org.guvnor.structure.organizationalunit.OrganizationalUnit类的典型用法代码示例。如果您正苦于以下问题:Java OrganizationalUnit类的具体用法?Java OrganizationalUnit怎么用?Java OrganizationalUnit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OrganizationalUnit类属于org.guvnor.structure.organizationalunit包,在下文中一共展示了OrganizationalUnit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRepositoryDeleted
import org.guvnor.structure.organizationalunit.OrganizationalUnit; //导入依赖的package包/类
@Test
public void testRepositoryDeleted() throws Exception {
OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
GitRepository repository = new GitRepository();
context.setActiveOrganizationalUnit(organizationalUnit);
context.setActiveRepository(repository);
RepositoryRemovedEvent repositoryRemovedEvent = new RepositoryRemovedEvent(repository);
context.onRepositoryRemoved(repositoryRemovedEvent);
assertEquals(organizationalUnit,
context.getActiveOrganizationalUnit());
assertNull(context.getActiveRepository());
}
示例2: checkIfOrganizationalUnitExists
import org.guvnor.structure.organizationalunit.OrganizationalUnit; //导入依赖的package包/类
@Override
public void checkIfOrganizationalUnitExists(final String organizationalUnitName,
final Command onSuccessCommand,
final Command onFailureCommand) {
//Check the Organizational Unit doesn't already exist
organizationalUnitService.call(new RemoteCallback<OrganizationalUnit>() {
@Override
public void callback(final OrganizationalUnit organizationalUnit) {
if (organizationalUnit == null) {
onSuccessCommand.execute();
} else {
onFailureCommand.execute();
}
}
}).getOrganizationalUnit(organizationalUnitName);
}
示例3: createNewOrganizationalUnit
import org.guvnor.structure.organizationalunit.OrganizationalUnit; //导入依赖的package包/类
@Override
@ResourceCheck(type = ORG_UNIT_TYPE, action = ORG_UNIT_CREATE)
public void createNewOrganizationalUnit(final String organizationalUnitName,
final String organizationalUnitOwner,
final String defaultGroupId) {
final Collection<Repository> repositories = new ArrayList<Repository>();
view.showBusyIndicator(OrganizationalUnitManagerConstants.INSTANCE.Wait());
organizationalUnitService.call(new RemoteCallback<OrganizationalUnit>() {
@Override
public void callback(final OrganizationalUnit newOrganizationalUnit) {
createOUEvent.fire(new AfterCreateOrganizationalUnitEvent(newOrganizationalUnit));
allOrganizationalUnits.add(newOrganizationalUnit);
view.addOrganizationalUnit(newOrganizationalUnit);
view.hideBusyIndicator();
}
},
new HasBusyIndicatorDefaultErrorCallback(view)).createOrganizationalUnit(organizationalUnitName,
organizationalUnitOwner,
defaultGroupId,
repositories);
}
示例4: saveOrganizationalUnit
import org.guvnor.structure.organizationalunit.OrganizationalUnit; //导入依赖的package包/类
@Override
@ResourceCheck(type = ORG_UNIT_TYPE, action = ORG_UNIT_UPDATE)
public void saveOrganizationalUnit(final String organizationalUnitName,
final String organizationalUnitOwner,
final String defaultGroupId) {
view.showBusyIndicator(OrganizationalUnitManagerConstants.INSTANCE.Wait());
organizationalUnitService.call(new RemoteCallback<OrganizationalUnit>() {
@Override
public void callback(final OrganizationalUnit response) {
loadOrganizationalUnits();
}
},
new HasBusyIndicatorDefaultErrorCallback(view)).updateOrganizationalUnit(organizationalUnitName,
organizationalUnitOwner,
defaultGroupId);
}
示例5: addOrganizationalUnitRepository
import org.guvnor.structure.organizationalunit.OrganizationalUnit; //导入依赖的package包/类
@Override
@ResourceCheck(action = ORG_UNIT_UPDATE)
public void addOrganizationalUnitRepository(final OrganizationalUnit organizationalUnit,
final Repository repository) {
view.showBusyIndicator(OrganizationalUnitManagerConstants.INSTANCE.Wait());
organizationalUnit.getRepositories().add(repository);
organizationalUnitService.call(new RemoteCallback<Void>() {
@Override
public void callback(final Void v) {
view.setOrganizationalUnitRepositories(organizationalUnit.getRepositories(),
getAvailableRepositories());
view.hideBusyIndicator();
}
},
new HasBusyIndicatorDefaultErrorCallback(view)).addRepository(organizationalUnit,
repository);
}
示例6: removeOrganizationalUnitRepository
import org.guvnor.structure.organizationalunit.OrganizationalUnit; //导入依赖的package包/类
@Override
@ResourceCheck(action = ORG_UNIT_UPDATE)
public void removeOrganizationalUnitRepository(final OrganizationalUnit organizationalUnit,
final Repository repository) {
view.showBusyIndicator(OrganizationalUnitManagerConstants.INSTANCE.Wait());
organizationalUnit.getRepositories().remove(repository);
organizationalUnitService.call(new RemoteCallback<Void>() {
@Override
public void callback(final Void v) {
view.setOrganizationalUnitRepositories(organizationalUnit.getRepositories(),
getAvailableRepositories());
view.hideBusyIndicator();
}
},
new HasBusyIndicatorDefaultErrorCallback(view)).removeRepository(organizationalUnit,
repository);
}
示例7: toPermissionNode
import org.guvnor.structure.organizationalunit.OrganizationalUnit; //导入依赖的package包/类
private PermissionNode toPermissionNode(OrganizationalUnit ou) {
PermissionLeafNode node = new PermissionLeafNode();
node.setNodeName(ou.getName());
Permission readPermission = newPermission(ou,
READ);
Permission updatePermission = newPermission(ou,
UPDATE);
Permission deletePermission = newPermission(ou,
DELETE);
node.addPermission(readPermission,
i18n.OrganizationalUnitActionRead());
node.addPermission(updatePermission,
i18n.OrganizationalUnitActionUpdate());
node.addPermission(deletePermission,
i18n.OrganizationalUnitActionDelete());
node.addDependencies(readPermission,
updatePermission,
deletePermission);
return node;
}
示例8: populateOrganizationalUnits
import org.guvnor.structure.organizationalunit.OrganizationalUnit; //导入依赖的package包/类
private void populateOrganizationalUnits() {
//populate Organizational Units list box
organizationalUnitService.call(new RemoteCallback<Collection<OrganizationalUnit>>() {
@Override
public void callback(final Collection<OrganizationalUnit> organizationalUnits) {
view.addOrganizationalUnitSelectEntry();
if (organizationalUnits != null && !organizationalUnits.isEmpty()) {
for (OrganizationalUnit organizationalUnit : organizationalUnits) {
view.addOrganizationalUnit(organizationalUnit);
availableOrganizationalUnits.put(organizationalUnit.getName(),
organizationalUnit);
}
}
}
},
new ErrorCallback<Message>() {
@Override
public boolean error(final Message message,
final Throwable throwable) {
view.errorLoadOrganizationalUnitsFail(throwable);
return false;
}
}).getOrganizationalUnits();
}
示例9: deleteOrganizationalUnit
import org.guvnor.structure.organizationalunit.OrganizationalUnit; //导入依赖的package包/类
@Override
public void deleteOrganizationalUnit(final OrganizationalUnit ou) {
Option optToDelete = null;
for (int i = 0; i < organizationalUnitDropdown.getWidgetCount(); i++) {
final Widget w = organizationalUnitDropdown.getWidget(i);
if (w instanceof Option) {
final Option o = (Option) w;
if (o.getText().equals(ou.getName())) {
optToDelete = o;
break;
}
}
}
if (optToDelete != null) {
organizationalUnitDropdown.remove(optToDelete);
organizationalUnitDropdown.refresh();
}
}
示例10: createRepository
import org.guvnor.structure.organizationalunit.OrganizationalUnit; //导入依赖的package包/类
@Override
public Repository createRepository(final OrganizationalUnit organizationalUnit,
final String scheme,
final String alias,
final RepositoryEnvironmentConfigurations repositoryEnvironmentConfigurations) throws RepositoryAlreadyExistsException {
try {
final Repository repository = createRepository(scheme,
alias,
repositoryEnvironmentConfigurations);
if (organizationalUnit != null && repository != null) {
organizationalUnitService.addRepository(organizationalUnit,
repository);
}
metadataStore.write(alias,
(String) repositoryEnvironmentConfigurations.getOrigin());
return repository;
} catch (final Exception e) {
logger.error("Error during create repository",
e);
throw ExceptionUtilities.handleException(e);
}
}
示例11: searchByName
import org.guvnor.structure.organizationalunit.OrganizationalUnit; //导入依赖的package包/类
@Override
public Collection<OrganizationalUnit> searchByName(String pattern,
int maxItems,
boolean caseSensitive) {
List<OrganizationalUnit> results = new ArrayList<>();
for (OrganizationalUnit unit : organizationalUnitService.getAllOrganizationalUnits()) {
String name = unit.getName();
if (caseSensitive ? name.contains(pattern) : name.toLowerCase().contains(pattern.toLowerCase())) {
results.add(unit);
if (maxItems > 0 && results.size() >= maxItems) {
return results;
}
}
}
return results;
}
示例12: loadOrganizationalUnits
import org.guvnor.structure.organizationalunit.OrganizationalUnit; //导入依赖的package包/类
@PostConstruct
public void loadOrganizationalUnits() {
Collection<ConfigGroup> groups = configurationService.getConfiguration(ConfigType.ORGANIZATIONAL_UNIT);
if (groups != null) {
for (ConfigGroup groupConfig : groups) {
// Make sure existing Organizational Units are correctly initialized with a default group id.
String ouName = groupConfig.getName();
String defaultGroupId = groupConfig.getConfigItemValue("defaultGroupId");
if (defaultGroupId == null || defaultGroupId.trim().isEmpty()) {
groupConfig.setConfigItem(configurationFactory.newConfigItem("defaultGroupId",
getSanitizedDefaultGroupId(ouName)));
configurationService.updateConfiguration(groupConfig);
}
OrganizationalUnit ou = organizationalUnitFactory.newOrganizationalUnit(groupConfig);
registeredOrganizationalUnits.put(ou.getName(),
ou);
}
}
}
示例13: removeOrganizationalUnit
import org.guvnor.structure.organizationalunit.OrganizationalUnit; //导入依赖的package包/类
@Override
public void removeOrganizationalUnit(String groupName) {
final ConfigGroup thisGroupConfig = findGroupConfig(groupName);
if (thisGroupConfig != null) {
OrganizationalUnit ou = null;
try {
configurationService.startBatch();
configurationService.removeConfiguration(thisGroupConfig);
ou = registeredOrganizationalUnits.remove(groupName);
} finally {
configurationService.endBatch();
if (ou != null) {
removeOrganizationalUnitEvent.fire(new RemoveOrganizationalUnitEvent(ou,
getUserInfo(sessionInfo)));
}
}
}
}
示例14: setUp
import org.guvnor.structure.organizationalunit.OrganizationalUnit; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
backward = new BackwardCompatibleUtil(configurationFactory);
organizationalUnitFactory = spy(new OrganizationalUnitFactoryImpl(repositoryService,
backward));
organizationalUnitService = new OrganizationalUnitServiceImpl(configurationService,
configurationFactory,
organizationalUnitFactory,
backward,
newOrganizationalUnitEvent,
removeOrganizationalUnitEvent,
repoAddedToOrgUnitEvent,
repoRemovedFromOrgUnitEvent,
updatedOrganizationalUnitEvent,
authorizationManager,
sessionInfo);
organizationalUnitService.registeredOrganizationalUnits.put("A",
mock(OrganizationalUnit.class));
when(authorizationManager.authorize(any(Resource.class),
any(User.class))).thenReturn(false);
}
示例15: updateOrganizationalUnit
import org.guvnor.structure.organizationalunit.OrganizationalUnit; //导入依赖的package包/类
public JobResult updateOrganizationalUnit(final String jobId,
final String organizationalUnitName,
final String organizationalUnitOwner,
final String defaultGroupId) {
JobResult result = new JobResult();
result.setJobId(jobId);
if (organizationalUnitName == null || organizationalUnitOwner == null) {
result.setStatus(JobStatus.BAD_REQUEST);
result.setResult("OrganizationalUnit name and owner must be provided");
return result;
}
String _defaultGroupId = null;
if (defaultGroupId == null || defaultGroupId.trim().isEmpty()) {
_defaultGroupId = organizationalUnitService.getSanitizedDefaultGroupId(organizationalUnitName);
logger.warn("No default group id was provided, reverting to the organizational unit name");
} else {
if (!organizationalUnitService.isValidGroupId(defaultGroupId)) {
result.setStatus(JobStatus.BAD_REQUEST);
result.setResult("Invalid default group id, only alphanumerical characters are admitted, " +
"as well as '\"_\"', '\"-\"' or '\".\"'.");
return result;
} else {
_defaultGroupId = defaultGroupId;
}
}
OrganizationalUnit organizationalUnit = organizationalUnitService.updateOrganizationalUnit(organizationalUnitName,
organizationalUnitOwner,
_defaultGroupId);
if (organizationalUnit != null) {
result.setResult("OrganizationalUnit " + organizationalUnit.getName() + " was successfully updated.");
result.setStatus(JobStatus.SUCCESS);
} else {
result.setStatus(JobStatus.FAIL);
}
return result;
}