Java Code Examples for org.apache.commons.lang3.BooleanUtils#isFalse()

The following examples show how to use org.apache.commons.lang3.BooleanUtils#isFalse() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionValidate.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
ActionResult<Wo> execute() throws Exception {
	ActionResult<Wo> result = new ActionResult<>();
	Wo wo = new Wo();
	wo.setValue(true);
	if (!this.connect()) {
		wo.setValue(false);
	}
	if(BooleanUtils.isFalse(Config.collect().getEnable())){
		wo.setValue(false);
	}
	if (!this.validate(Config.collect().getName(), Config.collect().getPassword())) {
		wo.setValue(false);
	}
	if (BooleanUtils.isTrue(wo.getValue())) {
		/* 提交人员同步 */
		ThisApplication.context().scheduleLocal(CollectPerson.class);
	}
	result.setData(wo);
	return result;
}
 
Example 2
Source File: ListEditorPopupWindow.java    From cuba with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
protected TextField createTextField(Datatype datatype) {
    TextField textField = uiComponents.create(TextField.class);
    textField.setDatatype(datatype);

    if (!BooleanUtils.isFalse(editable)) {
        FilterHelper.ShortcutListener shortcutListener = new FilterHelper.ShortcutListener("add", new KeyCombination(KeyCombination.Key.ENTER)) {
            @Override
            public void handleShortcutPressed() {
                _addValue(textField);
            }
        };
        filterHelper.addShortcutListener(textField, shortcutListener);
    }
    return textField;
}
 
Example 3
Source File: ManualProcessor.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
private void writeToEmpowerMap(AeiObjects aeiObjects, TaskIdentities taskIdentities) throws Exception {
	/* 先清空EmpowerMap */
	aeiObjects.getWork().getProperties().setManualEmpowerMap(new LinkedHashMap<String, String>());
	if (!(StringUtils.equals(aeiObjects.getWork().getWorkCreateType(), Work.WORKCREATETYPE_SURFACE)
			&& BooleanUtils.isFalse(aeiObjects.getWork().getWorkThroughManual()))) {
		List<String> values = taskIdentities.identities();
		values = ListUtils.subtract(values, aeiObjects.getProcessingAttributes().getIgnoreEmpowerIdentityList());
		taskIdentities.empower(aeiObjects.business().organization().empower().listWithIdentityObject(
				aeiObjects.getWork().getApplication(), aeiObjects.getProcess().getEdition(),
				aeiObjects.getWork().getProcess(), aeiObjects.getWork().getId(), values));
		for (TaskIdentity taskIdentity : taskIdentities) {
			if (StringUtils.isNotEmpty(taskIdentity.getFromIdentity())) {
				aeiObjects.getWork().getProperties().getManualEmpowerMap().put(taskIdentity.getIdentity(),
						taskIdentity.getFromIdentity());
			}
		}
	}
}
 
Example 4
Source File: WxCrawler.java    From wx-crawl with Apache License 2.0 5 votes vote down vote up
/**
 * 是否爬取过。只有在打开断点续爬时才做检查
 * @param key
 * @return
 */
private boolean hasCrawled(String key){
    if (BooleanUtils.isFalse(isResumable)) {
        return false;
    }
    return redisService.exists(key);
}
 
Example 5
Source File: CurseFileHandler.java    From ModPackDownloader with MIT License 5 votes vote down vote up
private CurseFile checkBackupVersions(String releaseType, CurseFile curseFile, JSONObject fileListJson, String mcVersion, CurseFile newMod) {
	CurseFile returnMod = newMod;
	for (String backupVersion : arguments.getBackupVersions()) {
		log.debug("No files found for Minecraft {}, checking backup version {}", mcVersion, backupVersion);
		returnMod = getLatestVersion(releaseType, curseFile, fileListJson, backupVersion);
		if (BooleanUtils.isFalse(newMod.getSkipDownload())) {
			curseFile.setSkipDownload(null);
			log.debug("Found update for {} in Minecraft {}", curseFile.getName(), backupVersion);
			break;
		}
	}
	return returnMod;
}
 
Example 6
Source File: DefaultAuthorizationUtility.java    From blackduck-alert with Apache License 2.0 5 votes vote down vote up
@Override
public void deleteRole(Long roleId) throws AlertForbiddenOperationException {
    Optional<RoleEntity> foundRole = roleRepository.findById(roleId);
    if (foundRole.isPresent()) {
        RoleEntity roleEntity = foundRole.get();
        if (BooleanUtils.isFalse(roleEntity.getCustom())) {
            throw new AlertForbiddenOperationException("Cannot delete the role '" + roleId + "' because it is not a custom role.");
        }
        // Deletion cascades to permissions
        roleRepository.deleteById(roleEntity.getId());
    }
}
 
Example 7
Source File: DefaultAuthorizationUtility.java    From blackduck-alert with Apache License 2.0 5 votes vote down vote up
@Override
public void updateRoleName(Long roleId, String roleName) throws AlertDatabaseConstraintException {
    Optional<RoleEntity> foundRole = roleRepository.findById(roleId);
    if (foundRole.isPresent()) {
        RoleEntity roleEntity = foundRole.get();
        if (BooleanUtils.isFalse(roleEntity.getCustom())) {
            throw new AlertDatabaseConstraintException("Cannot update the existing role '" + foundRole.get().getRoleName() + "' to '" + roleName + "' because it is not a custom role");
        }
        RoleEntity updatedEntity = new RoleEntity(roleName, true);
        updatedEntity.setId(roleEntity.getId());
        roleRepository.save(updatedEntity);
    }
}
 
Example 8
Source File: ListEditorPopupWindow.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected void addValueToLayout(final Object value, String str) {
    BoxLayout itemLayout = uiComponents.create(HBoxLayout.class);
    itemLayout.setId("itemLayout");
    itemLayout.setSpacing(true);

    Label<String> itemLab = uiComponents.create(Label.NAME);
    if (options instanceof MapOptions) {
        //noinspection unchecked
        Map<String, Object> optionsMap = ((MapOptions) options).getItemsCollection();
        str = optionsMap.entrySet()
                .stream()
                .filter(entry -> Objects.equals(entry.getValue(), value))
                .findFirst()
                .get().getKey();
    }
    itemLab.setValue(str);
    itemLayout.add(itemLab);
    itemLab.setAlignment(Alignment.MIDDLE_LEFT);

    LinkButton delItemBtn = uiComponents.create(LinkButton.class);
    delItemBtn.setIcon("icons/item-remove.png");
    delItemBtn.addClickListener(e -> {
        valuesMap.remove(value);
        valuesLayout.remove(itemLayout);
    });

    itemLayout.add(delItemBtn);

    if (BooleanUtils.isFalse(editable)) {
        delItemBtn.setEnabled(false);
    }

    valuesLayout.add(itemLayout);
    valuesMap.put(value, str);
}
 
Example 9
Source File: ActionCloseCheck.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
private WoDraft draft(EffectivePerson effectivePerson, Work work, Process process) throws Exception {
	WoDraft wo = new WoDraft();
	wo.setValue(false);
	if ((null != work) && (BooleanUtils.isFalse(work.getDataChanged()))
			&& (Objects.equals(ActivityType.manual, work.getActivityType()))) {
		if ((null != process) && (BooleanUtils.isTrue(process.getCheckDraft()))) {
			if (effectivePerson.isPerson(work.getCreatorPerson())) {
				ThisApplication.context().applications().deleteQuery(x_processplatform_service_processing.class,
						Applications.joinQueryUri("work", work.getId()), work.getJob()).getData(Wo.class);
				wo.setValue(true);
			}
		}
	}
	return wo;
}
 
Example 10
Source File: CSVSchemaParser.java    From data-prep with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the portion of a line that is not in quote as a string.
 *
 * @return he portion of a line that is not in quote as a string
 * @throws IOException
 */
public String readLine() throws IOException {
    final String currentLine;
    if (totalChars < sizeLimit && lineCount < lineLimit && (currentLine = reader.readLine()) != null) {
        totalChars += currentLine.length() + 1; // count the new line character
        if (BooleanUtils.isFalse(inQuote)) {
            lineCount++;
        }
        return processLine(currentLine);
    } else {
        reader.close();
        return null;
    }
}
 
Example 11
Source File: DynamicAttributesCondition.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
protected void updateText() {
    if (operator == Op.NOT_EMPTY) {
        if (BooleanUtils.isTrue((Boolean) param.getValue())) {
            text = text.replace("not exists", "exists");
        } else if (BooleanUtils.isFalse((Boolean) param.getValue()) && !text.contains("not exists")) {
            text = text.replace("exists ", "not exists ");
        }
    }

    if (!isCollection) {
        if (operator == Op.ENDS_WITH || operator == Op.STARTS_WITH || operator == Op.CONTAINS || operator == Op.DOES_NOT_CONTAIN) {
            Matcher matcher = LIKE_PATTERN.matcher(text);
            if (matcher.find()) {
                String escapeCharacter = ("\\".equals(QueryUtils.ESCAPE_CHARACTER) || "$".equals(QueryUtils.ESCAPE_CHARACTER))
                        ? QueryUtils.ESCAPE_CHARACTER + QueryUtils.ESCAPE_CHARACTER
                        : QueryUtils.ESCAPE_CHARACTER;
                text = matcher.replaceAll("$1 ESCAPE '" + escapeCharacter + "' ");
            }
        }
    } else {
        if (operator == Op.CONTAINS) {
            text = text.replace("not exists", "exists");
        } else if (operator == Op.DOES_NOT_CONTAIN && !text.contains("not exists")) {
            text = text.replace("exists ", "not exists ");
        }
    }
}
 
Example 12
Source File: TagDaoImpl.java    From herd with Apache License 2.0 5 votes vote down vote up
@Override
public List<TagEntity> getTagsByTagTypeEntityAndParentTagCode(TagTypeEntity tagTypeEntity, String parentTagCode, Boolean isParentTagNull)
{
    // Create the criteria builder and the criteria.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<TagEntity> criteria = builder.createQuery(TagEntity.class);

    // The criteria root is the tag entity.
    Root<TagEntity> tagEntityRoot = criteria.from(TagEntity.class);

    // Get the columns.
    Path<String> displayNameColumn = tagEntityRoot.get(TagEntity_.displayName);

    // Create the standard restrictions (i.e. the standard where clauses).
    List<Predicate> predicates = new ArrayList<>();
    predicates.add(builder.equal(tagEntityRoot.get(TagEntity_.tagType), tagTypeEntity));

    if (StringUtils.isNotBlank(parentTagCode))
    {
        // Return all tags that are immediate children of the specified parent tag.
        predicates.add(builder.equal(builder.upper(tagEntityRoot.get(TagEntity_.parentTagEntity).get(TagEntity_.tagCode)), parentTagCode.toUpperCase()));
    }
    else if (BooleanUtils.isTrue(isParentTagNull))
    {
        // The flag is non-null and true, return all tags with no parents, i.e. root tags.
        predicates.add(builder.isNull(tagEntityRoot.get(TagEntity_.parentTagEntity)));
    }
    else if (BooleanUtils.isFalse(isParentTagNull))
    {
        // The flag is non-null and false, return all tags with parents.
        predicates.add(builder.isNotNull(tagEntityRoot.get(TagEntity_.parentTagEntity)));
    }

    // Add all clauses to the query.
    criteria.select(tagEntityRoot).where(builder.and(predicates.toArray(new Predicate[predicates.size()]))).orderBy(builder.asc(displayNameColumn));

    // Run the query to get the results.
    return entityManager.createQuery(criteria).getResultList();
}
 
Example 13
Source File: SetuidHandler.java    From prebid-server-java with Apache License 2.0 5 votes vote down vote up
private void handleResult(AsyncResult<TcfResponse<Integer>> asyncResult, RoutingContext context,
                          UidsCookie uidsCookie, String bidder) {
    if (asyncResult.failed()) {
        respondWithError(context, bidder, asyncResult.cause());
    } else {
        // allow cookie only if user is not in GDPR scope or vendor passed GDPR check
        final TcfResponse<Integer> tcfResponse = asyncResult.result();

        final boolean notInGdprScope = BooleanUtils.isFalse(tcfResponse.getUserInGdprScope());

        final Map<Integer, PrivacyEnforcementAction> vendorIdToAction = tcfResponse.getActions();
        final PrivacyEnforcementAction privacyEnforcementAction = vendorIdToAction != null
                ? vendorIdToAction.get(gdprHostVendorId)
                : null;
        final boolean blockPixelSync = privacyEnforcementAction == null
                || privacyEnforcementAction.isBlockPixelSync();

        final boolean allowedCookie = notInGdprScope || !blockPixelSync;

        if (allowedCookie) {
            respondWithCookie(context, bidder, uidsCookie);
        } else {
            respondWithoutCookie(context, HttpResponseStatus.OK.code(),
                    "The gdpr_consent param prevents cookies from being saved", bidder);
        }
    }
}
 
Example 14
Source File: ActionStart.java    From o2oa with GNU Affero General Public License v3.0 4 votes vote down vote up
ActionResult<JsonElement> execute(EffectivePerson effectivePerson, String id) throws Exception {
	ActionResult<JsonElement> result = new ActionResult<>();
	Process process = null;
	Draft draft = null;
	try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
		Business business = new Business(emc);
		draft = emc.find(id, Draft.class);
		if (null == draft) {
			throw new ExceptionEntityNotExist(id, Draft.class);
		}
		if ((!effectivePerson.isPerson(draft.getPerson())) && (!business
				.canManageApplicationOrProcess(effectivePerson, draft.getApplication(), draft.getProcess()))) {
			throw new ExceptionAccessDenied(effectivePerson, draft);
		}
		Application application = business.application().pick(draft.getApplication());
		if (null == application) {
			throw new ExceptionEntityNotExist(draft.getApplication(), Application.class);
		}
		process = business.process().pick(draft.getProcess());
		if (null == process) {
			throw new ExceptionEntityNotExist(draft.getProcess(), Process.class);
		}
		if(StringUtils.isNotEmpty(process.getEdition()) && BooleanUtils.isFalse(process.getEditionEnable())){
			process = business.process().pickEnabled(process.getApplication(), process.getEdition());
		}

	}
	ActionCreateWi req = new ActionCreateWi();

	req.setData(XGsonBuilder.instance().toJsonTree(draft.getProperties().getData()));
	req.setIdentity(draft.getIdentity());
	req.setLatest(false);
	req.setTitle(draft.getTitle());

	// 创建工作
	JsonElement jsonElement = ThisApplication.context().applications()
			.postQuery(x_processplatform_assemble_surface.class,
					Applications.joinQueryUri("work", "process", process.getId()), req, process.getId())
			.getData();

	try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
		draft = emc.find(id, Draft.class);
		emc.beginTransaction(Draft.class);
		emc.remove(draft, CheckRemoveType.all);
		emc.commit();
	}

	result.setData(jsonElement);
	return result;
}
 
Example 15
Source File: ActionAddSplit.java    From o2oa with GNU Affero General Public License v3.0 4 votes vote down vote up
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String id, JsonElement jsonElement)
		throws Exception {

	try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {

		ActionResult<List<Wo>> result = new ActionResult<>();
		Business business = new Business(emc);
		Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
		/* 校验work是否存在 */
		Work work = emc.find(id, Work.class);
		if (null == work) {
			throw new ExceptionEntityNotExist(id, Work.class);
		}
		if (ListTools.isEmpty(wi.getSplitValueList())) {
			throw new ExceptionEmptySplitValue(work.getId());
		}
		Manual manual = business.manual().pick(work.getActivity());
		if (null == manual || BooleanUtils.isFalse(manual.getAllowAddSplit())
				|| (!BooleanUtils.isTrue(work.getSplitting()))) {
			throw new ExceptionCannotAddSplit(work.getId());
		}

		List<WorkLog> workLogs = this.listWorkLog(business, work);

		WorkLogTree tree = new WorkLogTree(workLogs);

		Node currentNode = tree.location(work);

		if (null == currentNode) {
			throw new ExceptionWorkLogWithActivityTokenNotExist(work.getActivityToken());
		}

		Node splitNode = this.findSplitNode(tree, currentNode);

		if (null == splitNode) {
			throw new ExceptionNoneSplitNode(work.getId());
		}

		Req req = new Req();

		req.setWorkLog(splitNode.getWorkLog().getId());

		if (BooleanUtils.isTrue(wi.getTrimExist())) {
			List<String> splitValues = ListUtils.subtract(wi.getSplitValueList(),
					this.existSplitValues(tree, splitNode));
			if (ListTools.isEmpty(splitValues)) {
				throw new ExceptionEmptySplitValueAfterTrim(work.getId());
			}
			req.setSplitValueList(splitValues);
		} else {
			req.setSplitValueList(wi.getSplitValueList());
		}

		List<Wo> wos = ThisApplication.context().applications()
				.putQuery(x_processplatform_service_processing.class,
						Applications.joinQueryUri("work", work.getId(), "add", "split"), req)
				.getDataAsList(Wo.class);

		result.setData(wos);
		return result;
	}
}
 
Example 16
Source File: Person.java    From o2oa with GNU Affero General Public License v3.0 4 votes vote down vote up
public Boolean getCodeLogin() {
	return BooleanUtils.isFalse(this.codeLogin) ? false : true;
}
 
Example 17
Source File: Vfs.java    From o2oa with GNU Affero General Public License v3.0 4 votes vote down vote up
public Boolean getPassive() {
	return (!BooleanUtils.isFalse(this.passive));
}
 
Example 18
Source File: Process.java    From o2oa with GNU Affero General Public License v3.0 4 votes vote down vote up
public Boolean getRouteNameAsOpinion() {
	return BooleanUtils.isFalse(routeNameAsOpinion) ? false : true;
}
 
Example 19
Source File: BooleanWebStorageEntry.java    From openemm with GNU Affero General Public License v3.0 4 votes vote down vote up
public boolean isFalse() {
    return BooleanUtils.isFalse(getValue());
}
 
Example 20
Source File: ValidationAlertHolder.java    From cuba with Apache License 2.0 4 votes vote down vote up
public static boolean isListen() {
    return BooleanUtils.isFalse(validationAlert);
}